我在我的文档中发现了一些奇怪的间距,可以用以下 MWE 重现它:
\documentclass[12pt,BCOR0pt,DIV12]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[german]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{lipsum}
\usepackage{graphicx}
\usepackage[labelfont=it, skip=-12pt, justification=raggedright,singlelinecheck=false, margin={2mm,0mm},hang]{caption}
\usepackage[labelfont=it, skip=-12pt, justification=raggedright,singlelinecheck=false, margin={2mm,0mm}]{bicaption}
\captionsetup[figure][bi]{labelfont=it, justification=raggedright, singlelinecheck=false, margin={0mm,0mm}}
\addto\captionsngerman{\renewcommand\figurename{Bild}}
\captionsetup[figure][bi-first]{name=Bild}
\captionsetup[figure][bi-second]{name=Fig.}
\numberwithin{figure}{section}
\DeclareCaptionFormat{4.0cm}{\hbox to 4.0cm{#1#2\hfill}\parbox[t]{\dimexpr\linewidth-4cm\relax}{#3}\par}
\captionsetup[figure][bi]{format=4.0cm}
\setlength{\parskip}{12pt}
\begin{document}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum urna
fringilla ultrices. Phasellus eu tellus sit amet tortor gravida placerat. Integer sapien est, iaculis in, pretium quis, viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum.
Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor semper nulla. Donec varius orci eget risus. Duis nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum.
%
\begin{figure}[t]
\rule{\textwidth}{0.5cm}
\captionsetup{skip=0pt}
\bicaption[indention=0pt]{Dies ist eine sehr lange Unterschrift in zwei Sprachen die über eine Zeile hinaus geht}{This is supposed to be a very long multiline caption in two languages}
\end{figure}\vspace*{5.8mm}
%
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum urna
fringilla ultrices. Phasellus eu tellus sit amet tortor gravida placerat. Integer sapien est, iaculis in, pretium quis, viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum.
Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor semper nulla. Donec varius orci eget risus. Duis nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum.
%
\begin{figure}[h!]
\rule{\textwidth}{0.5cm}
\captionsetup{skip=0pt}
\bicaption[indention=0pt]{Beispiel 2}{Example 2}
\end{figure}\vspace*{5.8mm}
%
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum urna
fringilla ultrices. Phasellus eu tellus sit amet tortor gravida placerat. Integer sapien est, iaculis in, pretium quis, viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum.
Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor semper nulla. Donec varius orci eget risus. Duis nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum.
\end{document}
这给了我输出:
虽然我理解 Latex 浮动框的概念,并且大多数时候都很喜欢它,但有时将数字放置在正确的位置似乎很麻烦。因此,避免使用像\usepackage{float}
和 这样的苛刻选项,我设法[H]
适应了[h!]
和其他放置方式。但有时,在文本不足和数字太多的情况下,我似乎会在句子中遇到这种奇怪的垂直空间(对应于parskip
)。
我怎样才能避免这种行为而不失去控制[h!]
和其他选择?
答案1
你有
\begin{figure}[t]
\rule{\textwidth}{0.5cm}
\captionsetup{skip=0pt}
\bicaption[indention=0pt]{Dies ist eine sehr lange Unterschrift in zwei Sprachen die über eine Zeile hinaus geht}{This is supposed to be a very long multiline caption in two languages}
\end{figure}\vspace*{5.8mm}
这会在当前行的末尾添加垂直空间。正如您所看到的。您可能希望在figure
环境中有此垂直空间。
答案2
该空间就是\vspace*{5.8mm}
您添加的。
因为%
浮动的前后,浮动被添加到段落内,并浮动到页面的顶部,这意味着在段落内以水平模式添加了 vspace。处于这种位置的 vspace 会在当前行后添加空间。