36 lines
1.5 KiB
TeX
36 lines
1.5 KiB
TeX
\section{Listings}
|
|
|
|
In the folder \file{exercises/source-code-listings}, you will find a file called \file{Source.java}.
|
|
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. (Hint: The documentation speaks of \code{latex}{autogobble}.)
|
|
\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 Don't show special characters for spaces in strings.
|
|
\end{enumerate}
|
|
|
|
% Reset experiments from exercise material if minted is used
|
|
\ifthenelse{\equal{\listingsmode}{minted}}{%
|
|
\usemintedstyle{default}
|
|
}{}
|