# [OS X TeX] [TeXShop] input file and master doc compilation

Alain Schremmer schremmer.alain at gmail.com
Wed Feb 3 18:34:21 EST 2010

On Feb 3, 2010, at 5:34 PM, Sylvain CHAMBON wrote:

> howdy (again) !
>
> i have a document (book class) in which i input files for each
> chapter in order to work only on the chapter in process. this
> chapter file is not indeed a tex document, just a piece of text.
>
> now imagine i have in the master document the line '\input{./
> chapitres/3e-trigo}' among other things and i'm working on this
> file '3e-trigo'. is there a way to compile this file _without_
> opening the master document ? in fact, i have actually to do
> backwards and forwards all the time between the master document and
> the file of the chapter to see the result of what i'm writing...
> which it's quite boring !!!

Here is the way I do it with the magnum opus.

I have three folders:
Chapters-contents
Chapters-controls
Textbook

A) The files in Chapters-contents are numbered, say, 1, 2, 3 and they

File 1 starts as:
%!TEX root = ../Chapters-controls/\jobname.tex
\chapter{Blah Blah Of The First Kind}
Blah Blah

File 2 starts as:
%!TEX root = ../Chapters-controls/\jobname.tex
\chapter{Blah Blah Of The Second Kind}
Blah Blah

Etc

B) The files in Chapters-control are numbered the same way and are
all copies of the single:

\documentclass[11pt]{book}
\usepackage{MyPreamble}
\begin{document}

whole book.

\include{../Chapters-contents/\jobname}
%	\printindex
\end{document}

No more, no less.

C) The third folder consists of only one .tex file together with its
aux:

\documentclass[11pt]{book}
\usepackage{MyPreamble}
\begin{document}
\frontmatter
. . .
\tableofcontents

%1 - Blah Blah Of The First Kind:
\include{../Chapters-contents/1}

%2 - Blah Blah Of The Second Kind:
\include{../Chapters-contents/2}

%3 - Blah Blah Of The Third Kind:
\include{../Chapters-contents/3}
. . .
\printindex
\end{document}

I can thus typeset a chapter from both the Content file and from the
Control file. I typeset the whole book once in a while to update the

There are other possibilities as well. For instance, until I
interactively which chapter(s) to include.

My separation of contents and controls, though, comes in very handy
when you want to give the reader the freedom of choice among
different options such as to how to format Exercises, Exams. etc More
details should you be interested. (An old implementation of this
"system" can be found on http://www.freemathtexts.org but the new
improved version of the system has yet to get there--but will be
"soon".)

Regards
--schremmer