How to add extra packages and commands.

The Ximera documentclass comes with many packages preloaded: amsmath, amssymb, amsthm, comment, environ, enumitem, epstopdf, fancyvrb, forloop, gettitlestring, hyperref, listings, multido, nameref, pgfplots, tikz, titlesec, titletoc, titling, url, xcolor, xifthen, xkeyval.

The documentclass also provides support for the following theorem-like environments: algorithm, axiom, claim, conclusion, condition, conjecture, corollary, criterion, definition, example, explanation, exercise, exploration, fact, formula, hypothesis, idea, lemma, model, notation, observation, paradox, proof, problem, procedure, proposition, question, remark, solution, summary, template, theorem, warning.

We can add functionality and generality, via user defined commands, to the document via a preamble, or macros, document. Currently, we have a special file called xmPreamble.tex that we strongly suggest new users use. The purpose of xmPreamble is to ensure all files compile consistently, it is not for cosmetic changes. A typical preamble might contain things like:

\newcommand{\R}{\mathbb{R}}
\newcommand{\d}{\, d}

The special file xmPreamble.tex is a preamble (macros file) that is automatically loaded by every ximera and xourse file. Since every *.tex file with a ximera and xourse must compile, the preamble file must be accessible by all files. The special file xmPreamble.tex is found by all files that are at most three directories deep. In essence, we are modifying the input path as follows:

\makeatletter      %% make "@" a letter-character
\def\input@path{   %% When looking for xmPreamble.tex,
{./}               %% look here first,
{../}              %% then look a folder up,
{../../}           %% then look two folders up,
{../../../}        %% then look three folders up.
}
\makeatother       %% make "@" an other-character.

and we are automatically loading any file it finds that is named xmPreamble.tex.

The special folder xmPictures/ helps ximera and \xourse files find images. We used \includegraphics in basicWorkSheet.tex with code like:

\begin{center}
  \includegraphics[width=5cm]{missionPatch.jpg}
\end{center}

In this case, aFirstActivity.tex and missionPatch.jpg are both in the folder basics. However, when this document is compiled via a xourse document, the LaTeX compiler looks for the image at the level of the aFirstStepInXimera.tex.

Since there is no file missionPatch.jpg at the level of the xourse document the compilation will fail unless the files know where to look. To solve this problem we use the document class to append the graphics path. Essentially we set:

  \graphicspath{          %% When looking for images,
  {./}                    %% look here first,
  {.\xmPictures}          %% then look in \xmPictures,
  {..\xmPictures}         %% then look a folder up,
  {../..\xmPictures}      %% then look two folders up,
  {../../..\xmPictures}   %% then look three folders up.
  }
  

With this code, Ximera files can find images.

Input paths allow you to load other documents into your files. This is a less common use case for power-users, but we’ll mention it here. You can surely avoid the use of such files with an enhanced preamble. However, for this document, we needed to input various TikZ files to help us draw our diagrams. Hence we needed to add the location of these files to our input path. We did this in our xmPreamble.tex the following way:

%% Where to look for inputs
\makeatletter     %% make "@" a letter-character
\def\input@path{  %% When looking for files,
{./}              %% look first at your level
{./xmPictures/}   %% then in this folder,
}
\makeatother      %% make "@" an other-character.

With this said, modifying input paths is an advanced feature for experienced users.