1

I want to have all my paragraphs numbered. I use the package reledmac that provides the numbering of both lines and paragraphs.

Unfortunately, I cannot use \section together with it. What do I have to change?

Minimal (not) working example

\documentclass{article}
\usepackage{lipsum}
\usepackage{reledmac}
\title{Lorem Ipsum}
\author{Max Muster}

\begin{document}
  \maketitle

  \beginnumbering % start numbering of lines and optionally paragraphs
  \numberpstarttrue  % enable paragraph numbering
  \autopar

  \lipsum[1]
  \lipsum[2]
  \section{test} % put in comment for testing
  \lipsum[3]
\end{document}

Screenshot

mwe screenshot

2

That is explained on § 16 of the handbook. See also the MWE provided with the package.

First of all, for MWE with reledmac, you should not use lipsum package as sometime it does not produce the same typographical results than normally typesetted texts.

You have two solutions, depending of you exact need:

1. sectionning commands are not in numbered text.

In this case you must use optional argument of pstart, as explained by @bmv

\documentclass{article}
\usepackage{reledmac}
\title{Lorem Ipsum}
\author{Max Muster}

\begin{document}
\maketitle

\beginnumbering % start numbering of lines and optionally paragraphs
\numberpstarttrue  % enable paragraph numbering
\autopar

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

\pstart[\section{Section title}]
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\pend
\endnumbering% Don't forget the \endnumbering
\end{document}

That produce the followings results (with the last version of reledmac, see later).

enter image description here

Not that, as in standard LaTeX, there is no indentation for the first paragraph after the sectioning command.

2. sectionning commands are in numbered text

You must use in this case \eledsection and so on in individual \pstart...\pend structure.

As explained in the handbook, the section title will be typeset only on the secund run. In general, it is better, when using reledmac to use tools to make automatically the good number of runs, for example latexmk.

\documentclass{article}
\usepackage{reledmac}
\title{Lorem Ipsum}
\author{Max Muster}

\begin{document}
\maketitle

\beginnumbering % start numbering of lines and optionally paragraphs
\numberpstarttrue  % enable paragraph numbering
\autopar

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

\pstart\eledsection{Section title}\pend

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

\endnumbering% Don't forget the \endnumbering
\end{document}

enter image description here

As you can understand, in the mode, section are counted in line counter and also in pstart counter. If you want to count section in line numbering but not in pstart counter, use \addtocounter{pstart}{-1}

\documentclass{article}
\usepackage{reledmac}
\title{Lorem Ipsum}
\author{Max Muster}

\begin{document}
\maketitle

\beginnumbering % start numbering of lines and optionally paragraphs
\numberpstarttrue  % enable paragraph numbering
\autopar

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

\pstart\eledsection{Section title}\pend
\addtocounter{pstart}{-1}

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

\endnumbering% Don't forget the \endnumbering
\end{document}

enter image description here

A bug in version of reledmac < 2.26.4

In version of reledmac < 2.26.4, \numberpstart didn't work with a \pstart called manually in the context of an \autopar use. The version 2.26.4, which have been send on 19/01/2017 at 15H17 fix this bug.

Note on the answer of javi-gg1

In his answer, javi-gg1 told you that \autopar must be used in group context. That was true in the past, and, unfortunatly, the handbook still explained that. His answer works because he adds a local group, which "conturns" the bug of older version of reledmac explained above.

However, he could also propose to alternate

\beginnumbering
\autopar
....

\pausenumbering

\section{XXX}

\resumenumbering
\autopar
....
\pausenumbering
\section{YYYY}

etc

That is what was proposed in the older versions of ledmac. This method works, but it is not a good one, because it can't work with parallel typesetting with reledpar. The two ones I mentionned above work.

  • Thank you for helping me. The first example does not provide a number to the paragraph following the section. The second example does not apply the right styling to the section and also does not number the following paragraph. – rriemann Jan 18 '18 at 10:50
  • Your question was unclear about what do you want for section numbering. The second example work perfectly for the section style, If you apply it more than one run. But indeed there is a problem with pstart number. I am looking on. – Maïeul Jan 18 '18 at 13:03
  • 1
    It is a bug inside reledmac. I will correct it quickly. But you should not use the solution of javvii which is problematic for parallel typesetting. – Maïeul Jan 18 '18 at 13:26
  • 1
    I have fixed the bug. I will release soon, and after that, correct this answer. – Maïeul Jan 18 '18 at 13:48
  • I have updated my answer, and also add more general help to use reledmac. However, there is yet a bug in the CTAN upload form, so I can't send the new version of reledmac. – Maïeul Jan 18 '18 at 15:18
2

This might work:

\documentclass{article}
\usepackage{lipsum}
\usepackage{reledmac}
\title{Lorem Ipsum}
\author{Max Muster}

\begin{document}
    \maketitle

    \beginnumbering % start numbering of lines and optionally paragraphs
    \numberpstarttrue  % enable paragraph numbering
    \autopar

    \lipsum[1]
    \lipsum[2]
    \pstart[\section{Section title}]
    \lipsum[3]
    \pend
\end{document}

enter image description here

  • This example does not number the paragraph following the section. It should have the number 3. Interestingly, line numbers work. – rriemann Jan 18 '18 at 10:54
1

Sectioning commands cannot be called directly within the scope of \autopar. Section 16.2 (page 72) of the reledmac documentation gives some alternatives: either using \eledsection{test} (which will count the section heading as a paragraph and therefore skip one number) or a construction of the form: \pstart[\section{test}] ... \pend (which works correctly starting from version 2.26.4 of the reledmac package). As an alternative, you can limit the scope of \autopar to each section by starting every section with

\begingroup
\autopar

and ending it with

\endgroup

reledmac

\documentclass{article}
\usepackage{lipsum}
\usepackage{reledmac}
\title{Lorem Ipsum}
\author{Max Muster}

\begin{document}
    \maketitle

    \beginnumbering % start numbering of lines and optionally paragraphs
    \numberpstarttrue  % enable paragraph numbering

    \begingroup
    \autopar

    \lipsum[1]
    \lipsum[2]

    \endgroup

    \section{test} % put in comment for testing

    \begingroup
    \autopar

    \lipsum[3]

    \endgroup

\end{document}
  • That is not the main problem here. First, the scope of `\autopar has not o be limited by group, but IS limited by group. And, most important, the problem is that sectionning command can't be used in numbering paragraph without some specific technics. – Maïeul Jan 18 '18 at 10:30
  • The output is perfect here. The problem of this solution is just the amount of commands that one should never forget. Ideally, the tex is generated by pandoc and I write a filter that adds a) nothing or b) as little as necessary. – rriemann Jan 18 '18 at 10:56
  • @Maïeul see first paragraph of Section 5.2.2 (page 19) of the reledmac documentation mirrors.ibiblio.org/CTAN/macros/latex/contrib/reledmac/… , quote "The scope of the \autopar command needs to be limited by keeping it within a group". I interpret that as "has to". – javi_gg1 Jan 18 '18 at 12:13
  • It is a mistake in the handbook related to a indirect feature of \autopar (as maintener of reledmac, I can ensure you.) Because beginnumbering ALREADY starts a group) – Maïeul Jan 18 '18 at 12:58
  • More precisly, it is a mistake keep from a historical behavior. For now, \autopar is already limited by group level. Your code work because you add a new scope of group. So you should use "can" and not "must" (and I must change the handbook) – Maïeul Jan 18 '18 at 13:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.