图形宽度影响标题位置

图形宽度影响标题位置

我想使用 来控制图形下方 (带星号的) 标题之间的空间量width=\linewidth。但是,当我选择 时skip=0pt,与宽度较小的图形相比,会有额外的空间。

\documentclass{scrbook}

\usepackage{caption}
\usepackage[demo]{graphicx}

\newcommand{\notes}[1]{%
\captionsetup{format=plain, skip=0pt, singlelinecheck=false, position=bottom}
\caption{Notes:\ #1}
}

\begin{document}
.
\begin{figure}
\includegraphics[width=0.99\textwidth]{}
\notes{La}
\end{figure}

\begin{figure}
\includegraphics[width=\textwidth]{}
\notes{La}
\end{figure}

\end{document}

在此处输入图片描述

我试过了skip=-\baselineskip,但这只适用于全宽图形(较窄的图形\notes被推入图形中)。

如何在图形和\caption(*)图形下方之间创建恒定高度。我知道我可以使用纯文本(非标题);但是,如果图形非常窄,文本将显示在图形的侧面。

\begin{figure}
\includegraphics[width=0.5\textwidth]{}
Notes: La
\end{figure}

在此处输入图片描述

文件输出.log原因\listfiles

 *File List*
 scrbook.cls    2015/07/02 v3.18 KOMA-Script document class (book)
scrkbase.sty    2015/07/02 v3.18 KOMA-Script package (KOMA-Script-dependent bas
ics and keyval usage)
 scrbase.sty    2015/07/02 v3.18 KOMA-Script package (KOMA-Script-independent b
asics and keyval usage)
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
scrlfile.sty    2015/07/02 v3.18 KOMA-Script package (loading files)
tocbasic.sty    2015/07/02 v3.18 KOMA-Script package (handling toc-files)
scrsize11pt.clo    2015/07/02 v3.18 KOMA-Script font size class option (11pt)
typearea.sty    2015/07/02 v3.18 KOMA-Script package (type area)
 caption.sty    2015/09/17 v3.3-111 Customizing captions (AR)
caption3.sty    2015/09/20 v1.7-115 caption3 kernel (AR)
graphicx.sty    2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty    2014/10/28 v1.0p Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg    2007/01/18 v1.5 graphics 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/error messages (HO)
 ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
hyperref.sty    2012/11/06 v6.83m Hypertext links for LaTeX
hobsub-hyperref.sty    2012/04/25 v1.12 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty    2012/04/25 v1.12 Bundle oberdiek, subset generic (HO)
  hobsub.sty    2012/04/25 v1.12 Construct package bundles (HO)
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
  ifvtex.sty    2010/03/01 v1.5 Detect VTeX and its facilities (HO)
 intcalc.sty    2007/09/27 v1.1 Expandable calculations with integers (HO)
   ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
etexcmds.sty    2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
kvsetkeys.sty    2012/04/25 v1.16 Key value parser (HO)
kvdefinekeys.sty    2011/04/07 v1.3 Define keys (HO)
pdftexcmds.sty    2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
pdfescape.sty    2011/11/25 v1.13 Implements pdfTeX's escape features (HO)
bigintcalc.sty    2012/04/08 v1.3 Expandable calculations on big integers (HO)
  bitset.sty    2011/01/30 v1.1 Handle bit-vector datatype (HO)
uniquecounter.sty    2011/01/30 v1.2 Provide unlimited unique counter (HO)
letltxmacro.sty    2010/09/02 v1.4 Let assignment for LaTeX macros (HO)
 hopatch.sty    2011/06/24 v1.1 Wrapper for package hooks (HO)
xcolor-patch.sty    2011/01/30 xcolor patch
atveryend.sty    2011/06/30 v1.8 Hooks at the very end of document (HO)
atbegshi.sty    2011/10/05 v1.16 At begin shipout hook (HO)
refcount.sty    2011/10/16 v3.4 Data extraction from label references (HO)
 hycolor.sty    2011/01/30 v1.7 Color options for hyperref/bookmark (HO)
 ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional
 auxhook.sty    2011/03/04 v1.3 Hooks for auxiliary files (HO)
kvoptions.sty    2011/06/30 v3.11 Key value format for package options (HO)
  pd1enc.def    2012/11/06 v6.83m Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg    2002/06/06 v1.2 hyperref configuration of TeXLive
     url.sty    2013/09/16  ver 3.4  Verb mode for urls, etc.
 hpdftex.def    2012/11/06 v6.83m Hyperref driver for pdfTeX
rerunfilecheck.sty    2011/04/15 v1.7 Rerun checks for auxiliary files (HO)
supp-pdf.mkii
 nameref.sty    2012/10/27 v2.43 Cross-referencing by name of section
gettitlestring.sty    2010/12/03 v1.4 Cleanup title references (HO)
captionStar.out
captionStar.out
 ***********

答案1

原因是标题前的段落末尾有太多空格。TeX 最多会删除空格,但\notes会导致行尾出现两个空格,并且 之后还有一个空格\includegraphics

通过注释行尾删除空格,问题得到解决:

\newcommand{\notes}[1]{%
  \captionsetup{format=plain, skip=0pt, singlelinecheck=false,
    position=bottom}%
  \caption{Notes:\ #1}%
}

简化示例。带宽度的规则\textwidth填充整行。段落结束,后面的内容\hrule应该非常接近。

\documentclass{article}
\setlength{\parindent}{0pt}
\setlength{\parskip}{10mm}
\begin{document}

Rule without space:\\
\rule{\textwidth}{1pt}\par
\hrule

Rule with one space:\\
\rule{\textwidth}{1pt} \par
\hrule

Rule with two spaces:\\
\rule{\textwidth}{1pt} \space\par
\hrule

\end{document}

结果

在第二种情况下,TeX 会在段落末尾删除空格。第三种情况是两个空格,这是最有趣的情况。TeX 再次在段落末尾删除了第二个空格,但保留了一个空格,而前一行已满。因此 TeX 被迫创建一个换行符。在新行的开头,剩余的空格将被丢弃,留下一个空的新行,从而引发警告Underfull \hbox

相关内容