captionof{lstlisting} 标题中未显示列表编号

captionof{lstlisting} 标题中未显示列表编号

大家好,又遇到了一个问题。在下面这个最小示例中,带有 captionof 的列表没有在标题中显示列表编号 :(

\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}

结果

知道哪里出了问题吗?

*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

关于您的编辑(添加了文件列表):

如您所见,我的软件包较新。因此请更新您的发行版。

原创

如果我删除命令,您的示例将正常工作\smaller。使用此设置,我得到以下输出:

在此处输入图片描述

如果要使用命令,\smaller则必须加载包relsize。但是您的组合\small\smaller毫无意义。

这是我的文件列表:

 *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:你的例子并不简单

相关内容