45 lines
2.3 KiB
TeX

\begin{enumerate}
\item
\textbf{Put the sections of the file into separate files, named
\texttt{section1.tex}, \texttt{section2.tex}, and
\texttt{section3.tex}.
Include them using the \mintinline{latex}{\include} command.}
\begin{figure}[H]
\inputminted[linenos=true]{latex}{exercises/project-structure/main-with-preamble.done.tex}
\caption{\mintinline{latex}{main.tex}}
\end{figure}
\begin{figure}[H]
\inputminted[linenos=true,breaklines=true]{latex}{exercises/project-structure/section1.done.tex}
\caption{\mintinline{latex}{section1.tex} (analogous for the other
sections)}
\end{figure}
\item \textbf{Which command becomes superfluous when you use
\mintinline{latex}{\include}?} \\
\mintinline{latex}{\include} makes every included file appear on a new
page. Hence the command \mintinline{latex}{\newpage} becomes superfluous.
\item
\textbf{Can the preamble also be excluded? If no, why? If yes, why can
outsourcing the preamble be useful?} \\
The preamble can also be outsourced, like in task 1. In real-world \LaTeX{}
projects we often make use of numerous packages that need to be configured
by additional commands within the preamble. Therefore, it is advisable to
outsource the preamble. On top of that, this is useful because the file can
with the most-commonly used packages can be moved from one project to
another without needing to rewrite the preamble every time.
\item
\textbf{Add the command \mintinline{latex}{\includeonly{section2}} to the
preamble. Compile the document again, and check what has changed. What does
the command do and why can it be helpful in a larger project? } \\
The command \mintinline{latex}{\includeonly{section2}} doex exactly what
the name already says. During compilation, only the
\mintinline{latex}{\include}
statements that contain file names that appear in
\mintinline{latex}{includeonly{file1,file2, …}} are included.
This can be useful for larger projects, when the compile time becomes
longer since by using the \mintinline{latex}{\includeonly} only the files
can be included which we are currently working in. Before the final
compilation we can delete the \mintinline{latex}{\includeonly} command and
end up with our complete \acro{PDF}.
\end{enumerate}