Take the 2-minute tour ×
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.

Is there any difference between \paragraph{} and \paragraph*{}?

When it's used (if nothing has been modified before, i.e. like in this post: Paragraph header), there's no difference in the created PDF file.

Normally, the * is used to prevent LaTeX to count/number the related object (paragraph here). But here, there's no count/numbering at all for both of them, thus... What's the change, if there is any at all?

share|improve this question
11  
Try to set \setcounter{secnumdepth}{5} and then you can see the difference. –  Guido Nov 6 '12 at 20:46
    
Indeed, there counted. Still. You had to "modify" something to have it (and it's not pretty to look, unless it's use has "subsubsub" section). Thanks for the tip. –  Julien Nov 7 '12 at 0:46
add comment

1 Answer

up vote 9 down vote accepted

Like with all sectioning commands from \section and lower (in the standard document classes), they are defined in terms of \@startsection, which allows for a starred variant. Taken from latex.ltx (with emphasis/comments added):

\def\@startsection#1#2#3#4#5#6{%
  \if@noskipsec \leavevmode \fi
  \par
  \@tempskipa #4\relax
  \@afterindenttrue
  \ifdim \@tempskipa <\z@
    \@tempskipa -\@tempskipa \@afterindentfalse
  \fi
  \if@nobreak
    \everypar{}%
  \else
    \addpenalty\@secpenalty\addvspace\@tempskipa
  \fi
  \@ifstar%  <------------------------------------------ Condition on *
    {\@ssect{#3}{#4}{#5}{#6}}%  <----------------------- starred-version
    {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}}%  <----- regular/non-starred version

The difference only becomes noticeable when looking at the inner workings of \@ssect and \@sect - the choices after conditioning on * - the former associated with the starred-version. The main differences include:

  • Numbering, based on the value of the counter secnumdepth. For \paragraph, this is 4. Setting secnumdepth to anything higher than or equal to 4 would reveal the difference;

  • Inclusion in the ToC. Regardless of the value of tocdepth - the counter deciding which sectional units to include in the ToC, the entry is written to the .toc file. Only upon reading the .toc file is it decided to include the entry or not, based on the value of tocdepth.

  • The running heads is triggered by \paragraphmark (when calling \paragraph{..}), initially set to \@gobble. So, without any modifications, this just gobbles its argument - the "paragraph title" and changes nothing in the heading. However, a suitable definition of \paragraphmark would show a different effect when using \paragraph as opposed to \paragraph* where no \paragraphmark is called.

share|improve this answer
    
Thanks. Is there a way to "reveal" the ToC inclusion ? And what about the Running headers ? –  Julien Nov 7 '12 at 0:52
2  
the toc includes section levels down to the tocdepth counter so as for numbering you just have to set tocdepth to 4 or above. The running heads from this level would be set by \paragraphmark, but by default this is \@gobble so it doesn't affect the heading. –  David Carlisle Nov 7 '12 at 1:58
add comment

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.