Generalmodifying section numbering

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
ivanwest
Posts: 10
Joined: Fri Jul 11, 2008 1:04 am

modifying section numbering

Post by ivanwest »

Hi all,
A quick question. I want to be able to change the section numbering so that a word is included with the counter, eg

[1. This is a heading]
[2. This is another heading]

I want to be able to do this

[Annex 1. This is the heading I want]
[Annex 2. Like this would be great]

I also need this new section to be included in the toc

Thanks for any help.

Cheers

Ivan :D

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

modifying section numbering

Post by Stefan Kottwitz »

Hi Ivan,

the titlesec package provides an interface for the customization of sectioning commands. See it's documentation. To adjust the toc entries you could use titletoc or tocloft.

Here is one example that implements the mentioned features:

Code: Select all

\documentclass[a4paper,10pt]{article}
\usepackage{titlesec,titletoc}
\titleformat{\section}{\normalfont\Large\bfseries}
  {Annex \thesection.}{1em}{}
\titlecontents{section}[0em]{\bfseries}{Annex \thecontentslabel.\space}{\hspace*{-2.3em}}
  {\space\titlerule*[0.5pc]{.}\contentspage}
\begin{document}
\tableofcontents
\bigskip
\section{Introduction}
Text
\section{Test}
More Text
\end{document}
Stefan
LaTeX.org admin
Post Reply