[texworks] Typesetting a Complete Document from Editor of Included Document

Herbert Schulz herbs at wideopenwest.com
Thu Aug 11 16:09:59 CEST 2011


On Aug 11, 2011, at 8:57 AM, Michael Wirtzfeld wrote:

> Good morning, all:
> 
> I have a question regarding typesetting.
> 
> I have a base LaTeX document that incorporates another document using the
> \INCLUDE command.  When I compile the entire document using TexWorks, I need
> to initiate the typeset command from the base or root document.
> 
> Is there a way to typset directly from the editor of the included document?
> 
> 
> Thank you in advance,
> 
> Michael.
> 

Howdy,

Place the line

% !TEX root = path/to/root

at the top of the included files. Here path/to/root is the relative or absolute path to the root document. E.g., imagine a root document, mybook.tex, with included chapters, chapter1.tex, …, in a sub-folder, chaps, of the folder containing the root document; place the line

% !TEX root = ../mybook.tex

at the top of all the chapter files. Then, when you typeset the chapter document TeXworks `knows' that it should really typeset the root document. It also makes source<->pdf sync work too.

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)






More information about the texworks mailing list