How can one number paragraphs in LaTeX?

前端 未结 4 681
北恋
北恋 2021-02-05 04:35

Given a bunch of paragraphs:

Para. A ...

Para. B ...

Para. C ...

How can one have LaTeX automatically number them, i.e.

1. Pa         


        
4条回答
  •  一向
    一向 (楼主)
    2021-02-05 04:46

    I believe another option is the ledmac package. Here is a quote from the documentation:

    The normal \label, \ref and \label \pageref macros may be used within numbered text, and operate in the familiar fashion. As an example, here is one way of numbering paragraphs in numbered text, and then being able to refer to the paragraph numbers, in addition to line and page numbers.

    \newcounter{para} \setcounter{para}{0}
    \newcommand{\newpara}{%
      \refstepcounter{para}%
      \noindent\llap{\thepar. }\quad}
    \newcommand{\oldpara}[1]{%
      \noindent\llap{\ref{#1}. }\quad}
    

    The definitions of \newpara and \oldpara put the numbers in the left margin and the first line of the paragraph is indented. You can now write things like:

    \linenummargin{right}
    \beginnumbering
    \pstart
    \newpara\label{P1} A paragraph about \ldots
    \pend
      In paragraph~\ref{P1} the author \ldots
    \pstart
    \oldpara{P1} This has the same
                 \edtext{number}{\Afootnote{\ref{P1} is the paragraph, not line}}
      as the first paragraph.
    \pend
    \endnumbering
    

    I've never attempted this myself, however.

提交回复
热议问题