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.

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.

share|improve this question

2 Answers 2

up vote 12 down vote accepted

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.

share|improve this answer
1  
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
2  
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

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

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.