Page Layout ⇒ custom page numbers?
custom page numbers?
I could get this in my footer by customizing the footer with secnum-pagenum, and resetting the page number counter for each section, but the TOC wouldn't be correct. (I'm assuming this as I haven't actually tried it). Anyone out there know how to get the pagenumbers to appear like this in both the footer and the TOC?
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
Re: custom page numbers?
PREAMBLE
\usepackage{fancyhdr}
DOCUMENT
\pagestyle{fancy}
\fancyfoot[C]{\thesection-\thepage}
but you will have to reset the page counter each section with
\setcounter{page}{1}
custom page numbers?
Sorry if I wasn't clear. I can get the footer to show correctly by doing exactly what you have suggested. The problem that I have is the Table of Contents. In the TOC only the page # is shown, so with 17 sections I have 17 different page # 1's. I want the TOC to show the page number to be 1-1, or 17-1 according to which section it is.mtnbkr wrote: Anyone out there know how to get the pagenumbers to appear like this in both the footer and the TOC?
Thanks for the reply. Anyone else out there have a suggestion?
Re: custom page numbers?
I have been searching a solution for a while, but....no idea, maybe it would be possible by modifiying a command using the titlesec or titletoc packages, but I have no idea at the moment...I guess the fancyhdr package can´t achieve to solve this problem...
custom page numbers?
Code: Select all
\documentclass[english]{article}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{blindtext}
\makeatletter
\@addtoreset{page}{section}
\def\@stpelt#1{\global\csname c@#1\endcsname\expandafter\ifx\csname c@#1\endcsname\c@page\@ne\else\z@\fi}
\def\thepage{\thesection--\@arabic\c@page}
\makeatother
\begin{document}
\tableofcontents
\Blinddocument
\Blinddocument
\end{document}
A similar hack is
Code: Select all
\makeatletter
\@addtoreset{page}{section}
\def\thepage{\thesection--\number\numexpr\c@page+1\relax}
\makeatother