I'm writing my thesis and I'm trying to insert a special symbol in section numbers. I have the following code in my .sty file:

\renewcommand*\thesection{\S \arabic{section}}

This correctly inserts the character \S before section numbers. However I don't want the symbol to show up in other counters related to the section counter. For example, I have the following line to number theorems:


For theorem 5 of section 4, this outputsenter image description here I would like to remove the special symbol. How do I do that ? Do I have to redefine all of the counters I want to modify? Thanks in advance.

1 Answer 1


There is a known trick for this kind of things, which involves the internal command \@seccntformat


  \ifcsname format#1\endcsname
    \csname format#1\endcsname
    \csname the#1\endcsname

\newcommand{\formatsection}{\S\ \thesection}




This is theorem 1.1, isn't it?


The idea is that defining a command \formatsection will override the standard output in sectional titles of the \section level. You can define additional commands for other levels, if so wished. If you don't define, say, \formatsubsection, just the number will be printed.

enter image description here

  • Thanks it works great! I would also like to remove the chapter number and keep all other counters, that is I would like my counters to be of the form section.theorem, not chapter.section.theorem. How do I do that?
    – fresh
    Feb 9, 2021 at 16:42
  • @fresh \renewcommand{\thetheorem}{\arabic{section}.\arabic{theorem} should do. Or just \renewcommand{\thesection}{arabic{section}}, if you only want § 1 for the section number next to the title.
    – egreg
    Feb 9, 2021 at 17:17
  • \renewcommand{\thesection}{\arabic{section}} worked for me. Thank you very much!
    – fresh
    Feb 9, 2021 at 21:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .