Download PUT YOUR THESIS TITLE HERE

Transcript
10.2. LISTINGS
49
\lstinputlisting[float=h,firstline=10,lastline=11,language=Java,
caption=Partial Java Listing.,
label=lst:SOMEJAVA]{./examples/example.java}
\end{centering}
and would produce Listing 10.2.
Listing 10.2: Partial Java Listing.
1
2
public c l a s s MathTester
The listings package is capable to working with a large number of languages; you can
find the documentation at: http://www.ctan.org/tex-archive/macros/latex/contrib/
listings/listings-1.3.pdf.
For example, to typeset an XML file using a “footnote-sized” font we would use the
code:
\begin{centering}
\lstinputlisting[float=h,basicstyle=\footnotesize,language=XML,
caption=Example XML File.,
label=lst:XML]{./examples/simple_example_xml.xml}
\end{centering}
which would produce Listing 10.3.
Listing 10.3: Example XML File.
1 <?xml version=” 1 . 0 ” e n c o d i n g=”UTF−8” standalone=” y e s ” ?>
2 < f i r s t>
3
<s e c o n d>
4
<z>Simple c o n t e n t</ z>
5
<e a t t r i b=” 1 ” />
6
</ s e c o n d>
7
<t h i r d>
8
<e a t t r i b=” 2 ” />
9
</ t h i r d>
10 </ f i r s t>