将 \parindent 和 \parskip 与 \paragraph{} 一起使用没有任何效果
我正在使用 XeLaTeX
中的 memoir
类创建文档。我在创建正确的段落演示时遇到问题,特别是当我使用 \paragraph{}lorem ipsum
创建段落时,LaTeX 会忽略 \parskip
和 \parindent
设置。
例如,如果我有一个文档,
\documentclass[oneside,11pt]{memoir}
\usepackage{fontspec}% font selecting commands
\usepackage{xunicode}% unicode character macros
\usepackage{xltxtra} % some fixes/extras
\begin{document}
\setlength{\parskip}{0pt} % 1ex plus 0.5ex minus 0.2ex}
\setlength{\parindent}{0pt}
\pagestyle{plain}
\paragraph{}orem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam enim
urna, mattis eu aliquet eget, condimentum id nibh. In hac habitasse platea
dictumst.
\paragraph{}ipsum dolor sit amet, consectetur adipiscing elit. Aliquam enim urna,
mattis eu aliquet eget, condimentum id nibh. In hac habitasse platea dictumst.
\end{document}
它的排版如下:
orem ipsum dolor sat amet,consectetur adipiscing elit。阿里夸姆恩尼姆 urna,马蒂斯 eu aliquet eget,调味品 id nibh。在哈克栖息地高原 断言。
ipsum dolor sat amet,consectetur adipiscing elit。 Aliquam enim urna, 马蒂斯·欧盟aliquet eget,调味品id nibh。在 hachabitasseplatea dictumst 中。
尽管 \parskip
和 \parindent
设置为零,但它错误地同时具有段落缩进和跳过。
人们会期望排版输出看起来像这样(这是一种丑陋的段落格式选择,但说明了问题):
orem ipsum dolor sat amet,consectetur adipiscing elit。阿里夸姆恩尼姆 urna,马蒂斯 eu aliquet eget,调味品 id nibh。在哈克栖息地高原 格言。
ipsum dolor sat amet,consectetur adipiscing elit。 Aliquam enim urna, 马蒂斯·欧盟aliquet eget,调味品id nibh。在 hachabitasseplatea dictumst 中。
我注意到,当我用两个换行符分隔段落时(即不使用 \paragraph{}
和) \parskip
和 \parindent
设置受到尊重。
我很高兴知道为什么在使用 \paragraph{}
时,\parskip
和 \parindent
命令不被遵守,并且如何让这些命令生效,或者哪些命令可以对使用 \paragraph{}
创建的段落达到相同的效果。
感谢您的阅读。
布莱恩
I'm creating documents using the memoir
class in XeLaTeX
. I'm having trouble creating proper paragraph presentation, and in particular my when I create paragraphs with \paragraph{}lorem ipsum
LaTeX ignores the \parskip
and \parindent
settings.
For example, if I have a document
\documentclass[oneside,11pt]{memoir}
\usepackage{fontspec}% font selecting commands
\usepackage{xunicode}% unicode character macros
\usepackage{xltxtra} % some fixes/extras
\begin{document}
\setlength{\parskip}{0pt} % 1ex plus 0.5ex minus 0.2ex}
\setlength{\parindent}{0pt}
\pagestyle{plain}
\paragraph{}orem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam enim
urna, mattis eu aliquet eget, condimentum id nibh. In hac habitasse platea
dictumst.
\paragraph{}ipsum dolor sit amet, consectetur adipiscing elit. Aliquam enim urna,
mattis eu aliquet eget, condimentum id nibh. In hac habitasse platea dictumst.
\end{document}
This typesets like so:
orem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam enim
urna, mattis eu aliquet eget, condimentum id nibh. In hac habitasse platea
dictumst.ipsum dolor sit amet, consectetur adipiscing elit. Aliquam enim urna,
mattis eu aliquet eget, condimentum id nibh. In hac habitasse platea dictumst.
This incorrectly has both paragraph indentation and skip, in spite of \parskip
and \parindent
being set to zero.
One would expect the typeset output to look like this (which is an ugly choice of paragraph formatting, but illustrates the issue):
orem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam enim
urna, mattis eu aliquet eget, condimentum id nibh. In hac habitasse platea
dictumst.
ipsum dolor sit amet, consectetur adipiscing elit. Aliquam enim urna,
mattis eu aliquet eget, condimentum id nibh. In hac habitasse platea dictumst.
I note that when I separate paragraphs by two newlines (i.e. don't use \paragraph{}
, and) the \parskip
and \parindent
settings are honoured.
I'd be very grateful to know why, when using \paragraph{}
, the \parskip
and \parindent
commands are not honoured, and how one might either have these commands honoured or alternatively what commands would achieve the same effect with paragraphs created with \paragraph{}
.
Thank you for reading.
Brian
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
@Brian——在您对 Norman Gray 的回复发表评论后,我开始将其放入评论中,但代码示例使其太大。 \paragraph{} 不会改变常规段落的排版。只是与直觉相反,以 \paragraph{} 命令开头的段落不是常规段落;它是文档中的一个节元素。使用下面的代码来查看 \parskip 和 \parindent 如何影响常规段落,但不影响“\paragraph”部分元素。 (实际上, \parskip 甚至影响 \paragraph{} 项,但计算出 \paragraph{} 项之前的间距始终略大于 \parskip,这就是为什么 \paragraph{} 元素之间始终存在空格,即使 \ parskip 是 0。)
我认为 99% 的 LaTeX 文档可能从未使用过 \paragraph{} 部分命令。 LaTeX 中的常规段落由 (1) 空行(下面的“常规段落”1 和 2)或 (2) \par 命令(下面的“常规段落”3 和 4)分隔。
@Brian -- I started putting this in a comment following your comment to Norman Gray's response, but the code sample made it too large. \paragraph{} doesn't change the typesetting of regular paragraphs. It's just that, counter-intuitively, the paragraph begun by the \paragraph{} command is not a regular paragraph; it's a section element in the document. Play with the code below to see how the \parskip and \parindent affects the regular paragraphs but not the "\paragraph" section element. (Actually, \parskip affects even the \paragraph{} items but the spacing before a \paragraph{} item is calculated to always be slightly more than \parskip, which is why there's always a space between \paragraph{} elements even if \parskip is 0.)
I think 99% of LaTeX docs probably never use the \paragraph{} section command. Regular paragraphs in LaTeX are separated by (1) a blank line ("regular paragraphs" 1 and 2 below) or (2) by the \par command ("regular paragraphs" 3 and 4 below).
这看起来是正确的行为。您认为
\paragraph
应该做什么?提示:它不是为了分隔段落。根据回忆录文档,
\paragraph
是分段命令之一,位于\subsubsection
之后和\subparagraph
之前。该命令的参数(在示例中将其设置为空)用于段落的标题。您可以使用空行将段落彼此分开(您发现在这种情况下,尊重
\parskip
和\parindent
维度),或者在某些情况下使用\par
的情况稍微有点特殊。That looks like correct behaviour. What do you think
\paragraph
should do? Hint: it's not for separating paragraphs.According to the memoir docs,
\paragraph
is one of the sectioning commands, after\subsubsection
and before\subparagraph
. The argument to the command, which you're making empty in your example, is for the title of the paragraph.You separate paragraphs from each other by using a blank line (and this is the case you've found where the
\parskip
and\parindent
dimensions are honoured), or in some slightly more exotic cases by using\par
.