0

The question is fairly simple to state

How do I cross reference from a child document to a label in the parent document.

LyX seems to supported as it offers you the available labels from other documents in the cross reference dialog.

But when I do that and I want to view the PDF, pdftex will hang and LyX refuses to shutdown as it claims there are still processes running.

Do I something wrong, if so, what do I have to do to get a cross reference referring to a label in a parent document If not, is it a bug in LyX?

nanitous
  • 681
  • 7
  • 17
  • To be clear, you're not compiling the child document, right? This only works if you compile the master document. Even if you are compiling the child document though, it should not hang. What OS are you on? I do this all the time and have never had a problem, on Ubuntu with LyX 2.1.2. – scottkosty Oct 16 '14 at 18:27

1 Answers1

0

Okay, forget it.

Something completely unrelated to labeling and referecing by me as the user caused the problem.

So, what was the problem?

The whole document uses the mhchem package to support neatly typeset chemical formulas and reactions. In the offending child document I added a $\ce{H2O}$ in \subsubsection header. Somehow the mhchem package doesn't count on \ce commands used in a \subsubsection.

When I used TeXShop to compile the LyX documents, the log clearly pointed out what the offending command caused trouble and where to find its location.

A nice lesson is to be learned from this: If LyX behaves in strange ways, use either the command line tools, like pdflatex or pdftex, or a tool like TeXShop to diagnose the problem. Don't rely too easily on LyX to help you.

The concrete solution is:

  1. Export the parent and child documents to .tex files
  2. Compile the parent TeX document using a command line tool or TeXShop
  3. Remove the offending \ce command from the \subsubsection header.
nanitous
  • 681
  • 7
  • 17