1

Using the following code to get oldstyle (arabic) numbers in the headings make the preamble page numbers (in roman) to disappear. Here's a minimal working example:

\documentclass{book}
\usepackage{fancyhdr}
\usepackage{lmodern}
\usepackage{lipsum}
\usepackage{multicol}
\usepackage{textcomp}
\usepackage{pdfpages}

\pagestyle{fancy}
\fancyhead[LE]{\oldstylenums{\thepage}}
\fancyhead[RO]{\oldstylenums{\thepage}}

\begin{document}
\frontmatter
\lipsum
\mainmatter
\lipsum
\end{document}

As you can see, in the frontmatter, there is no pagination on the headings (although there's still pagination at the bottom). Thanks.

3
  • 1
    You need to provide a minimal example. Something very simple like this works for me.
    – TH.
    Dec 15 '10 at 2:04
  • Ok, I'm trying to... But in your example, \oldstylenums is ignored, since computer modern do not support them... Only computer latin. Could it be the reason? Dec 15 '10 at 16:44
  • There... I added one :-) Dec 15 '10 at 17:00
3
\makeatletter
\fancyhead[LE]{\if@mainmatter\oldstylenums{\arabic{page}}\else\thepage\fi}
\fancyhead[RO]{\if@mainmatter\oldstylenums{\arabic{page}}\else\thepage\fi}
\makeatother
3

\thepage gives a roman number in the frontmatter. \oldstylenums doesn't know what to do with it. If you want a number in the header use \fancyhead[LE]{\oldstylenums{\arabic{page}}}.

1
  • Thanks. Is there any way to ignore \oldstylenums if it is a roman numeral? Dec 15 '10 at 19:24
0
\def\isnum#1{%
  \if!\ifnum9<1#1!\else_\fi
    \oldstylenums{#1}\else#1\fi}

\fancyhead[LE]{\isnum{\thepage}}}
\fancyhead[RO]{\isnum{\thepage}}}
1
  • \thepage can also be something like my nice page 12
    – user2478
    Dec 23 '10 at 9:35

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.