I need the \paragraph{xxx} command outputs "§ 1 xxx" but the \section{Abc} outputs just "Abc", no numbering. Any help? Thanks.

  • Should the sectional units associated to \subsection and \subsubsection be numbered or not? – Gonzalo Medina Dec 17 '11 at 3:43
  • 1
    Both titlesec package and memoir class might be helpful, see their (excellent) documentation. – mbork Dec 17 '11 at 3:45
  • the \section and \subsection must not be numbered, neither in the body not in the ToC. I'm using the memoir package indeed, but I can't figure how to manage that. If I set \maxsecnumdepth{paragraph}, then, how can I prevent the \section, \subsection and \subsubsection heading from show their numbers (in both the body and the ToC)? – marlonob Dec 18 '11 at 19:36

Normally \paragraph is defined using \@startsection which uses the counter secnumdepth to decide whether to number the unit. For example, in article.cls you can find

    \renewcommand\thesubparagraph {\theparagraph.\@arabic\c@subparagraph}


                                {3.25ex \@plus1ex \@minus.2ex}%

The first command numbers paragraphs as Section.Para, the second sets the formatting of the paragraphs.

You can patch these commands, for example

\setcounter{secnumdepth}{0}         % Now sections are not numbered
\renewcommand\theparagraph{\arabic{paragraph}} % delete the section num from \theparagraph
   \refstepcounter{paragraph}%   Manually stepping paragraph counter without consulting secnumdepth
     {3.25ex \@plus1ex \@minus.2ex}%
     {\normalfont\normalsize\bfseries\S~\theparagraph\space}} % Formatting the paragraph

\section{First section}
\paragraph{First paragraph} Second
  • Thanks! It seems that this will do the trick. But, will this show the paragraph number in the table of contents? It is not necesary, but would be very practical. Again, the section and subsection numbers must not be shown in the ToC. – marlonob Dec 18 '11 at 18:22
  • Try, for example, \renewcommand*\l@paragraph{\@dottedtocline{0}{7.0em}{4.1em}}. The first zero here tells TOC to put the paragraph sections into TOC on the 0 level – Boris Dec 18 '11 at 21:41
  • Thanks @Boris! I finally get what I wanted: The \section and \subsection must appear in the ToC without number but the \paragraph must be numerated, so I use \setcounter{secnumdepth}{0}. I got this with a little addition to the code you suggested, so now it looks like this. – marlonob Dec 19 '11 at 2:51
  • \makeatletter \renewcommand*\l@paragraph{\@dottedtocline{0}{7.0em}{4.1em}}% Include paragraph as 0 level in ToC \newcommand\Paragraph{% with capital “P” for distinction \refstepcounter{paragraph}% Manually stepping paragraph counter without consulting secnumdepth \@startsection{paragraph}{4}{\z@}% {1.5ex \@plus1ex \@minus.2ex}% {-1em}% {\normalfont\normalsize\sffamily[\bfseries\S~\thechapter.\theparagraph\mdseries]\bfseries\space} } % Formatting the paragraph \renewcommand\paragraph[1]{% \Paragraph[\S~\thechapter.\theparagraph\space~#1][#1]{#1} } \makeatother – marlonob Dec 19 '11 at 2:52
  • Well, I can't include the proper format in the previous comment (this is my first time :) but I expect to be understandable. I know it doesn't seem a clean solution, so if anyone can figure out something better it would be great. Thanks guys, you're awsome. – marlonob Dec 19 '11 at 3:03

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.