One could use the following definition of \N
to achieve what you want:
![enter image description here](https://i.stack.imgur.com/9Vi1u.png)
\documentclass{article}
\usepackage[nopar]{lipsum}% Just for this example
\newcounter{parnum}
\newlength{\parnumwidth}
\setlength{\parnumwidth}{3em}
\newcommand{\N}{%
\noindent\refstepcounter{parnum}%
\makebox[0pt][r]{\makebox[\parnumwidth][l]{\textbf{[\Alph{parnum}].}}}%
\hspace*{\parindent}\ignorespaces}
\setlength{\parindent}{2em}
\begin{document}
\lipsum[1]
\N\lipsum[2]
\lipsum[3]
\end{document}
The paragraph number is placed in the margin using a "\llap
" which is placed inside a box of width \parnumwidth
(set to 3em
).
You could also consider using a \marginpar
, which allows you to place content in the margin in a more flexible way:
![enter image description here](https://i.stack.imgur.com/hBYcd.png)
\documentclass{article}
\reversemarginpar% Keep \marginpar in left margin
\newcounter{parnum}
\newcommand{\N}{%
\leavevmode\refstepcounter{parnum}%
\marginpar{\textbf{[\Alph{parnum}].}}}%
\setlength{\parindent}{2em}
\begin{document}
\N Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus maximus tortor id suscipit sodales.
Aenean dui orci, congue in quam id, venenatis dignissim felis. Proin leo massa, convallis eu purus ut,
bibendum iaculis odio. Sed et lacinia nibh. Duis rhoncus rhoncus lorem, vel sodales est feugiat id.
Maecenas consectetur dolor vitae sem elementum tincidunt. Nunc in posuere purus. Sed congue ullamcorper
felis, eget efficitur eros maximus in. Nam placerat justo risus, mollis fermentum velit tempus vestibulum.
Vivamus placerat neque eu dolor rhoncus blandit. Ut aliquet enim eget nisl luctus euismod. Vivamus
laoreet, elit eu aliquet bibendum, \N magna lorem efficitur turpis, ac cursus tellus tellus non magna.
Nullam justo erat, imperdiet vel diam eu, auctor luctus dui. Fusce eleifend sem a pulvinar suscipit.
Praesent facilisis, velit eget placerat mollis, magna magna venenatis est, at fringilla nulla purus sed dolor.
\end{document}
You may adjust the placement, if needed.
Best Answer
The
lineno
package is what you are looking for.As a first approximation to what you want:
\usepackage[modulo,right]{lineno}
. If you want the numbers to start from 1 on every page, add the optionpagewise
. Unfortunately, the package isn't perfect and will go a little... odd when there's a lot of mathmode or figures.You then need to activate it with
\linenumbers
. Personally, I prefer to use line numbers only in draft mode. So with theifdraft
package, I write\ifdraft{\linenumbers}{}
so that when I'm not compiling drafts, I don't see the ugly numbers.If you want line numbers inside a framed box, for example, you need to put
\internallinenumbers
at the beginning of the environment. I just checked this works withmdframed
...Here is some example code:
The documentation is available here.