# XeLaTeX Section related page/figure numbering

Is there any good method to get section related page and figure numbering which also allows a consistant TOC/TOF?

I am using the article class to write a technical manual.

Section 1, Page numbering shall start with 1-1, 1-2 and so on. Section 2, 2-1, 2-2 etc. Same for figures.

I found a lot of references to the chappg package but it doesn't seems to fit the requirements. on}

Update: Code example modified based on David's help.

\documentclass[12pt]{article} % use larger type; default would be 10pt
\usepackage{fontspec} % Font selection for XeLaTeX; see fontspec.pdf for documentation
\defaultfontfeatures{Mapping=tex-text} % to support TeX conventions like ---''
\usepackage{xunicode} % Unicode support for LaTeX character names (accents, European chars, etc)
\usepackage{xltxtra} % Extra customizations for XeLaTeX
\usepackage{lipsum}% for dummy text of 150 paragraphs
%*******************************HEADER LAYOUT*******************************
\usepackage{fancyhdr}
%Rewriting thepage to show section related numbering
\renewcommand\thepage{\thesection--\arabic{page}}
\rfoot{\thepage}
%*******************************SECTION OPTIONS*******************************
%Begin each section with a new page & reset numbering on each section.
\usepackage{titlesec}
\newcommand{\sectionbreak}{\clearpage\setcounter{page}{1}}
\begin{document}
\section{Getting started}
\subsection{Subsection}
\lipsum
\section{Operational Principles}
\subsection{Subsection}
\lipsum[1]
\subsubsection{Subsubsection}
\lipsum[1]
\paragraph{Paragraph}
\lipsum
\section{Forms}
\subsection{Subsection}
\lipsum[1-50]
\subsubsection{Subsubsection}
\lipsum[1]
\paragraph{Paragraph}
\lipsum
\end{document}

-
Do your sections start a new page? (article class sections by default do not) – David Carlisle Jun 11 '13 at 8:41
Yes I got some code in my doc for this. – Bax Jun 11 '13 at 8:53

## 1 Answer

Well this is why questions should always include a complete small document that shows the problem.

For the page number case you need to modify the code that forces a page break to add \setcounter{page}{1} I can't show exactly where as it depends on your local code.

Then add

\renewcommand\thepage{\thesection--\arabic{page}}


For figures you can use

\renewcommand\thefigure{\thesection--\arabic{figure}}
\makeatletter
\@addtoreset {figure}{section}
\makeatletter


In the example you added, the page break is coming too late, the section counter has already been incremented so the last page of each section is wrong.

titlesec doesn't seem to help much in this case (but I left it in in case your real example uses more of the package features) it is simpler just to add the \clearpage directly to \section:

\usepackage{titlesec}
\let\oldsection\section
\renewcommand{\section}{\clearpage\setcounter{page}{1}\oldsection}

-
Added a small example what I am doing above. Very close to the solution, but still does some strange numbering. Section 1: 1-1 then 2-2, Section 2: 2-1, 2-2 which is fine, but then 3-3. Section 3 looks good. – Bax Jun 11 '13 at 20:45
@Bax see updated answer – David Carlisle Jun 11 '13 at 21:06