GeneralProblem with Alphanumeric Page Numbering

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
hollett
Posts: 2
Joined: Mon Apr 21, 2008 4:46 pm

Problem with Alphanumeric Page Numbering

Post by hollett »

Hello all. I really need some help. Is there a way to get a string to print before each page number? For example:
D-1
D-2
D-3
In this example, "D-" preceeds each page number. Similar examples might be "Page - 1", "Page - 2", etc. I have searched many, many sites and am losing hope! :cry: Please help a newbie!

Thanks!

Recommended reading 2024:

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

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

User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Problem with Alphanumeric Page Numbering

Post by gmedina »

You can redefine the \thepage command, as the following example suggestes:

Code: Select all

\documentclass{article}
\usepackage{lipsum}

\begin{document}

\renewcommand\thepage{D-\arabic{page}}
\lipsum[1-15]

\end{document}
The lipsum package was loaded only to automatically generate some text.

Perhaps the chappg package could be useful too.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
hollett
Posts: 2
Joined: Mon Apr 21, 2008 4:46 pm

Re: Problem with Alphanumeric Page Numbering

Post by hollett »

Thanks! That works perfectly! Also, if you want to change the string and numbering in each section, just repeat the renewcommand with the new string, adding setcounter to set the page counter back to 1 (or whatever you want it to be).

For Example:

\documentclass{article}
\usepackage{lipsum}

\begin{document}

\renewcommand\thepage{D-\arabic{page}}
\lipsum[1-15]

\newpage

\renewcommand\thepage{E-\arabic{page}}
\setcounter{page}{1}
\lipsum[1-15]

\end{document}

The result looks like this:
D-1
D-2
D-3
E-1
E-2
E-3
Post Reply