# Automatic Section Title & Section Title Before Section Number

I'm trying to do 3 things:

1. Repeat a section title automatically for each section (e.g., "Chapter").
2. Place the section title before the section number (e.g., "Chapter 1" and NOT "1 Chapter").
3. Make each section number 2 digits long (e.g., "Chapter 01" and NOT "Chapter 1").

I've been able to find how to do each of these 3 things individually but not altogether.

• Which document class are you using? When you say "section", what exactly do you mean; i.e., a sectional unit created through \chapter, \section? – Gonzalo Medina Mar 23 '14 at 17:52
• "Chapter" was probably a bad example. My LaTeX file is actually an "article" listing equations, and I want each section to be labelled "Equation 01", "Equation 02", etc. – MMS Mar 24 '14 at 21:03

1. The standard book and report document classes give you \chapter which does what you need by default.

2. The standard book and report document classes give you \chapter which does what you need by default.

3. You can use the kernel's \two@digits.

The code:

\documentclass{book}

\makeatletter
\renewcommand\thechapter{\two@digits{\value{chapter}}}
\makeatother

\begin{document}

\chapter{Test chapter}

\end{document}


In case what you are trying to achieve is a running title, use titlesec to change the formatting from display to block:

\documentclass{book}
\usepackage{titlesec}

\makeatletter
\renewcommand\thechapter{\two@digits{\value{chapter}}}
\makeatother
\titleformat{\chapter}[block]
{\normalfont\huge\bfseries}
{\chaptertitlename\ \thechapter}
{1em}
{}

\begin{document}

\chapter{Test chapter}

\end{document}