4

I am using the paragraph section head, i.e.,

\paragraph{This is a cool paragraph} 

I would like it to compile with numbering. If I change the secnumdepth (i.e., \setcounter{secnumdepth}{4}) this will work, but produce the "wrong" type of numbering, i.e.,

1.1.1.1 This is a cool paragraph

1.1.1.2 This is another cool paragraph etc.

What I would like is

1 This is a cool paragraph

2 This is another cool paragraph

or, if not,

1.1 This is a cool paragraph

1.2 This is another cool paragraph

where the first 1 indicates the section number and suppresses the subsection and subsubsection numbers. Can this be done?

  • 4
    \paragraph is a 4th level heading and should only be used in the sequence section,subsection,subsubsection,paragraph. You should either use \section for top level sections or itemize and \item – David Carlisle Apr 19 '16 at 19:34
  • 2
    having said that, \renewcommand\theparagraph{\arabic{paragraph}} will get rid of all the prefixed numbers – David Carlisle Apr 19 '16 at 19:41
  • I think the OP just wants to suppress the unwanted numbers, but uses the hierarchy in the usual way. – MaestroGlanz Apr 19 '16 at 19:54
  • 1
    Isn't this the same problem? – Alex Nelson Apr 19 '16 at 20:53
  • @AlexNelson: Yup. – MaestroGlanz Apr 20 '16 at 8:25
2

Here's an enumitem way instead of \paragraph. The paragraphlisti counter is reset by each subsubsection step (if such levels are used at all)

David Carlisle's comment about \renewcommand{\theparagraph}{\arabic{paragraph}} is of course the easiest way!

\documentclass{article}

\usepackage{chngcntr}
\usepackage{enumitem}

\newlist{paragraphlist}{enumerate}{1}


\setlist[paragraphlist,1]{leftmargin=*,label={\bfseries \arabic*}}

\counterwithin{paragraphlisti}{subsubsection}

\begin{document}

\section{Foo}

\subsection{Foo sub}

\subsubsection{Foo subsub}

\begin{paragraphlist}

\item New Paragraph

\item Other Paragraph
\end{paragraphlist}


\section{Bar}

\subsection{Bar sub}

\subsubsection{Bar subsub}

\begin{paragraphlist}

\item New Paragraph

\item Other Paragraph
\end{paragraphlist}


\end{document}

enter image description here

|improve this answer|||||
1

In the article class the hierarchy of levels is \section -> \subsection -> \subsubsection -> \paragraph. Paragraphs don't get numbers.

In the book class the hierarchy of levels is \chapter -> \section -> \subsection -> \subsubsection -> \paragraph

If you want to use custom numbering for paragraphs, call their values and edit their counters. i .e.

\setcounter{paragraph}{1}
\paragraph{\arabic{paragraph} New Paragraph}
Text here
\stepcounter{paragraph}
\paragraph{\arabic{paragraph} Other Paragraph}
Text here

But this is doing it by force and is not recommended. It misses the purpose of LaTeX.

In your case, try:

\arabic{section} .\arabic{paragraph}

Make sure, that all counters have to correct value.

|improve this answer|||||
  • Since the section counters are increased before the title is typeset, this will eventually print 1.1.1.2 2 New Paragraph and not what you thought, most likely, followed by 1.1.1.4 4 Other Paragraph -- the counter values are wrong here! – user31729 Apr 19 '16 at 20:10
  • @ChristianHupfer Only if you use secnumdepth=4. I tried it with no change to secnumdepth (3) and it gave the correct result. – MaestroGlanz Apr 19 '16 at 20:14
  • Yes, but only because secnumdepth=3 excludes the automatic stepping of the paragraph counter, as can be seen in the definition of \@sect – user31729 Apr 19 '16 at 20:21

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.