# Numbering paragraphs in latex

I would like to number paragraphs for a covering report I am writing. Paragraphs should increment and not reset with new sections. The text should not be bold. Here is what I have tried

\makeatletter
\renewcommand{\paragraph}{%
\@startsection{paragraph}{4}%
{\z@}{0.25ex \@plus 1ex \@minus .2ex}{-1em}%
{\normalfont\normalsize\fontfamily{phv}\fontsize{10}{15}\selectfont}
{\arabic{paragraph}}%
}
\makeatother


This has been hacked from various questions on this site.

  \paragraph{Testing 1}
\paragraph{Testing 2}


gives me

0.0.0.1 1 Testing 1
0.0.0.2 2 Testing 2


desired format is

1 Testing 1
2 Testing 2


Where am I going wrong?

Also what is fontfamily{phv}. Is this different from my default font?

• Have a look at this answer it might fit for your need. tex.stackexchange.com/a/10524/31058 – Ludovic C. Aug 20 '13 at 15:00
• @moadeep Are you looking for something like "(19)" at the beginning of a paragraph, or e.g. as a marginpar? Show us what you would like to have! – Keks Dose Aug 20 '13 at 15:05
• @KeksDose Question edited. I would like something like "(19)" at the beginning of each paragraph. The reason being I need to cross reference paragraphs to a table in another chapter – moadeep Aug 20 '13 at 15:08
• I guess you have a line like \setcounter{secnumdepth}{4} – karlkoeller Aug 20 '13 at 15:15
• @karlkoeller yes. The number is incrementing as expected. My major issue is the extra 0.0.0.num before num – moadeep Aug 20 '13 at 15:16

\paragraph is like \section the argument should be the title not the whole paragraph, and it should only be used after a higher level sectioning unit (\subsubsection)

Perhaps

\newcounter{para}
\newcommand\mypara{\par\refstepcounter{para}\thepara\space}


Then you can use

\mypara blah blah blah
\mypara foo bar baz

• Excellent thanks. Can I make the number bold? – moadeep Aug 20 '13 at 15:30
• @moadeep \textbf{\thepara} – David Carlisle Aug 20 '13 at 15:52
• Is there a way to make the paragraph title bold also? – flamsmark Aug 31 '13 at 0:03
• @flamsmark these are untitled paragraphs, if you want titled paragraphs you need something more like \newcommand\mypara[1]{\par\refstepcounter{para}\textbf{\thepara\space#1\space}} – David Carlisle Aug 31 '13 at 8:52

This is as simple as:

\renewcommand{\theparagraph}{\S\arabic{paragraph}}
\setcounter{secnumdepth}{4}


\setcounter{tocdepth}{4}


Answered taken from How can I number paragraphs without higher level counters?

Using the idea from this answer:

\documentclass{book}

\usepackage{mparhack}   % get marginpars to always show up on the correct side (need to compile twice)
\usepackage{lipsum}     % for dummy text

\setlength\parindent{0cm}

\newcommand{\parnum}{(\arabic{parcount})}

\newcounter{parcount}
\newcommand\p{%
\stepcounter{parcount}%
\parnum \hspace{1em}%
}

\newenvironment{parnumbers}{%
\par%
\everypar{\noindent \stepcounter{parcount}\parnum \hspace{1em}}%
}{}

\begin{document}

\p \lipsum[1]

\begin{parnumbers}
\lipsum[2-4]

\end{parnumbers}

\end{document}


it yields

• If you use \refstepcounter instead of \stepcounter paragraphs can be used with \label / \ref – David Carlisle Aug 20 '13 at 15:26
• also, don't do anything rash, like using a list environment (itemize, enumerate, etc) -- they destroy \everypar – wasteofspace Aug 28 '13 at 10:28
• This is the best solution, because it does the numbering automatically within the environment. The other solution requires a command to number the paragraph. So this one is better. – HSchmale Nov 3 '15 at 20:12
• This breaks if you interpose a \section{}. – g33kz0r Sep 25 '17 at 0:54
• @g33kz0r out of interest why does a section break this ? – jk. Nov 27 '18 at 17:10