4

I am creating a document framework for my mini-dissertation.

The document will consist of multiple chapters. In each chapter the page numbering will start at 1. This is achieved by using setcounter{page}{1} after every new \chapter{}.

In the footer I display the current chapter and page by using \fancyfoot[RO,RE]{\thechapter.\thepage}. Displaying 1.2 for chapter 1, page 2 for example.

How can I achieve the same numbering format in my table of content, list of figures and list of tables?

  • Welcome to TeX.SX! Are you saying that you want the table of contents, list of figures and list of tables to be numbered chapters? – karlkoeller Feb 7 '14 at 19:20
  • I want every item in the list of figures to be specified by its chapter and page number. – blaffie Feb 7 '14 at 19:24
  • Sorry, I don't understand. If you have Figure 2.1 and Figure 2.2 (where the first number is the chapter and the second the progressive one) at page 15, you would have both this items in the LoF as 2.15 Figure Caption? – karlkoeller Feb 7 '14 at 19:31
  • The figure caption is fine in the LoF. Both figures should then be specified as being on page 2.15. i.e: Figure 2.1: Caption ........ 2.15 \\ Figure 2.2: Caption ........ 2.15 – blaffie Feb 7 '14 at 19:41
  • Now I understand... – karlkoeller Feb 7 '14 at 19:49
6

To achieve what you want you can simply patch the command \addcontentsline to print \thechapter.\thepage instead of \thepage. That is, add the following code in your preamble:

\usepackage{etoolbox}
\patchcmd{\addcontentsline}
  {\thepage}
  {\thechapter.\thepage}
  {}
  {}

MWE

\documentclass{book}

\usepackage{etoolbox}
\patchcmd{\addcontentsline}
  {\thepage}
  {\thechapter.\thepage}
  {}
  {}

\begin{document}

\tableofcontents

\chapter{1st}
\begin{figure}[h]
  \caption{foo figure}
\end{figure}
\begin{table}[h]
  \caption{foo table}
\end{table}

\chapter{2nd}
\begin{figure}[h]
  \caption{another foo figure}
\end{figure}
\begin{table}[h]
  \caption{another foo table}
\end{table}

\listoffigures
\listoftables

\end{document} 

Output (ToC)

enter image description here

Output (LoF)

enter image description here

  • @cmhughes Remember to do it! :-) – karlkoeller Feb 7 '14 at 19:58
1

All references to pages use \thepage (including those used in the ToC/LoF/LoT), so you need only update that in order to achieve the appropriate page labelling:

\renewcommand{\thepage}{\thechapter.\arabic{page}}

Here is a minimal example that incorporates the above as part of \mainmatter (allowing you to set a different page numbering scheme for \frontmatter and perhaps \backmatter), as well as automatically setting the page counter to 1 at the start of every \chapter:

enter image description here

\documentclass{book}

\usepackage{etoolbox,lipsum}% http://ctan.org/pkg/{etoolbox,lipsum}

\makeatletter
\g@addto@macro{\mainmatter}{%
  % Adjust the way the page numbers are displayed
  \renewcommand{\thepage}{\thechapter.\arabic{page}}%
  % Reset the page counter to 1 at the start of \chapter
  % \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
  \patchcmd{\chapter}{\fi}{\fi\setcounter{page}{1}}{}{}%
  }
\makeatother

\begin{document}

\frontmatter
\tableofcontents
\listoffigures
\listoftables

\mainmatter
\chapter{1st}
\lipsum% Some text.
\begin{figure}[ht] \caption{foo figure} \end{figure}
\lipsum[1-50]% Some text.
\begin{table}[ht] \caption{foo table} \end{table}
\lipsum[1-50]% Some text.

\chapter{2nd}
\lipsum% Some text.
\begin{figure}[ht] \caption{another foo figure} \end{figure}
\lipsum[1-50]% Some text.
\begin{table}[ht] \caption{another foo table} \end{table}
\lipsum[1-50]% Some text.

\end{document} 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.