Quantcast
Channel: Planet Ubuntu
Viewing all articles
Browse latest Browse all 17727

Ryan Kavanagh: Numbering paragraphs in LaTeX

$
0
0

Recently, I was asked to write an essay and to number its paragraphs. I couldn't find anything premade, so I worked something up using the ledmac package. It isn't perfect (you need to restart it after using the quote environment, etc.) but it did the trick for a simple essay. In case anybody else is looking to do something similar, here's how I did it:

        
    \documentclass{article}
    \usepackage{lipsum}
    \usepackage{ledmac}
    % \reversemarginpar % Uncomment for in the margin
    % \setlength\marginparwidth{2em} % Uncomment for in the margin
    \newcounter{para}\setcounter{para}{0}
    \newcounter{thispara}\setcounter{thispara}{0}
    \newcommand*{\newpara}{ %
      \refstepcounter{para}
      \setcounter{thispara}{\value{para}}
      % \marginpar} % Uncomment for in the margin
      \textbf{\thepara. } % Comment for in the margin
    }
    \begin{document}
    \title{Lorem Ipsum}
    \author{Ryan Kavanagh}
    \maketitle
    \everypar{\noindent\newpara}
    \lipsum[1]
    \lipsum[2]
    \lipsum[3]
    \end{document}
        
Paragraph numbering in LaTeX

See the instructions in the comments for having numbers in the margin.


Viewing all articles
Browse latest Browse all 17727

Trending Articles