Preview a single child document while maintaining counters and references

Daniel xracoonx at gmx.de
Thu Mar 12 05:46:27 UTC 2020


On 11/3/20 22:44, Patrick De Visschere wrote:
> 
> 
>> On 11 Mar 2020, at 17:58, Daniel <xracoonx at gmx.de 
>> <mailto:xracoonx at gmx.de>> wrote:
>>
>> On 2020-03-11 08:38, Jürgen Spitzmüller wrote:
>>> Am Dienstag, den 10.03.2020, 15:17 +0100 schrieb Daniel:
>>>> However, often I would like to preview only one child document (e.g.
>>>> one
>>>> chapter) while maintaining counters and references. Is there a quick
>>>> way
>>>> to do so?
>>> You mean, without the master? No. I don't think that's possible in
>>> LaTeX either.
>>> Jürgen
>>
>> I see. I wasn't that this is pure LaTeX magic. I guess, I should then 
>> just set up my master in such a way that excluding all children except 
>> for one chapter leads to my desired result.
>>
>> Daniel
> 
> Take a look here:
> http://web.science.mq.edu.au/~rdale/resources/writingnotes/latexstruct.html 
> <http://web.science.mq.edu.au/~rdale/resources/writingnotes/latexstruct.html>
> 
> With \includeonly{somechapter} in the preamble (of the master) one can 
> limit the output to that chapter.
> But one must have compiled the complete document once before this will 
> work, because the .aux files of all childs are needed.
> 
> This works straight away with e.g. TexShop.
> 
> With lyx one must first compile (only once I think) the complete 
> document and then one can enter the \includeonly{name_used_by_lyx} 
> command in the preamble of the master.
> You will have to look up the correct name in the master.tex file 
> generated by lyx (in the temp directory) since the filenames are modified.
> 
> Thanks for bringing this up. I was looking for it too.
> 
> Patrick
> 

Patrick, I think the functionality your are mentioning that LaTeX has 
for this is actually already integrated into LyX. Have a look at 
Document > Settings > Child Documents. Here you can set which child 
documents to put into the \includeonly command and also choose whether 
the aux file of the whole document should be generated or not (via the 
maintain counters and references checkbox).

Normally, I had some content in my master document that was not part of 
a child document, e.g. title, table of contents, bibliography, etc. But 
now, I just put those into their own child documents ("front matter" and 
"back matter"). Then I can compile just a single chapter using LyX's 
functionality. Now that I think of it, pretty straight forward to 
arrange a document like this.

Since it is so straight forward and going back to the master to set to 
only include one chapter is a bit cumbersome, maybe LyX could give one a 
special Preview option on child documents, called "Preview Master with 
Child Document Only" or so. This option will typeset the master with the 
\includeonly command containing only the current child document while 
maintaining counters and references. That would be very handy, if one 
needs to send or print out only single chapters without any other material.

Daniel



More information about the lyx-users mailing list