![在浮体之前和之后插入段有什么区别?](https://linux22.com/image/443429/%E5%9C%A8%E6%B5%AE%E4%BD%93%E4%B9%8B%E5%89%8D%E5%92%8C%E4%B9%8B%E5%90%8E%E6%8F%92%E5%85%A5%E6%AE%B5%E6%9C%89%E4%BB%80%E4%B9%88%E5%8C%BA%E5%88%AB%EF%BC%9F.png)
一般情况下,两个段落之间会插入一个浮动体,我们会在\par
浮动体的上方和下方插入,但是\par
可以进行分割。我发现如果只\par
在浮动体前面插入 ,排版效果很好,但是如果只在\par
浮动体后面插入 ,排版效果不好,而且两个段落之间会产生多余的垂直间距。在浮动体的上方和下方插入 进行分割有什么区别\par
,为什么会产生不同的排版效果。
这样,两个段之间就会产生额外的垂直距离。
This is the first paragraph. This is the first paragraph. This is the first paragraph. This is the first paragraph.
\begin{figure}
\centering
\input{1.pgf}
\caption{fig1}
\label{fig1}
\end{figure}
\par
This is the second paragraph. This is the second paragraph. This is the second paragraph. This is the second paragraph.
这样两段之间的距离就正常了。
This is the first paragraph. This is the first paragraph. This is the first paragraph. This is the first paragraph.
\par
\begin{figure}
\centering
\input{2.pgf}
\caption{fig2}
\label{fig2}
\end{figure}
This is the second paragraph. This is the second paragraph. This is the second paragraph. This is the second paragraph.
由于示例代码太短,以上两个示例代码可能无法复现。
答案1
您显示的两种形式的段落间距应该是相同的,请参见此示例,\par
其中第一个图之前和第二个图之后有一个空行()。
但请注意,空间是可拉伸的,因此不同页面的段落之间可能会有不同的空间。
\documentclass{article}
\usepackage{parskip}
\begin{document}
This is the first paragraph. This is the first paragraph. This is the first paragraph. This is the first paragraph.
\begin{figure}
\centering
\rule{2cm}{3cm}
\caption{fig1}
\label{fig1}
\end{figure}
This is the second paragraph. This is the second paragraph. This is the second paragraph. This is the second paragraph.
This is the first paragraph. This is the first paragraph. This is the first paragraph. This is the first paragraph.
\begin{figure}
\centering
\rule{2cm}{3cm}
\caption{fig2}
\label{fig2}
\end{figure}
This is the second paragraph. This is the second paragraph. This is the second paragraph. This is the second paragraph.
\end{document}
但是,如果浮动之前的最后一行是全长的,并且没有在浮动之前放置段落结尾,则需要注意最后的空格是否会单独结束在一行上:
\documentclass{article}
\usepackage{parskip}
\begin{document}
This is the first paragraph. This is the first paragraph. This is the first paragraph. This is the first paragraph.
This is the first paragraph. This is the first...
\begin{figure}
\centering
\rule{2cm}{3cm}
\caption{fig1}
\label{fig1}
\end{figure}
This is the second paragraph. This is the second paragraph. This is the second paragraph. This is the second paragraph.
This is the first paragraph. This is the first paragraph. This is the first paragraph. This is the first paragraph.
This is the first paragraph. This is the first...
\begin{figure}
\centering
\rule{2cm}{3cm}
\caption{fig2}
\label{fig2}
\end{figure}
This is the second paragraph. This is the second paragraph. This is the second paragraph. This is the second paragraph.
\end{document}
可以通过在图前添加段落结尾或注释掉行尾来避免此处在图 2 周围产生的空格,我在%
这里用 a 来展示:
\documentclass{article}
\usepackage{parskip}
\begin{document}
This is the first paragraph. This is the first paragraph. This is the first paragraph. This is the first paragraph.
This is the first paragraph. This is the first...
\begin{figure}
\centering
\rule{2cm}{3cm}
\caption{fig1}
\label{fig1}
\end{figure}
This is the second paragraph. This is the second paragraph. This is the second paragraph. This is the second paragraph.
This is the first paragraph. This is the first paragraph. This is the first paragraph. This is the first paragraph.
This is the first paragraph. This is the first...%
\begin{figure}
\centering
\rule{2cm}{3cm}
\caption{fig2}
\label{fig2}
\end{figure}
This is the second paragraph. This is the second paragraph. This is the second paragraph. This is the second paragraph.
\end{document}