[OS X TeX] Typesetting individual chapter of a book.

Herbert Schulz herbs at wideopenwest.com
Thu Jan 20 19:35:25 CET 2011


Howdy,

Here's something I saw on comp.text.tex today and I thought it might be of interest to Schremmer and others that want to be able to typeset one chapter of a book at a time for proofreading.

*********************
On Jan 20, 1:46 pm, iaw4 <ivo... at gmail.com> wrote:
> dear latex wizards---
>
> right now, I have a book with many chapters, and '\includeonly'
> statements.  what I would like is the option of compiling the chapters
> by themselves.  that is, if I do '$ pdflatex chapter1.tex', it would
> create a chapter1.pdf file.  I understand that cross-references, etc.,
> are lost.
>
> \ifndef\IAMINCLUDED
> \documentclass{book}
> \usepackage{times}
> \begin{document}
> \fi
>
> \chapter{How To Use LaTeX}
>
> \ifndef\IAMINCLUDED
> \end{document}
> \fi
>
> is this possible?  obviously \ifndef\IAMINCLUDED fails.
>
> /iaw
>
> PS:  I am trying to summarize what I see as advantages and
> disadvantages of (La)TeX athttp://ivo-welch.blogspot.com/2011/01/latex-advantages-and-disadvanta...
> .
Have a look at the 'standalone' class. It is more for tex files which
are read using \input, but also work for \includes with the options
mentioned below.
There is also the similar 'docmute' package (or was it a class?)

Examples:

%% Chapter file
\documentclass[class=book,preview=false]{standalone}
\usepackage{times}

\begin{document}

\chapter{How To Use LaTeX}
test

\end{document}
%%%

%% Main File
\documentclass{book}

\usepackage{times}
\usepackage{standalone}

\begin{document}
\include{ch}
\end{document}
%%%


There is also the \ifstandalone switch provided, if you need it.

Best,
Martin
*********************

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)






More information about the macostex-archives mailing list