Monday, October 03, 2011
To allow code Listing in Latex, follow this block of code , like a professional books
\documentclass{unlthesis}
\usepackage{color}
\usepackage{xcolor}
\usepackage{listings}
\usepackage{caption}
\DeclareCaptionFont{white}{\color{white}}
\DeclareCaptionFormat{listing}{\colorbox{gray}{\parbox{\textwidth}{#1#2#3}}}
\captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white}
\begin{document}
\begin{lstlisting}[language=java,
caption=XYZ.java, label=code:XYZ_Code, frame=b,
breaklines=true, showstringspaces=false,
basicstyle=\footnotesize]
class Doing
{
public static void main(string [] args)
{
int x = 0 ;
}
}
\end{lstlisting}
\end{document}
Subscribe to:
Post Comments
(
Atom
)
0 comments :
Post a Comment