In case you don't like to maintain the code for different schools in different files, the docstrip-package might be of interest to you.
With that package you can grab tagged portions of .tex-input-files and combine these portions to other .tex-input-files.
With the following example, allschools.tex, the docstrip-package is used for generating the files Hogwarts.tex, StarFleetAcademy.tex, MysticFallsUniversity.tex and EmpireStateUniversity.tex from allschools.tex.
Each of these generated files contains the compilable document for the school in question.
You could use the same loop that is used for creating these .tex-files for via \write18
calling pdflatex or texify or latexmk and compiling them.
File: allschools.tex
%<*ignore>
\input docstrip
\nopreamble\nopostamble
\askforoverwritetrue
%
\def\gobble#1{}%
\def\firstofone#1{#1}%
\def\loopthroughschoolnames#1{%
\ifx\relax#1\expandafter\gobble\else\expandafter\firstofone\fi
{%
\generate{%
\file{#1.tex}{%
\from{allschools.tex}{documentpreamble}%
\from{allschools.tex}{#1-Variables}%
\from{allschools.tex}{documentgeneralparts}%
\from{allschools.tex}{#1-Specific-Sections}%
\from{allschools.tex}{documentend}%
}%
}%
%
% In case you have \write18 available, you can
% now via \write18 call texify or pdflatex or latexmk
% for compiling the file school\number\mycnt.tex
% in order to obtain school\number\mycnt.pdf.
%
\loopthroughschoolnames
}%
}%
%
\loopthroughschoolnames{Hogwarts}
{StarFleetAcademy}
{MysticFallsUniversity}
{EmpireStateUniversity}
\relax
%
\csname stop\endcsname
\bye
%</ignore>
%<*documentpreamble>
\documentclass{article}
%\usepackage...
%...
\makeatletter
%</documentpreamble>
%<*documentgeneralparts>
\makeatother
\begin{document}
\tableofcontents
\section{A section of the general part}
This is a section of the general part.
Now let's within the general part use the school-specific-variables:
\begin{itemize}
\item \verb|\schoolvariableA| is: \schoolvariableA
\item \verb|\schoolvariableB| is: \schoolvariableB
\item \verb|\schoolvariableC| is: \schoolvariableC
\end{itemize}
\section{Another section of the general part}
This is another section of the general part.
Now let's come to the school-specific text-part:
%</documentgeneralparts>
%<*documentend>
\end{document}
%</documentend>
%
%==== School: Hogwarts =================================
%
%<*Hogwarts-Variables>
\newcommand\schoolvariableA{%
This is school-variable A with Hogwarts.
}%
\newcommand\schoolvariableB{%
This is school-variable B with Hogwarts.
}%
\newcommand\schoolvariableC{%
This is school-variable C with Hogwarts.
}%
%...
%</Hogwarts-Variables>
%<*Hogwarts-Specific-Sections>
\section{A section about Hogwarts}
Hogwarts is a nice school.
Hogwarts is a nice school.
Hogwarts is a nice school.
Hogwarts is a nice school.
Hogwarts is a nice school.
Hogwarts is a nice school.
Hogwarts is a nice school.
That's the end of the school-specific part with Hogwarts.
%</Hogwarts-Specific-Sections>
%
%==== School: StarFleetAcademy =================================
%
%<*StarFleetAcademy-Variables>
\newcommand\schoolvariableA{%
This is school-variable A with Star Fleet Academy.
}%
\newcommand\schoolvariableB{%
This is school-variable B with Star Fleet Academy.
}%
\newcommand\schoolvariableC{%
This is school-variable C with Star Fleet Academy.
}%
%...
%</StarFleetAcademy-Variables>
%<*StarFleetAcademy-Specific-Sections>
\section{A section about Star Fleet Academy}
Star Fleet Academy is a strange school.
Star Fleet Academy is a strange school.
Star Fleet Academy is a strange school.
Star Fleet Academy is a strange school.
Star Fleet Academy is a strange school.
Star Fleet Academy is a strange school.
Star Fleet Academy is a strange school.
That's the end of the school-specific part with Star Fleet Academy.
%</StarFleetAcademy-Specific-Sections>
%
%==== School: MysticFallsUniversity =================================
%
%<*MysticFallsUniversity-Variables>
\newcommand\schoolvariableA{%
This is school-variable A with Mystic Falls University.
}%
\newcommand\schoolvariableB{%
This is school-variable B with Mystic Falls University.
}%
\newcommand\schoolvariableC{%
This is school-variable C with Mystic Falls University.
}%
%...
%</MysticFallsUniversity-Variables>
%<*MysticFallsUniversity-Specific-Sections>
\section{A section about Mystic Falls University}
Mystic Falls University is a funny school.
Mystic Falls University is a funny school.
Mystic Falls University is a funny school.
Mystic Falls University is a funny school.
Mystic Falls University is a funny school.
Mystic Falls University is a funny school.
Mystic Falls University is a funny school.
That's the end of the school-specific part with Mystic Falls University.
%</MysticFallsUniversity-Specific-Sections>
%
%==== School: EmpireStateUniversity =================================
%
%<*EmpireStateUniversity-Variables>
\newcommand\schoolvariableA{%
This is school-variable A with Empire State University.
}%
\newcommand\schoolvariableB{%
This is school-variable B with Empire State University.
}%
\newcommand\schoolvariableC{%
This is school-variable C with Empire State University.
}%
%...
%</EmpireStateUniversity-Variables>
%<*EmpireStateUniversity-Specific-Sections>
\section{A section about Empire State University}
Empire State University is an exciting school.
Empire State University is an exciting school.
Empire State University is an exciting school.
Empire State University is an exciting school.
Empire State University is an exciting school.
Empire State University is an exciting school.
Empire State University is an exciting school.
That's the end of the school-specific part with Empire State University.
%</EmpireStateUniversity-Specific-Sections>
When compiling allschools.tex with (pdf)(La)TeX, you get
a) Hogwarts.tex
\documentclass{article}
\makeatletter
\newcommand\schoolvariableA{%
This is school-variable A with Hogwarts.
}%
\newcommand\schoolvariableB{%
This is school-variable B with Hogwarts.
}%
\newcommand\schoolvariableC{%
This is school-variable C with Hogwarts.
}%
\makeatother
\begin{document}
\tableofcontents
\section{A section of the general part}
This is a section of the general part.
Now let's within the general part use the school-specific-variables:
\begin{itemize}
\item \verb|\schoolvariableA| is: \schoolvariableA
\item \verb|\schoolvariableB| is: \schoolvariableB
\item \verb|\schoolvariableC| is: \schoolvariableC
\end{itemize}
\section{Another section of the general part}
This is another section of the general part.
Now let's come to the school-specific text-part:
\section{A section about Hogwarts}
Hogwarts is a nice school.
Hogwarts is a nice school.
Hogwarts is a nice school.
Hogwarts is a nice school.
Hogwarts is a nice school.
Hogwarts is a nice school.
Hogwarts is a nice school.
That's the end of the school-specific part with Hogwarts.
\end{document}
b) StarFleetAcademy.tex
\documentclass{article}
\makeatletter
\newcommand\schoolvariableA{%
This is school-variable A with Star Fleet Academy.
}%
\newcommand\schoolvariableB{%
This is school-variable B with Star Fleet Academy.
}%
\newcommand\schoolvariableC{%
This is school-variable C with Star Fleet Academy.
}%
\makeatother
\begin{document}
\tableofcontents
\section{A section of the general part}
This is a section of the general part.
Now let's within the general part use the school-specific-variables:
\begin{itemize}
\item \verb|\schoolvariableA| is: \schoolvariableA
\item \verb|\schoolvariableB| is: \schoolvariableB
\item \verb|\schoolvariableC| is: \schoolvariableC
\end{itemize}
\section{Another section of the general part}
This is another section of the general part.
Now let's come to the school-specific text-part:
\section{A section about Star Fleet Academy}
Star Fleet Academy is a strange school.
Star Fleet Academy is a strange school.
Star Fleet Academy is a strange school.
Star Fleet Academy is a strange school.
Star Fleet Academy is a strange school.
Star Fleet Academy is a strange school.
Star Fleet Academy is a strange school.
That's the end of the school-specific part with Star Fleet Academy.
\end{document}
c) MysticFallsUniversity.tex
\documentclass{article}
\makeatletter
\newcommand\schoolvariableA{%
This is school-variable A with Mystic Falls University.
}%
\newcommand\schoolvariableB{%
This is school-variable B with Mystic Falls University.
}%
\newcommand\schoolvariableC{%
This is school-variable C with Mystic Falls University.
}%
\makeatother
\begin{document}
\tableofcontents
\section{A section of the general part}
This is a section of the general part.
Now let's within the general part use the school-specific-variables:
\begin{itemize}
\item \verb|\schoolvariableA| is: \schoolvariableA
\item \verb|\schoolvariableB| is: \schoolvariableB
\item \verb|\schoolvariableC| is: \schoolvariableC
\end{itemize}
\section{Another section of the general part}
This is another section of the general part.
Now let's come to the school-specific text-part:
\section{A section about Mystic Falls University}
Mystic Falls University is a funny school.
Mystic Falls University is a funny school.
Mystic Falls University is a funny school.
Mystic Falls University is a funny school.
Mystic Falls University is a funny school.
Mystic Falls University is a funny school.
Mystic Falls University is a funny school.
That's the end of the school-specific part with Mystic Falls University.
\end{document}
d) EmpireStateUniversity.tex
\documentclass{article}
\makeatletter
\newcommand\schoolvariableA{%
This is school-variable A with Empire State University.
}%
\newcommand\schoolvariableB{%
This is school-variable B with Empire State University.
}%
\newcommand\schoolvariableC{%
This is school-variable C with Empire State University.
}%
\makeatother
\begin{document}
\tableofcontents
\section{A section of the general part}
This is a section of the general part.
Now let's within the general part use the school-specific-variables:
\begin{itemize}
\item \verb|\schoolvariableA| is: \schoolvariableA
\item \verb|\schoolvariableB| is: \schoolvariableB
\item \verb|\schoolvariableC| is: \schoolvariableC
\end{itemize}
\section{Another section of the general part}
This is another section of the general part.
Now let's come to the school-specific text-part:
\section{A section about Empire State University}
Empire State University is an exciting school.
Empire State University is an exciting school.
Empire State University is an exciting school.
Empire State University is an exciting school.
Empire State University is an exciting school.
Empire State University is an exciting school.
Empire State University is an exciting school.
That's the end of the school-specific part with Empire State University.
\end{document}
school1.tex
the complete input file for the school 1 statement, and\input common.tex
at the appropriate place (e.g. after\begin{document}
. Of courseschool2.tex
will probably have the same structure asschool1.tex
so you can just copyschool1.tex
and edit it.\documentclass{…}
\input mystuff.tex
\begin{document}
. Or you could make your own.sty
file which starts with\LoadClass[…]{…}
for the original document class, and then includes your customizations.