如何在 LaTeX 中对段落进行编号?
给定一堆段落:
Para. A ...
Para. B ...
Para. C ...
如何让 LaTeX 自动对它们进行编号,即
1. Para. A. ...
2. Para. B. ...
3. Para. C. ...
我看到了以下建议:
\newcounter{parnum}
\newcommand{\N}{%
\noindent\refstepcounter{parnum}%
\makebox[\parindent][l]{\textbf{\arabic{parnum}.}}}
% Use a generous paragraph indent so numbers can be fit inside the
% indentation space.
\setlength{\parindent}{2em}
从这里: comp.text.tex: Re: 如何在 LaTeX 中对段落进行编号?
然后在每个要编号的段落前面使用 \N,即
\N Para. A. ...
\N Para. B. ...
\N Para. C. ...
I还看到了对 Sarovar 和 numberpar,但两者都被称为“不稳定”或“不可预测”,以及诸如“随机断裂”,这让我很警惕。
我想要一些关于什么是最好的行动方案的意见,我认为这是一个值得讨论的话题。
感谢您对此的兴趣和关注。
编辑:我已经尝试过以下方法
\begin{enumerate}
\item Para No. 1
\item Para No. 2
...
\end{enumerate}
,但是它会导致排版问题,特别是因为我散布了章节标题ala。
\begin{enumerate}
\item Para No. 1
\item Para No. 2
\section{Part II}
\item Para No. 5
\item Para No. 6
...
\end{enumerate}
并且部分标题“第二部分”有时会出现在页面的最底部(即它与以下文本不一致)。
Given a bunch of paragraphs:
Para. A ...
Para. B ...
Para. C ...
How can one have LaTeX automatically number them, i.e.
1. Para. A. ...
2. Para. B. ...
3. Para. C. ...
I've seen the following suggested:
\newcounter{parnum}
\newcommand{\N}{%
\noindent\refstepcounter{parnum}%
\makebox[\parindent][l]{\textbf{\arabic{parnum}.}}}
% Use a generous paragraph indent so numbers can be fit inside the
% indentation space.
\setlength{\parindent}{2em}
From here: comp.text.tex: Re: How do I number paragraphs in LaTeX?
Then use \N in front of every paragraph-to-be-numbered, i.e.
\N Para. A. ...
\N Para. B. ...
\N Para. C. ...
I've also seen references to Sarovar and numberpar, but both are referred to as "unstable" or "unpredictable", and things like "randomly breaks", which makes me wary.
I'd like some input on what may be the best course of action, here, and I think it's a topic worth some discussion.
Thank you for your interest and attention to this.
EDIT: I've tried the following
\begin{enumerate}
\item Para No. 1
\item Para No. 2
...
\end{enumerate}
However it results in typesetting problems, notably because I am interspersing section headings ala.
\begin{enumerate}
\item Para No. 1
\item Para No. 2
\section{Part II}
\item Para No. 5
\item Para No. 6
...
\end{enumerate}
and the section heading "Part II" will sometimes end up at the very bottom of the page (i.e. it doesn't keep with the following text).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
此问题的解决方案是使用包 parano,该包由印度特里凡得琅 River Valley Technologies 的 CV Radhakrishnan 编写。
我从以下网页知道这个解决方案
http://www.ub-filosofie.ro/~solcan /wt/gnu/n/np.html
A solution to this problem is the use of the package parano, written by CV Radhakrishnan from River Valley Technologies, Trivandrum, India.
I know this solution from the following webpage
http://www.ub-filosofie.ro/~solcan/wt/gnu/n/np.html
我认为存在三种可能的解决方案(至少!),它们不涉及滚动您自己的或其他人的宏,具体取决于您想要做什么。
1 如果整个文档都需要编号,请使用
\paragraph
,这是一个较低级别的分段命令(如 \chapter、\section、\subsection 等)。请参阅 LaTeX wikibook 了解更多信息。
(您可能会发现这种杀伤力过大/丑陋,因为它需要节和子节的正确嵌套结构)
请注意,如果您使用回忆录文档类(我毫不犹豫地推荐),则
\setcounter
行变为\maxsecnumdepth{paragraph}
2 如果只是一小段,则使用列表:
3 或广义列表 (
\begin{list}...\end{list{}< /code>) 如果你想调整格式。 除了 LaTeX 指南
I think there are three possible solutions (at least!) which don't involve rolling your own or someone else's macro, depending on exactly what you are trying to do.
1 If the numbering is required throughout the document, use
\paragraph
, which is a lower-level sectioning command (like \chapter, \section, \subsection, etc.)See the LaTeX wikibook for more information.
(You may find this overkill/ugly, because it needs a properly nested structure of sections and subsections not to be)
Note that if your using the memoir document class (which I recommend unhesitatingly), the
\setcounter
line becomes\maxsecnumdepth{paragraph}
2 If it's just a small piece, use a list:
3 Or a generalized list (
\begin{list}...\end{list{}
) if you want to tweak the formatting. I haven't immediately been able to find a good online reference for this, other than the piece in A Guide to LaTeX就我而言,我最终通过重新定义一个像段落一样工作的新宏
\P
来解决这个问题。要编写一个新的“段落”,我要做的
是将枚举链接到我使用的部分,
我知道这实际上是搞砸了,但最终为我工作。
In my case I ended up solving this by redefining a new macro
\P
that works like a paragraph.To write a new "paragraph" I do
To make the enumeration be linked to the section I use
I know that this is actually botched-up but ended up working for me.
我相信另一个选择是
ledmac
包。 这是文档中的引用:但是,我自己从未尝试过这样做。
I believe another option is the
ledmac
package. Here is a quote from the documentation:I've never attempted this myself, however.