17

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?

moadeep
  • 367
  • 1
  • 4
  • 8

3 Answers3

20

\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
David Carlisle
  • 757,742
16

This is as simple as:

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

If you just wish to also have them in the table of contents:

\setcounter{tocdepth}{4}

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

8

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

Output

Ludovic C.
  • 8,888