考虑以下代码
\documentclass{svmono}% Version 5.5, available from https://www.springer.com/gp/authors-editors/book-authors-editors/manuscript-preparation/5636
\usepackage{newfloat}
\DeclareFloatingEnvironment[placement=htb,name={Spec.}]{specification}
%\usepackage[labelsep=space,justification=RaggedRight,labelfont={small,bf},textfont={small},skip=0pt]{caption}%%% Possible in an MWE, but leads to a different style than prescribed by Springer. It is difficult to reduce the vertical gap ONLY; including this package introduces a whole bunch of other changes.
\abovecaptionskip=0pt
\belowcaptionskip=0pt
\skip41=0pt
\skip42=0pt
\figcapgap=0pt%%% only for svmono, won't work with article
\tabcapgap=0pt%%% doesn't help either, as noticed by Axel
\begin{document}
\begin{specification}
\noindent\strut\hrulefill\\[-.4\baselineskip]
Line 1\\
\(\vdots\)\\
Line 9\\[-.8\baselineskip]%
\strut\hrulefill%
\caption{Too much space between the line just above and this caption.}%
\end{specification}
\end{document}
结果大致如下(我无法上传图片,原因不明;SE说imgur拒绝请求):
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Line 1
⁝
Line 9
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Spec. 1 Too much space between the line just above and this caption.
如何减少第二条水平线和标题之间的间隙?我的标准解决方案是\\[-.3\baselineskip]%
在之前插入类似于新行的内容\caption{...}
,但实际间隙(-.3\baselineskip
上面)是猜测,因此很脆弱,以及您在代码中看到的其他硬编码跳过。一般来说,我想逐一减少调整的硬编码。在这个问题中,我只想自动消除一个垂直间隙,即标题之前的间隙。我知道如何在课堂上做到这一点,我也article
知道如何用包来做到这一点caption
,但是,这会改变很多默认值(这不是这个问题想要的)。正如读者在源代码中看到的那样,我试图将一些我已知的长度设置为 0pt,但没有任何帮助。
答案1
您可以更改 \capstrut 的定义。默认情况下,它会插入高度为 10pt 的支柱:
\documentclass{svmono}%
\usepackage{newfloat}
\DeclareFloatingEnvironment[placement=htb,name={Spec.}]{specification}
\begin{document}
\begin{specification}
\noindent\strut\hrulefill\\[-.4\baselineskip]
Line 1\\
\(\vdots\)\\
Line 9\\[-.8\baselineskip]%
\strut\hrulefill
\caption{Too much space between the line just above and this caption.}%
\end{specification}
\renewcommand\capstrut{\strut}
\begin{specification}
\noindent\strut\hrulefill\\[-.4\baselineskip]
Line 1\\
\(\vdots\)\\
Line 9\\[-.8\baselineskip]%
\strut\hrulefill
\caption{Too much space between the line just above and this caption.}%
\end{specification}
\end{document}