2

Hi there having another problem. In the following Minimal Example a listing with captionof doesnt show the Listings Number in the Caption :(

\documentclass[
  11pt, % Schriftgröße
  DIV10,
  ngerman, % für Umlaute, Silbentrennung etc.
  a4paper, % Papierformat
  oneside, % einseitiges Dokument
  titlepage, % es wird eine Titelseite verwendet
  parskip=half, % Abstand zwischen Absätzen (halbe Zeile)
  headings=normal, % Größe der Überschriften verkleinern
  listof=totoc, % Verzeichnisse im Inhaltsverzeichnis aufführen
  bibliography=totoc, % Literaturverzeichnis im Inhaltsverzeichnis aufführen
  index=totoc, % Index im Inhaltsverzeichnis aufführen
  captions=tableheading, % Beschriftung von Tabellen unterhalb ausgeben
  %draft % Status des Dokuments (final/draft)
  final % Status des Dokuments (final/draft)
]{scrreprt}

\usepackage{listings}
\usepackage{xcolor} 
\definecolor{bluegray}{RGB}{235,235,250}
\definecolor{colKeys}{rgb}{0,0,1}
\definecolor{colIdentifier}{rgb}{0,0,0}
\definecolor{colComments}{RGB}{108,226,108}
\definecolor{colString}{rgb}{0,0.5,0}
\definecolor{navy}{RGB}{0,0,128}
\lstset{
  float=hbp,
  basicstyle=\color{black},
  identifierstyle=\color{colIdentifier},
  keywordstyle=\color{colKeys},
  stringstyle=\color{colString},
  commentstyle=\color{colComments},
  columns=flexible,
  tabsize=2,
  frame=single,
  extendedchars=true,
  showspaces=false,
  showstringspaces=false,
  numbers=left,
  numberstyle=\small,
  breaklines=true,
  backgroundcolor=\color{bluegray},
  breakautoindent=true
}


\usepackage[labelfont=bf,font=footnotesize]{caption}
\captionsetup{format=plain} 

\usepackage{capt-of}


\lstset{numbers=left, numberstyle=\tiny, numbersep=5pt, breaklines=true}
\lstset{emph={square}, emphstyle=\color{red}, emph={[2]root,base}, emphstyle={[2]\color{blue}}}

\begin{document}

\begin{minipage}{\textwidth}
  \begin{center}
    \captionof{lstlisting}[ListingsCaption]{ListingsCaption CITE}
    \begin{lstlisting}[language=Xml,label=lst:ListingsLabel]
      <style name="MyStyle">
        <color>#b0b0ff</color>
      </style>
    \end{lstlisting}
  \end{center}
\end{minipage}

\end{document}

result

Any idea what went wrong?

*File List*
scrreprt.cls 2011/04/02 v3.09 KOMA-Script document class (report)
scrkbase.sty 2011/04/02 v3.09 KOMA-Script package (KOMA-Script-dependent bas
ics and keyval usage)
scrbase.sty 2011/04/02 v3.09 KOMA-Script package (KOMA-Script-independent b
asics and keyval usage)
keyval.sty 1999/03/16 v1.13 key=value parser (DPC)
scrlfile.sty 2011/03/09 v3.09 KOMA-Script package (loading files)
tocbasic.sty 2011/03/23 v3.09 KOMA-Script package (handling toc-files)
scrsize11pt.clo 2011/04/02 v3.09 KOMA-Script font size class option (11pt)
typearea.sty 2011/04/02 v3.09 KOMA-Script package (type area)
listings.sty 2007/02/22 1.4 (Carsten Heinz)
lstmisc.sty 2007/02/22 1.4 (Carsten Heinz)
listings.cfg 2007/02/22 1.4 listings configuration
xcolor.sty 2007/01/21 v2.11 LaTeX color extensions (UK)
color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX
infwarerr.sty 2010/04/08 v1.3 Providing info/warning/message (HO)
ltxcmds.sty 2011/04/18 v1.20 LaTeX kernel commands for general use (HO)
caption.sty 2010/01/09 v3.1m Customizing captions (AR)
caption3.sty 2010/01/14 v3.1m caption3 kernel (AR)
capt-of.sty 2009/12/29 v0.2 standard captions outside of floats
supp-pdf.mkii
lstlang1.sty 2004/09/05 1.3 listings language file
lstmisc.sty 2007/02/22 1.4 (Carsten Heinz)
omlcmr.fd 1999/05/25 v2.5h Standard LaTeX font definitions
***********

1 Answer 1

3

In relation to your edit (added a file list):

As you can see my packages are newer. So make an update of your distribution.

Originial

Your examples works fine if I remove the command \smaller. With this setting I get the following output:

enter image description here

If you want to use the command \smaller you have to load the package relsize. However your combination of \small\smaller makes no sense.

Here's my file list:

 *File List*
scrreprt.cls    2012/03/08 v3.10a KOMA-Script document class (report)
scrkbase.sty    2012/03/08 v3.10a KOMA-Script package (KOMA-Script-dependent ba
sics and keyval usage)
 scrbase.sty    2012/03/08 v3.10a KOMA-Script package (KOMA-Script-independent 
basics and keyval usage)
  keyval.sty    1999/03/16 v1.13 key=value parser (DPC)
scrlfile.sty    2011/03/09 v3.09 KOMA-Script package (loading files)
tocbasic.sty    2011/05/30 v3.09a KOMA-Script package (handling toc-files)
scrsize11pt.clo    2012/03/08 v3.10a KOMA-Script font size class option (11pt)
typearea.sty    2012/03/08 v3.10a KOMA-Script package (type area)
listings.sty    2007/02/22 1.4 (Carsten Heinz)
 lstmisc.sty    2007/02/22 1.4 (Carsten Heinz)
listings.cfg    2007/02/22 1.4 listings configuration
  xcolor.sty    2007/01/21 v2.11 LaTeX color extensions (UK)
   color.cfg    2007/01/18 v1.5 color configuration of teTeX/TeXLive
  pdftex.def    2011/05/27 v0.06d Graphics/color for pdfTeX
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/message (HO)
 ltxcmds.sty    2011/04/18 v1.20 LaTeX kernel commands for general use (HO)
 caption.sty    2012/02/19 v3.2f Customizing captions (AR)
caption3.sty    2012/01/12 v1.4b caption3 kernel (AR)
 capt-of.sty    2009/12/29 v0.2 standard captions outside of floats
supp-pdf.mkii
lstlang1.sty    2004/09/05 1.3 listings language file
 lstmisc.sty    2007/02/22 1.4 (Carsten Heinz)

PS: your example isn't minimal

13
  • Why do you say "I know it's a comment"? The problem was in fact the \smaller command, so your suggestion solves the issue. Commented Apr 18, 2012 at 21:21
  • But the OP is not loading relsize, so \smaller will produce an error. Commented Apr 18, 2012 at 21:25
  • Not for me :( Removed the smaller but didnt worked either. I updated the initial post with my changes and made a picture Commented Apr 18, 2012 at 21:27
  • still not working. Filelist update in initial post Commented Apr 18, 2012 at 23:24
  • @kitingChris: are you sure that you get the image using the exact same code that appears in your question? Commented Apr 19, 2012 at 1:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .