Problems with listings
Im trying to "decorate" source code with listings, but im having some
warnings and bad boxes in mi document. However the document compiles and
looks like i want.
I noticed the warning is because the "}" and "{" simbols in the code.
Overfull \hbox (6.0pt too wide) in paragraph at lines 31--31
[][][][][][][] []
LaTeX Font Info: Try loading font information for OMS+cmss on input line 32.
LaTeX Font Info: No file OMScmss.fd. on input line 32.
LaTeX Font Warning: Font shape OMS/cmss/m/n' undefined (Font)
usingOMS/cmsy/m/n' instead (Font) for symbol `textbraceleft' on input line
32.
\documentclass[a4paper]{article}
\usepackage[spanish,activeacute]{babel}
\usepackage{amsmath}
\usepackage{listings}
\usepackage{color}
\usepackage{xcolor}
\usepackage{caption}
\lstset{
basicstyle=\footnotesize,
numbers=left,
numberstyle=\tiny,
frame=tb,
columns=fullflexible,
showstringspaces=false
}
\renewcommand{\familydefault}{\sfdefault} %this is because default font
looks blurry
\DeclareCaptionFont{white}{\color{white}}
\DeclareCaptionFormat{listing}{\colorbox{black}{\parbox{\textwidth}{#1#2#3}}}
\captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white}
\begin{document}
Some Code:
\begin{lstlisting}[caption=some code, label=source, language=java]
public void hello() {
aaaa();
}
\end{lstlisting}
\end{document}
No comments:
Post a Comment