Is there a way to change style of a caption in listings without the caption
package (make it smaller and non-bold)? I am using \lstnewenvironment
to create my own customized environment and then use listings via this new environment.
I tried to do it with the caption
package with \captionsetup[lstlisting]{font={scriptsize,tt}}
and it worked, but the problem is that I cannot use caption
package as it messes up captions in the rest of the document (as soon as I "include" it), and I have to use predefined class.
Thank you for your help!
(EDIT) Class: http://www.acm.org/sigs/publications/sig-alternate.cls
(EDIT) MEW:
\documentclass{sig-alternate}
%\usepackage{caption}
\usepackage{listings}
\begin{document}
\title{The Title}
\numberofauthors{1}
\author{
\alignauthor
John Doe\\
\affaddr{Lorem ispum}\\
\affaddr{Lorem ispum}\\
\affaddr{Lorem ipsum}\\
\email{[email protected]}
}
\date{30 July 1999}
\maketitle
\lstnewenvironment{mycode}[1][]
{
\minipage[b]{0.3\textwidth}
\lstset{
captionpos=b,
language=C,
numbers=left,
basicstyle=\tiny\ttfamily,
columns=fullflexible,
showstringspaces=false,
numbersep=3pt,
#1
}
}
{
\endminipage
}
%\captionsetup[lstlisting]{font={small,tt}}
\begin{mycode}[title=Awesome C program,label=code:AwesomeC]
int main(int argc, char* argv[]) {
return 0;
}
\end{mycode}
If I use "caption" package, caption of the figure changes style (it is no longer bold). Otherwise I cannot change caption of the code...
\begin{figure}
\centering
This is a figure
\caption{Caption of the figure}
\end{figure}
\end{document}
listings
settings for starts.caption
package can replicate it. Did you try loadingcaption
with the[style=base]
option?\@makecaption
. Since thelistings
package is using this macro to typeset the caption, too, yourlistings
caption should follow this design automatically -- otherwise there is something wrong with your document class.