38 lines
1.5 KiB
TeX
38 lines
1.5 KiB
TeX
You will find a file called \file{Source.java} in the folder
|
|
\file{exercises/source-code-listings}.
|
|
We will now include it into our document and adjust its display to fit our needs.
|
|
If you have questions, consult the \pkg{minted} or \pkg{listings} package documentation.
|
|
|
|
\section*{Minted tasks}
|
|
|
|
\begin{enumerate}
|
|
\item Include the file into
|
|
\file{exercises/source-code-listings/source-code-listings.tex}.
|
|
\item Activate syntax highlighting by stating the programming language Java.
|
|
\item Add line breaks and line numbers.
|
|
\item Use the theme \code{latex}{native}.
|
|
\item This theme is optimized for a dark background. Change the background color to dark blue.
|
|
\item Include only lines 5 to 7.
|
|
\item Delete the spaces at the beginning of the lines by using a suitable
|
|
option. (Hint: The documentation speaks of \code{latex}{gobble}.)
|
|
\end{enumerate}
|
|
|
|
\section*{Listings tasks}
|
|
|
|
\begin{enumerate}
|
|
\item Include the file into
|
|
\file{exercises/source-code-listings/source-code-listings.tex}.
|
|
\item Activate syntax highlighting by stating the programming language Java.
|
|
\item Set the \mono{basicstyle} to a proper mono-spaced font (\mono{\textbackslash ttfamily \textbackslash small})
|
|
\item Add line numbers.
|
|
\item Change the keyword color to blue.
|
|
\item Include only lines 5 to 7.
|
|
\end{enumerate}
|
|
|
|
\exercisematerial{exercises/source-code-listings/source-code-listings}
|
|
|
|
% Reset experiments from exercise material if minted is used
|
|
\ifthenelse{\equal{\listingsmode}{minted}}{%
|
|
\usemintedstyle{}
|
|
}{}
|