Adjust reference exercise
This commit is contained in:
parent
8ea59e8656
commit
8f9ef296fd
@ -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.
|
\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]
|
\lstset{language=csharp}
|
||||||
\caption{A simple C\# program}
|
\lstinputlisting[label=lst:csharphelloworld, caption=Hello World in C\#]{exercises/references/HelloLateXFriends.cs}
|
||||||
\label{lst:csharphelloworld}
|
|
||||||
\lstset{language=csharp}
|
|
||||||
\lstinputlisting{exercises/references/HelloLateXFriends.cs}
|
|
||||||
\end{listing}
|
|
||||||
@ -4,7 +4,8 @@
|
|||||||
In file \file{exercises/references/references.tex}, replace \enquote{in the
|
In file \file{exercises/references/references.tex}, replace \enquote{in the
|
||||||
figure} and \enquote{the following source code listing} with suited references.
|
figure} and \enquote{the following source code listing} with suited references.
|
||||||
Use the command \code{latex}{\textbackslash cref}. Do not forget to first
|
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
|
introduce labels for the elements that you want to reference.
|
||||||
of all, wrap the source code listing in a \code{latex}{listing} environment.
|
|
||||||
Also, insert a caption for the source code listing.
|
|
||||||
Make sure to use suitable prefixes before the labels.
|
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.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user