# How can I add a prefix to *only* a particular section-level's numbering

I would like to (preferably without additional packages) be able to add a prefix before all section numbers, but not to subsection or subsubsection numbers. In other words, I want the section numbering to look like: "Prefix 1", "1.1", "1.2", "Prefix 2", "2.1", "2.2", etc.

It would be a nice bonus if I don't need to respecify all of the default settings for the section, and can just specify the prefix text.

The prefix can be added by redefining \thesection.

\renewcommand*{\thesection}{Prefix~\arabic{section}}
% \thesubsection might use \thesection, therefore it is also redefined
\renewcommand*{\thesubsection}{\arabic{section}.\arabic{subsection}}


Then the prefix is also be present in references of the section.

• I had tried using \thesection before (unsucessfully), but didn't think to redefine \thesubsection. I guess there isn't a good way to do this without redefining (and thus requiring knowledge of the previous \thesubsection definition) ? – Mark Aug 23 '12 at 18:44
• Without assumptions on the definition text of \thesubsection there is not an easy way. Also other counters could be defined using \thesection, but this is usually not done. – Heiko Oberdiek Aug 23 '12 at 18:55
• Sadly, this solution does not work well with \tableofcontents. Here, "Prefix X" is usually too large, so that the end of this string overlaps with the beginning of the actual heading. I have seen a fix for this, but I simply cannot find it anmore... any ideas? – Prof.Chaos Jul 30 '18 at 18:10

I'll add a second answer, which shows how to do it to make the prefix show in Section title, but not in the references. Just put this code into the document header. We suppose titlesec or other similar packages are not in use, since titlesec has its own standard way how to achieve this:

\makeatletter
\def\section{\@startsection{section}{1}{\z@ }%
{-3.5ex\@plus -1ex\@minus -.2ex}{2.3ex \@plus .2ex}%
{\noindent\normalfont \Large \bfseries Prefix\ }%
}
\makeatother