标题中的图表编号以句号和分号结尾

标题中的图表编号以句号和分号结尾

我需要帮助重新定义表格和图片标题。目前表格和图片编号都以句号和冒号结尾。例如,

\caption{Foo bar}

生成文本,

Table 1.: Foo bar

代替

Table 1. Foo bar

甚至

Table 1: Foo bar

或者甚至

Table 1 Foo bar

我想控制附加到图表和表格编号的标点符号。

顺便说一句,我尝试重新定义\figurename如下\tablename,但没有成功。

\renewcommand{\figurename}{Figure}
\renewcommand{\tablename}{Table}}

如果重要的话,我会使用该classicthesis包。

编辑:重新定义\thefigure如下也无济于事。句号和分号仍然存在

\renewcommand{\thefigure}{\thechapter.\arabic{figure}}

梅威瑟:

\documentclass[10pt,a4paper,twoside,open=right,headinclude,footinclude]{scrreprt}
\usepackage{classicthesis-ldpkg}
\usepackage[]{natbib}
\usepackage[eulerchapternumbers,eulermath,subfig]{classicthesis}
\usepackage{datetime}
\usepackage{bm}
\usepackage{cancel}
\usepackage{caption}
\usepackage{subfig}
\usepackage{rotating}
\usepackage{multirow}
\usepackage[ruled,vlined,linesnumbered]{algorithm2e}

%\captionsetup{labelsep=none}

\begin{document}

\chapter{One}

\begin{table}[htbf]
 \centering
    \setlength\extrarowheight{4pt}
    \begin{tabular}{|>{\centering}p{35mm}|>{\centering}p{35mm}|p{35mm}<{\centering}|} \hline
        Foo          &   Bar        &   Bar Foo                    \\
        For         &   Bar              &   Bar Foo                          \\ \hline
    \end{tabular}
\caption{stuff} \label{www}
\end{table}

\appendix
\chapter{Appendix} Hello % THIS IS THE CULPRIT!!! (No appendix, no extra period)

\end{document} 

答案1

重现该问题的 MWE 可以简化为:

\documentclass{scrreprt}
\usepackage{classicthesis}

\begin{document}

\begin{table}
 \caption{test}
\end{table}

\appendix
\chapter{Appendix} Hello

\end{document}

这会产生如下所示的不良行为:

在此处输入图片描述

\listfiles该问题出现在我的 TeX Live2011 系统中;这是添加到我的 MWE 后获得的文件列表:

 *File List*
scrreprt.cls    2011/06/16 v3.09a KOMA-Script document class (report)
scrkbase.sty    2011/06/16 v3.09a KOMA-Script package (KOMA-Script-dependent ba
sics and keyval usage)
 scrbase.sty    2011/06/16 v3.09a 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    2011/06/16 v3.09a KOMA-Script font size class option (11pt)
typearea.sty    2011/06/16 v3.09a KOMA-Script package (type area)
classicthesis.sty    2011/06/05 v3.0 Typographic Style for a classic-looking th
esis
  ifthen.sty    2001/05/26 v1.1c Standard LaTeX ifthen package (DPC)
   ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
hyperref.sty    2011/08/19 v6.82h Hypertext links for LaTeX
hobsub-hyperref.sty    2011/04/23 v1.4 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty    2011/04/23 v1.4 Bundle oberdiek, subset generic (HO)
  hobsub.sty    2011/04/23 v1.4 Subsetting bundle oberdiek (HO)
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)
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
  ifvtex.sty    2010/03/01 v1.5 Switches for detecting VTeX and its modes (HO)
 intcalc.sty    2007/09/27 v1.1 Expandable integer calculations (HO)
etexcmds.sty    2011/02/16 v1.5 Prefix for e-TeX command names (HO)
kvsetkeys.sty    2011/04/07 v1.13 Key value parser (HO)
kvdefinekeys.sty    2011/04/07 v1.3 Defining keys (HO)
pdftexcmds.sty    2011/04/22 v0.16 Utilities of pdfTeX for LuaTeX (HO)
pdfescape.sty    2011/04/04 v1.12 Provides string conversions (HO)
bigintcalc.sty    2011/01/30 v1.2 Expandable big integer calculations (HO)
  bitset.sty    2011/01/30 v1.1 Data type bit set (HO)
uniquecounter.sty    2011/01/30 v1.2 Provides unlimited unique counter (HO)
letltxmacro.sty    2010/09/02 v1.4 Let assignment for LaTeX macros (HO)
 hopatch.sty    2011/01/30 v1.0 Wrapper for package hooks (HO)
xcolor-patch.sty    2011/01/30 xcolor patch
atveryend.sty    2011/04/23 v1.7 Hooks at very end of document (HO)
atbegshi.sty    2011/01/30 v1.15 At begin shipout hook (HO)
refcount.sty    2010/12/01 v3.2 Data extraction from references (HO)
 hycolor.sty    2011/01/30 v1.7 Color options of hyperref/bookmark (HO)
 ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional
kvoptions.sty    2010/12/23 v3.10 Keyval support for LaTeX options (HO)
  pd1enc.def    2011/08/19 v6.82h Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg    2002/06/06 v1.2 hyperref configuration of TeXLive
     url.sty    2006/04/12  ver 3.3  Verb mode for urls, etc.
 hpdftex.def    2011/08/19 v6.82h Hyperref driver for pdfTeX
rerunfilecheck.sty    2011/04/15 v1.7 Rerun checks for auxiliary files (HO)
  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
dvipsnam.def    1999/02/16 v3.0i Driver-dependant file (DPC,SPQR)
mathpazo.sty    2005/04/12 PSNFSS-v9.2a Palatino w/ Pazo Math (D.Puga, WaS) 
microtype.sty    2010/01/10 v2.4 Micro-typography with pdfTeX (RS)
microtype.cfg    2010/01/10 v2.4 microtype main configuration file (RS)
booktabs.sty    2005/04/14 v1.61803 publication quality tables
textcase.sty    2004/10/07 v0.07 Text only upper/lower case changing (DPC)
    soul.sty    2003/11/17 v2.4 letterspacing/underlining (mf)
scrpage2.sty    2010/04/22 v2.5 LaTeX2e KOMA-Script package
titlesec.sty    2011/08/28 v2.9.1 Sectioning titles
 tocloft.sty    2010/10/13 v2.3e parameterised ToC, etc., typesetting
 scrtime.sty    2011/06/16 v3.09a KOMA-Script package (time of LaTeX run)
remreset.sty    
 ot1pplj.fd    2004/09/06 font definitions for OT1/pplj.
 nameref.sty    2010/04/30 v2.40 Cross-referencing by name of section
gettitlestring.sty    2010/12/03 v1.4 Cleanup title references (HO)
       a.out
       a.out
supp-pdf.mkii
  mt-ppl.cfg    2005/11/16 v1.6 microtype config. file: Palatino (RS)
 ***********

这个问题可以通过两种方式解决:

1) 使用KOMA 类的选项(这将抑制来自 MWE 的虚假额外周期),然后使用包中的numbers=noenddot选项更改字幕的标签分隔符:\captionsetupcaption

\documentclass[numbers=noenddot]{scrreprt}
\usepackage{classicthesis}
\usepackage{caption}
\captionsetup{labelsep=period}


\begin{document}

\begin{table}
 \caption{test}
\end{table}

\appendix
\chapter{Appendix} Hello

\end{document}

2)重新定义\tableformat(和\figureformat)以默认抑制插入(再次,使用包中\autodot的标签分隔符进行了更改):\captionsetupcaption

\documentclass{scrreprt}
\usepackage{classicthesis}
\usepackage{caption}
\captionsetup{labelsep=period}

\renewcommand*{\figureformat}{\figurename~\thefigure}
\renewcommand*{\tableformat}{\tablename~\thetable}

\begin{document}

\begin{table}
 \caption{test}
\end{table}

\appendix
\chapter{Appendix} Hello

\end{document}

答案2

根据classicthesis样式的默认定义,应该有一个冒号( :) 图表编号后,但不包括( .) 也是如此。除了加载之外classicthesis,还加载了哪些其他软件包可能会影响图表和表格标题的外观?

一般来说,更改标题中表格/图号后面标点符号样式的最简单方法之一是加载样式caption。在\usepackage{caption}指令后,插入命令

\captionsetup{labelsep = colon}

或者

\captionsetup{labelsep = period}

将分隔符设置为冒号或者时期接下来是空间。TeXing 愉快!

答案3

你可以通过这种方式重新定义 \@makecaption 命令

\makeatletter
\renewcommand{\@makecaption}[2]{%
\vspace{\abovecaptionskip}%
\sbox{\@tempboxa}{#1. #2}
\ifdim \wd\@tempboxa >\hsize
#1. #2\par
\else
\global\@minipagefalse
\hbox to \hsize {\hfil #1. #2\hfil}%
\fi
\vspace{\belowcaptionskip}}
\makeatother

给出图表/表格的标题,例如

表 1. Foo 栏

在上面列出的代码中,#1 是\thefigure或的值\thetable,而 #2 是标题文本。

另一种方法是使用caption带有一些选项的包

\usepackage[labelsep=period]{caption}

答案4

如果您使用 KOMA-Script,则标题命令将是:

\newcommand*{\captionformat}{:\ } % this is the original one: Figure 1:
\renewcommand*{\captionformat}{.\ } % this is: Figure 1.

相关内容