How to include SOURCE CODE in documents
A program called "lgrind" is available to help you convert program listings to a form easily includable in a LaTeX document. To use this program, type the following:
$ add newtex
$ lgrind -i -llanguage filename > filename.tex
This will generate a file (filename.tex) of code formatted for inclusion in a LaTeX file. For example, to format a C program called mycode.c:
$ lgrind -i -lc mycode.c > mycode.tex
To include the encoded file in your document:
Include a line in your document preamble:
\usepackage{lgrind}
or, if you want the code to include function labels on the right hand side,
\usepackage[procnames,noindent]{lgrind}
Place the lines
\begin{lgrind}
\input mycode.tex
\end{lgrind}
in your .tex file where you want to insert the formatted code.
Subscribe to:
Post Comments (Atom)
Manage Hotspot on Windows 7
Managing Hosted Network (Hotspot) on a Laptop running Windows 7 1. Setup Hosted Network netsh wlan show drivers netsh wlan set hostedn...
-
Capability Curve is a plot of reactive power ( Q ) versus real power ( P ). Construction used for the derivation of a synchronous generator...
-
Open-circuit characteristic ( OCC ), also referred to as the open-circuit saturation curve, of a synchronous machine is a curve of the open-...
-
96FG-2A,2B,2C are the TMR pressure transducers for measuring fuel gas interstage (P2) pressure in Gas machines. If they are Dynisco PT303 ...
No comments:
Post a Comment