General ⇒ Referring line in listing
Referring line in listing
"In listing 1.2.3:10 we see this and that..." (i.e., line 10).
And also line range, like "listing 1.2.3:10-14".
I just hate idea to write "... at line x ...", or "... at lines from x to y ...", etc.
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
-
- Posts: 707
- Joined: Tue Mar 25, 2008 5:02 pm
Referring line in listing
Their example has something like this (for Pascal, which uses (* and *) as "digraph" comments):
Code: Select all
\lstset{escapeinside={(*@}{@*)}}
\begin{lstlisting}
for i:=maxint to 0 do
begin
{ my comment }(*@\label{comment}@*)
end;
\end{lstlisting}
Line \ref{comment} shows a comment.
\lstset{escapeinside={/*@}{*/}}
or something like
\lstset{escapeinside={#%}{\^^M}}
for shell scripts.