5

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?

6
  • 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 Apr 19, 2016 at 19:34
  • 3
    having said that, \renewcommand\theparagraph{\arabic{paragraph}} will get rid of all the prefixed numbers Apr 19, 2016 at 19:41
  • I think the OP just wants to suppress the unwanted numbers, but uses the hierarchy in the usual way. Apr 19, 2016 at 19:54
  • 1
    Isn't this the same problem? Apr 19, 2016 at 20:53
  • @AlexNelson: Yup. Apr 20, 2016 at 8:25

2 Answers 2

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

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.

3
  • 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, 2016 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. Apr 19, 2016 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, 2016 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.