From 8f9ef296fdab20f54f0bfc406d45cb4572478f8c Mon Sep 17 00:00:00 2001 From: Florian Knoch Date: Fri, 28 Apr 2023 16:57:04 +0200 Subject: [PATCH] Adjust reference exercise --- exercises/references/references.code.done.tex | 8 ++------ exercises/references/task.tex | 7 ++++--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/exercises/references/references.code.done.tex b/exercises/references/references.code.done.tex index fac75bb..e3aa3b9 100644 --- a/exercises/references/references.code.done.tex +++ b/exercises/references/references.code.done.tex @@ -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} \ No newline at end of file +\lstset{language=csharp} +\lstinputlisting[label=lst:csharphelloworld, caption=Hello World in C\#]{exercises/references/HelloLateXFriends.cs} \ No newline at end of file diff --git a/exercises/references/task.tex b/exercises/references/task.tex index 27f30ae..c1bb53e 100644 --- a/exercises/references/task.tex +++ b/exercises/references/task.tex @@ -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.