🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #920

Help: How to refer to local line numbering in LaTeX?

#920
From: Schenkelaars.V.F
Date: Thu, 06 Aug 1992 07:42
57 lines
2063 bytes
Hello (La)TeX'ers

I`ve got a nice problem (I guess). In my master's thesis I`ve some
pieces of C-code. I want to number the lines so I can refer to
them in the text. Question 1: How can I automaticly number these
lines, and these lines only. I have a couple of parts which
sould be numbered in sequence. So:

%code part one
\begin{verbatim}
1. main() {
2.   printf("Hellow World\n");
3. }
\end{verbatim}

%some text

%code part two

\begin{verbatim}
4. dummy() {
5.    printf("This is a dummy\n");
6. }
\end{verbatim}

I want to be able to insert some new lines without losing the
numbering order.

Question 2: Now I want to explain something about the code in my
text. How can I refer to these line numbers. for example

The string ``Hello world'' is printed in line 2.

Could someone answer these questions? 

Regards,

     ____________________
 \  / . _   _  _   _  |
  \/ ( ( \ (_ (-' ( \ |

--------------------------------------------------------------------------------
Vincent F. Schenkelaars				|
Company: FEL-TNO                                | Private:
Email  : V.F.Schenkelaars@tnofel.fel.tno.nl	|
address: Oude Waalsdorperweg 63			| Groenhovenstraat 12
         Postbus 96864				|
         2509 JG  Den Haag			| 2311 BT  Leiden
         The Netherlands			| The Netherlands
Phone  : Holland 070-3264221			| Holland 071-125576
Fax    : Holland 070-3280961			|
--------------------------------------------------------------------------------
We apologize for the inconvenience.
-- 
     ____________________
 \  / . _   _  _   _  |
  \/ ( ( \ (_ (-' ( \ |
Technical Details
Message-ID: <1992Aug6.074229.16551@fel.tno.nl>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sun4nl!tnofel!vfsj3

Show Full Headers
Complete Article Headers
Newsgroups: comp.text.tex
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sun4nl!tnofel!vfsj3
From: vfsj3@fel.tno.nl (Schenkelaars.V.F)
Subject: Help: How to refer to local line numbering in LaTeX?
Message-ID: <1992Aug6.074229.16551@fel.tno.nl>
Summary: How can I refer to lines in some local line numbering part?
Keywords: line numbering, reference
Organization: TNO Physics and Electronics Laboratory
Date: Thu, 6 Aug 1992 07:42:29 GMT
Lines: 58