# [texhax] Detecting in-document-ness?

Fri Feb 18 19:14:13 CET 2005

Douglas Lewan :

> All,
>
> I'm writing a book and, while writing it, would typically prefer to be
> able to view the current chapter on its own.
>
> Is there a standard/common way to detect if LaTeX is already in a
> document and only if not, then do the normal start of document
> processing, like \documentclass{} and \begin{document} (and maybe a few
> other things that I'll need)?
>
> Thanks.
>

create a master document, master.tex, say. Placere every chapter in a .tex
file in their own e.g. chap1.tex, chap2.tex ..., include these using
\include{chap1}
\include{chap2}
...

compile your full document (i.e. master.tex) untell it's fully updated,
then place a \includeonly{chap2} in the preamble and recompile

then it only shows the material from chapter 2, ubt it also keeps all of
the chapternumberings and cross references intact.

All decent editors include a feature where you tell it to compile master

--

/daleif

You cannot help men permanently by doing for them
what they could and should do for themselves. ''
-- Abraham Lincoln