Adjust reference exercise

This commit is contained in:
Knoch 2023-04-28 16:57:04 +02:00
parent 8ea59e8656
commit 8f9ef296fd
2 changed files with 6 additions and 9 deletions

View File

@ -9,9 +9,5 @@ C\# is an object-oriented programming language that was developed by Microsoft i
\cref{lst:csharphelloworld} shows a program that prints the text \enquote{Hello LaTeX friends!} to the console. Like Java, C\# makes use of classes and main methods to build executable applications.
\begin{listing}[H]
\caption{A simple C\# program}
\label{lst:csharphelloworld}
\lstset{language=csharp}
\lstinputlisting{exercises/references/HelloLateXFriends.cs}
\end{listing}
\lstset{language=csharp}
\lstinputlisting[label=lst:csharphelloworld, caption=Hello World in C\#]{exercises/references/HelloLateXFriends.cs}

View File

@ -4,7 +4,8 @@
In file \file{exercises/references/references.tex}, replace \enquote{in the
figure} and \enquote{the following source code listing} with suited references.
Use the command \code{latex}{\textbackslash cref}. Do not forget to first
introduce labels for the elements that you want to reference. To do so, first
of all, wrap the source code listing in a \code{latex}{listing} environment.
Also, insert a caption for the source code listing.
introduce labels for the elements that you want to reference.
Make sure to use suitable prefixes before the labels.
For source code listings, adding labels and captions is a bit different.
Try to apply the knowledge you gained so far to retrieve the correct version of the \code{\lstinputlisting} command.