# [OS X TeX] TS opens multiple copies of same root and PDF

Alain Schremmer schremmer.alain at gmail.com
Fri Apr 22 19:21:11 CEST 2016

On , at 2016 Apr 22,6:57 AM, Themis Matsoukas wrote:

> TS (3.61) seems to open multiple copies of the same file. I’m working with a root file that calls six chapters by \includefile. Each chapter is connected to the root file by a %!TEX root command. All source files are in the same folder.

This is not directly relevant to your problem but, since you "use root files a lot", I thought I might mention that I once got fed-up with root files, includeonly, and the lot and, after quite a bit of fiddling, ended up with the following file structure, the point of which is completely to separate the TEXT of each chapter from everything else (and make each one typesettable all by itself), and with which I have lived happily ever after.

What makes it work is the systematic use of \jobname which, at least with TeXShop, allows all files other than those containing the text to be just copies of a generic file. Of course, the structure extends naturally for the ancillaries. See <http://tug.org/pracjourn/2010-2/schremmer.html>.

Book (Folder for EVERYTHING about the book.) which contains the following five folders:
• Figures (Folder for the pdfs in the includegraphics)
1 (Folder for Chapter 1)
2 (Folder for Chapter 2)
. . .
n (Folder for Chapter n)
101 (Folder for Appendix 1)
• Graphics (Folder for the editable graphics files from which the pdf are made. Intaglio remembers where in Figures to put the pdfs.)
1 (Folder for Chapter 1)
2 (Folder for Chapter 2)
. . .
n (Folder for Chapter n)
101 (Folder for Appendix 1)

• Stylesheets (Folder for
- GraphicsPaths.sty    Which contains just the command
\graphicspath%
{%
{../Figures/1/}
{../Figures/2/}
. . .
{../Figures/n/}
{../Figures/101/}
}%
- Preamble.sty    Which is where the \usepackages are listed as well as where the various \definecolor, \newcounter, \newcommand, etc are defined.

• Text-contents folder      Which contains ONLY the files that contain the TEXT. So this is the working folder.
1.tex (Text of Chapter 1)
2.tex (Text of Chapter 2)
. . .
n.tex (Text of Chapter n)
101.tex (Text of Appendix 1)
All these files, from which one can typeset the chapter, start with
%!TEX root = ../Text-controls/\jobname.tex
%!TEX TS-program = pdflatexmk
\chapter{Name}
\ChapterToc
followed by the text of the chapter.
BOOK.tex
from which one can typeset the book and which contains only the commands
%!TEX root = ../Text-controls/\jobname.tex
%!TEX TS-program = pdflatexmk
\mainmatter
\include{../Text-contents/1}
\include{../Text-contents/2}
. . .
\include{../Text-contents/n}
where commenting out chapter lines lets one choose which chapters to include in the book.

• Text-control folder (Contains the control files which one usually leaves entirely alone.)
1.tex  (Control of Chapter 1)
2.tex  (Control of Chapter 2)
. . .
n.tex  (Control of Chapter n)
101.tex  (Control of Appendix 1)
from which one also can typeset the chapter, and which are all copies of the generic file containing the following code:
% !TEX TS-program = pdflatexmk
\documentclass[11pt]{book}
\usepackage{../StyleSheets/Preamble}
\usepackage{../StyleSheets/GraphicsPaths}
\begin{document}
\addtocounter{page}{n}	(where n+1 will be the number of the first page of the chapter.)
\include{../Text-contents/\jobname}
\printindex
\end{document}
BOOK.tex
from which one also can typeset the book and which contains only the following code:
% !TEX TS-program = pdflatexmk
\documentclass[11pt]{book}

\usepackage{../StyleSheets/Preamble}
\usepackage{../StyleSheets/GraphicsPaths}

\begin{document}
\frontmatter
\thispagestyle{empty}
\hspace{-12mm}{\Large \textsc{Name of the Book}}
\cleartooddpage[\thispagestyle{empty}]

etc, etc

\tableofcontents
\input{../Text-contents/BOOK}

\appendix
\include{../Text-contents/101}

\backmatter
\phantomsection
\printindex
\end{document}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/macostex-archives/attachments/20160422/59205eb1/attachment-0001.html>
-------------- next part --------------
----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://www.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex