Sign up ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
    
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

1 Answer 1

up vote 7 down vote accepted

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}

and

    \newcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
                                {3.25ex \@plus1ex \@minus.2ex}%
                                {-1em}%
                                {\normalfont\normalsize\bfseries}}

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

You can patch these commands, for example

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

\begin{document}
\section{First section}
\paragraph{First paragraph} Second
\end{document}
share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.
http://tex.stackexchange.com/questions/38567/how-do-i-get-the-paragraphs-enumerated-but-not-the-sections?answertab=oldest
tex.stackexchange.com
crawl=CC-MAIN-2015-48
78578
application/http; msgtype=response
sha1:CD43M36ZT7LL6DL4CCDEPV5EWXHUPC27
<urn:uuid:e4b8b6d1-9310-4657-845b-1639a3b42f2a>
2015-11-26T05:16:18Z
104.16.117.182
sha1:4FJUFFLVVNDMG3NNFRKR2XCCERZYQNTW
<urn:uuid:dcfa6b8a-7738-4b36-b3cf-8802909eb58b>
http://tex.stackexchange.com/questions/38567/how-do-i-get-the-paragraphs-enumerated-but-not-the-sections?answertab=oldest
response
<urn:uuid:f1eeac2b-d9b3-4e2d-a5bf-0944a0ad7bbe>
robots: classic
hostname: ip-10-71-132-137.ec2.internal
software: Nutch 1.6 (CC)/CC WarcExport 1.0
isPartOf: CC-MAIN-2015-48
operator: CommonCrawl Admin
description: Wide crawl of the web for Nov 2015
publisher: CommonCrawl
format: WARC File Format 1.0
conformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf