1

I would like to control the amount of space between a (starred) caption below a figure with width=\linewidth. However, when I choose skip=0pt, there is additional space compared to a figure of smaller width.

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

enter image description here

I tried skip=-\baselineskip, but this only works for full width figures (narrower figures' \notes are pushed into the figure).

How can I create a constant height between a figure and a \caption(*) below the figure. I know I could just use plain (non-caption) text; however, if figures are very narrow, the text appears to the side of the figure.

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

enter image description here

Output of .log file due to \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
 ***********

closed as off-topic by Hugh, Paul Gessler, user13907, Werner, Jesse May 26 '16 at 3:29

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    \newcommand{\notes}[1]{\par\smallskip Notes:\ #1}? – Torbjørn T. May 25 '16 at 15:02
  • The posted code does not produce the spacing shown, I get this output – David Carlisle May 25 '16 at 15:46
  • 1
    @Hugh: I can't replicate the behaviour with either \caption or \caption*. The next suggestion would be to provide the community with a list of file versions. Also, does the problem persist if you use just the article (or book) class? If so, don't use that in your MWE, just because. – Werner May 25 '16 at 17:26
  • 2
    The problem replicates for me. Add a % at the end of the \includegraphics (no space). What is happening is that the space at the end triggers a new line before caption issues a \par. Add one at the end of \captionsetup as well. – John Kormylo May 25 '16 at 17:32
  • 4
    I'm voting to close this question as off-topic because it was solved by updating the distribution. – Hugh May 26 '16 at 1:15
1

The reason are too many spaces at the end of the paragraph before the caption. TeX removes up to one space, but \notes causes two spaces by line ends and there is a space after \includegraphics.

The problem is solved, when the spaces are removed by commenting the line ends:

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

Simplified example. The rule with width \textwidth fills the full line. The paragraph ends and the following \hrule should be pretty close.

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

Result

In the second case, the space is removed by TeX at the end of the paragraph. The third case with two spaces is the interesting case. The second space is again removed by TeX at the end of the paragraph, but one space remains and the previous line is full. Thus TeX is forced to create a line break. At the start of the new line the remaining space is discarded, leaving an empty new line causing an Underfull \hbox warning.

Not the answer you're looking for? Browse other questions tagged or ask your own question.