可能重复:
以较小的字体在段落中设置单个方程式
我想缩小插入段落中间的某些排版材料的大小。以下 tex 文件生成了我想要的字体大小,但前一段的行距\begin{footnotesize}
被错误地更改了。为什么会发生这种情况?如何在不改变周围文本间距的情况下更改字体大小?
\documentclass{article}
% Commands to typeset code in a certain style
% Not relevant to the problem
\newcommand{\letE}{\mathbf{let}\;}
\newcommand{\inE}{\mathbf{in}\;}
\newcommand{\qlambda}[1]{\lambda#1\to}
\newcommand{\app}[1]{#1\;}
\newcommand{\putspace}{\mathord{}}
\newcommand{\name}[1]{\mathit{#1}}
\begin{document}
This is an example of a document where paragraph spacing is altered
because the size of some text in the paragraph is changed.
The following expression in the polymorphic lambda calculus is
rendered in a small font so that it can be displayed with fewer line breaks.
\begin{footnotesize}
\begin{tabbing}
$\letE \name{double} = \qlambda{f} \qlambda{x} \app f (\app fx)$ \\
$\inE\putspace$\=
$\letE \name{twohundredfiftysix} = \putspace$\=%
$\letE \name{four} = \app{\name{double}}\name{double}\;%
\inE \app{\name{four}}\name{four}$ \\
\>$\inE \app{\name{twohundredfiftysix}}\name{twohundredfiftysix}$
\end{tabbing}
\end{footnotesize}
Vexingly, the use of \verb+footnotesize+ has altered the
spacing of the preceding lines in the same paragraph.
\end{document}
编辑:更改为非数学示例。
答案1
这里的问题是footnotesize
环境仍然是前一段的一部分。TeX 实际上在决定优化换行之前会组装整个段落,从而导致footnotesize
环境影响。发出正式命令\par
并删除下一个段落之前的虚假空格%
(如果您希望段落组件“连接”):
\documentclass{article}
\begin{document}
This is an example of a document where paragraph spacing is altered
because the size of some text in the paragraph is changed.
The following long and complicated formula is rendered in a small font
so that it can be displayed with fewer line breaks.\par
\begin{footnotesize}
\[ x = 1 \]
\end{footnotesize}%
Vexingly, the use of \verb+footnotesize+ has altered the
spacing of the preceding lines in the same paragraph.
\end{document}