I'm trying to use the following example from this question to number the paragraphs in my document (slightly modified to remove \thesection.
from the paragraph number).
The example:
\documentclass{article}
\usepackage[excludeor]{everyhook}
\usepackage{lipsum}
\newcounter{paragraphs}[section]
\begin{document}
\PushPostHook{par}{%
\stepcounter{paragraphs}%
\llap{\theparagraphs\ \kern\parindent}%
}
\section{Foo}
\lipsum
\section{Bar}
\lipsum
\end{document}
Screenshot of the example:
(Colors, shapes, and lines added to illustrate the vertical alignment)
But I've encountered two problems I don't know how to solve (one is slightly unrelated to the question of this post, but much easier to solve I think):
The number of every paragraph after the first paragraph follows the indentation of those paragraphs. I want the numbers for all paragraphs to be vertically aligned with the number of the first paragraph. Is it possible to set the position of these numbers so that they're all vertically aligned like this? If so, how?
(The unrelated problem): The paragraph numbering seems to include the section title as the first paragraph, so that the first paragraph is labelled
2
. I want the first paragraph to start with the label1
. I've tried to use\setcounter{secnumdepth}{4}
as stated in some other questions like this one. I've also tried to change the value and put it in different locations in the preamble, but with no luck. I don't fully understand how this command works, so I might just be using it wrong.
Some solutions I've considered:
Using
enumitem
and settingitemindent
to a negative value, but I really do not want to define every paragraph in my document as a list item.Using something like
marginpar
to place the paragraph numbers in the margins, but I'm set on usingmulticols
in my document--and apparently it's not possible to usemarginpar
andmulticols
together.Learning how
TikZ
works and drawing the paragraph numbers in the margins. But I've also read in questions like this one that getting text in margins in amulticols
environment is problematic at best.