# How to number (on the left margin) paragraphs instead of lines?

I am aware of package lineno for row numbers, but my line numbers may change due to English language editing but my paragraphs will likelly not: is it possible to number (on the left margin) paragraphs instead of lines, so I can refer to some text as “Section 2.2, paragraph 3″ ?

I saw How can I number paragraphs (and sections) in the margin? but section numbers and paragraph numebers are put together there, while I am looking to something more like lineno, where on the margin I have just parapraphs numbers instead of lines.

• Are you talking about the command \paragraph or automatic counting of paragraphs after empty lines? How do you want to reference in the second case? In the first case: Your link does provide everything you need. Just kick the redefinitions of the Sections out. – LaRiFaRi Dec 4 '14 at 9:21
• @Antonello Can you upload a picture what you want? A counter for all paragraphs, starting with 1 and ending at the end of the document with 867? Or should the counter be reseted to 1 after each section? What in case of subsections, subsubsections and so on? – Keks Dose Dec 4 '14 at 13:26

You can use the parano package mentioned in that other posting, together with a couple of fixes and customisations as follows. Now updated to work with hyperref:

\documentclass{article}

\usepackage{parano}% http://www.sci.usq.edu.au/staff/braithwa/parano.sty
%\usepackage{hyperref}

%Fixes to parano.sty
\makeatletter

\newcommand{\paranospace}{\hfill}% Introduced for more flexible customisation

\renewcommand{\@parano}{%
\everypar{\setbox0\lastbox% Fixes first paragraph indent problem
\refstepcounter{parano}%
\hbox to \paranoboxwidth{\prepara\theparano\paranospace}\postpara}}

\@parano}% To avoid code duplication

\makeatother

%Customizations for this example

\renewcommand{\prepara}{\hss}
\renewcommand{\postpara}{\hspace{\parindent}\ignorespaces}
\setlength{\paranoboxwidth}{0pt}

\usepackage{lipsum}

\begin{document}

\parano

\section{Test}

\lipsum[1-2]

Here is a paragraph to be labelled.\label{mypara}

\lipsum[3]

The labelled paragraph was \ref{mypara}.

\end{document}


If you want the paragraphs just to be numbered within each section then add

\renewcommand\theparano{\arabic{parano}}

• I have updated the code - the first two statements in the \everypar need to be in the opposite order when using hyperref, without it doesn't make any difference. – Andrew Swann Dec 8 '14 at 10:25