用以下三种方式结束一个段落有何不同的效果?
1.
words words words
words words words
2.
words words words\\
words words words
3.
words words words\\
words words words
答案1
正如我在评论中所说,“第一个提供了段落分隔符,第二个是段落内的强制换行符,这通常不推荐。由于许多 LaTeX 操作仅在段落末尾执行,因此语法上看似微小的差异可能会对输出产生深远的影响。”
以下是一些功能差异的示例。
\documentclass[a4paper]{article}
\begin{document}
CENTERING:
{
line 1
line 2\centering
}
\noindent versus
{
line 1\\
line 2\centering
}
\noindent\hrulefill
PARAGRAPH SPACING AND INDENTS
{\parskip 1em
line 1
line 2
}
\noindent versus
{\parskip 1em
line 1\\
line 2
}
\noindent\hrulefill
LEFT AND RIGHT SKIPS
{
line 1
line 2\leftskip 1in
}
\noindent versus
{
line 1\\
line 2\leftskip 1in
}
\end{document}
\par
请注意,此代码可以在宏中自动执行(请注意,额外的空白行与LaTeX 的目的相同):
\documentclass[a4paper]{article}
\newcommand\stencil[3]{\par\bgroup#2 line 1#1line 2#3\par\egroup}
\begin{document}
CENTERING:
\stencil{\par}{}{\centering}
\noindent versus
\stencil{\\}{}{\centering}
\noindent\hrulefill
PARAGRAPH SPACING AND INDENTS
\stencil{\par}{\parskip 1em}{}
\noindent versus
\stencil{\\}{\parskip 1em}{}
\noindent\hrulefill
LEFT AND RIGHT SKIPS
\stencil{\par}{}{\leftskip 1in}
\noindent versus
\stencil{\\}{}{\leftskip 1in}
\end{document}