简体   繁体   中英

LyX cross referening a label from a child document to a parent document

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM