3

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
4

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:

Sample output

\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}}

\def\@@parano[#1]{\setcounter{parano}{#1}\addtocounter{parano}{-1}%
   \@parano}% To avoid code duplication

\makeatother

%Customizations for this example

\renewcommand{\prepara}{\hss}
\renewcommand{\postpara}{\hspace{\parindent}\ignorespaces}
\renewcommand{\paranospace}{\quad\hfill}
\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}}
\makeatletter\@addtoreset{parano}{section}\makeatother

to the preamble.

  • I am sorry my question wasn't clear. This is the effect I wanted to give to the document, with the added code to the preamble to reset the counter at each section and subsection. Thank you. – Antonello Dec 8 '14 at 8:56
  • On my real document using "\usepackage{hyperref}" sends back the paragraph lines within the document margins. Why and how could I avoid it ? – Antonello Dec 8 '14 at 10:19
  • 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
  • is parano still the way to do this? I can't find a live link for this package – jk. Nov 28 '18 at 8:47
  • 1
    A copy of the package seems to be available at github.com/HugoAreias/DRAW--includes-DREQL-/blob/master/Manual/… – Andrew Swann Nov 28 '18 at 12:13

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.