Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
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? –  Hugo S Ferreira Dec 15 '10 at 16:44
    
There... I added one :-) –  Hugo S Ferreira Dec 15 '10 at 17:00

3 Answers 3

up vote 3 down vote accepted
\makeatletter
\fancyhead[LE]{\if@mainmatter\oldstylenums{\arabic{page}}\else\thepage\fi}
\fancyhead[RO]{\if@mainmatter\oldstylenums{\arabic{page}}\else\thepage\fi}
\makeatother
share|improve this answer

\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}}}.

share|improve this answer
    
Thanks. Is there any way to ignore \oldstylenums if it is a roman numeral? –  Hugo S Ferreira Dec 15 '10 at 19:24
\def\isnum#1{%
  \if!\ifnum9<1#1!\else_\fi
    \oldstylenums{#1}\else#1\fi}

\fancyhead[LE]{\isnum{\thepage}}}
\fancyhead[RO]{\isnum{\thepage}}}
share|improve this answer
    
\thepage can also be something like my nice page 12 –  Herbert Dec 23 '10 at 9:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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