# [OS X TeX] Syncing in one direction only

Alain Schremmer schremmer.alain at gmail.com
Fri Dec 17 05:15:34 CET 2010

On Dec 16, 2010, at 10:00 PM, Don Green Dragon wrote:

> Hello All,
>
> I'm using version 2.37 of TeXShop. Recently I completed work on two
> LaTeX documents
> 	Chapter1.tex  and  Chapter2.tex
> These files can each be typeset with the LaTeX option; i.e., each
> has a full preamble.
>
> Wanting to put them together, a file Master.tex was created.
> Master.tex uses the same preamble that  Chapter1.tex  and
> Chapter2.tex  used, but Chapter1.tex  and  Chapter2.tex were
> "stripped down" to form the files
> 	Chapter1short.tex  and  Chapter2short.tex
> i.e., the more recent files are just the old guys with the preamble
> and back matter removed; i.e., they begin with a \chapter{...}
> command. Additionally, the new guys end with \endinput not \end
> {document}. In Master.tex, I have
>
> \include{Chap1/Chapter1short}
> \include{Chap2/Chapter2short}
>
> The above is used because the files are related as follows:
>
> ~JUNK/Master.tex
> ~JUNK/Chap1/Chapter1short.tex
> ~JUNK/Chap2/Chapter2short.tex
> ~JUNK/Chap1/Chapter1.tex
> ~JUNK/Chap2/Chapter2.tex

You may wish to consider the following alternative:

First, I have two folders: Contents and Controls

---In the Contents folder I have files named 0.tex, (that's for the
Preface),1.tex, 2.tex etc each of which starts as follows:

%!TEX root = ../Controls/\jobname.tex
\chapter{My Chapter One}
Some text

---In the Controls folder, I have files also named 0.tex, 1.tex,
2.tex etc each of which is just a copy of:

\documentclass[11pt]{book}
\usepackage{xxx}
\begin{document}
\addtocounter{page}{0}%Must be adjusted manually from the WholeBook
\addtocounter{chapter}{\jobbame-1}%This, though, is automatic
\include{../Contents/\jobname}
\end{document}

Thus, I can typeset a chapter either from the Content file or from
the Control file.

---Thirdly, I have a folder WholeBook which contains the file MyBook
which is the usual root file:

\documentclass[11pt]{book}
\usepackage{xxx}
\usepackage{yyy}
\begin{document}
\frontmatter
\include{../Contents/1}
\include{../Contents/2}
etc
\end{document}

which will of course typeset the whole book.

In fact, for the sake of symmetry, I am now using the following
variation on the above theme

I have only the two folders: Contents and Controls (No WholeBook) in
which I have the same files as above but also, in addition:

---In the Contents folder:

The file ALL.tex:

%!TEX root = ../Controls/\jobname.tex
\include{../Contents/0}%Preface to be numbered along with the
contents, etc
\mainmatter
\include{../Contents/1}
\include{../Contents/2}
etc

---In the Controls folder

The file ALL.tex:

\documentclass[11pt]{book}
\usepackage{xxx}
\usepackage{yyy}
\begin{document}
\frontmatter
\input{../Contents/ALL}
\backmatter
\include{../Text-contents/99}%That's the GNU FDL
\printindex
\end{document}

And, again, I can typeset the whole book from either the Contents or
the Control file.

Regards
--schremmer