TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use \titleformat (titlesec package) to make some fancy headings in my documents. But I did not find a way to know, in the \titleformat specifications, if the section is made with a \section or a \section*.

Is there a way to detect that and make some test on it ?

What I want (a minimal example):

\titleformat{\section}[block]{first}{label}{0pt}{\ifsectionstar{#1}{\bf #1}}[trailer]
share|improve this question
Have you looked at section 3.8 of the manual? – egreg Mar 12 '13 at 14:20
thanks, I did not see it right before ! – Xoff Mar 12 '13 at 14:30
up vote 4 down vote accepted

You can define the titleformat for starred versions with the numberless key, i.e, like

\titleformat{\section}[block]           {first}{label}{0pt}{\textbf{#1}}[trailer] % all versions
\titleformat{\section}[block,numberless]{first}{label}{0pt}{#1}[trailer] % starred version
share|improve this answer

To format \section* use the numberless setting in the extended syntax for the first argument:



Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua.
share|improve this answer

Your Answer


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.