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.

How can I control look of the page numbers? For example, in the MWE below:

\documentclass[12pt]{article}
\usepackage[backend=biber]{biblatex}
\usepackage{fancyhdr}
\usepackage[top=2.54cm,bottom=2.54cm,left=3.81cm,right=2.54cm]{geometry}
\usepackage{setspace}
\doublespacing
\pagenumbering{roman}
\setcounter{page}{11}

\begin{document}
\begin{flushright}
    \begin{singlespace}
        John Doe \\
        March 2012 \\
        Department of Computer Science \\
    \end{singlespace}
\end{flushright}
\begin{center}
    Some Generic Title \\
\bigskip
    \textbf{\underline{Abstract}}
\end{center}
\vspace{-13pt}
Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah
Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah
Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah.

Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah
Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah
Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah.

Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah
Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah
Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah.

\end{document}}

I would like to have the page number look like:

-xi-

instead of:

xi

share|improve this question
1  
You could also use \usepackage[margin=1in,left=1.5in]{geometry}, since 1in=2.54cm. –  Werner Jan 5 '12 at 6:55
    
Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. –  doncherry Jan 5 '12 at 18:06
1  
Also, note that this is by no means an MWE (Minimal Working Example), have a look at meta.tex.stackexchange.com/questions/228/…. For your problem, an MWE might look like: \documentclass{article} \usepackage{fancyhdr} \usepackage[top=2.54cm,bottom=2.54cm,left=3.81cm,right=2.54cm]{geometry} \pagenumbering{roman} \setcounter{page}{11} \begin{document} Foo. \end{document} –  doncherry Jan 5 '12 at 18:07

1 Answer 1

up vote 11 down vote accepted

In your example, replace (loaded before geometry)

\usepackage{fancyhdr}

with (loaded after geometry)

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyfoot[C]{--~\thepage~--}

\fancyfoot[C]{--~\thepage~--} ("C" stands for "centered") will change the formatting of the page number in the footer as desired. (\pagestyle{fancy} is simply necessary to activate the features of the fancyhdr package; loading fancyhdr after geometry is needed to make fancyhdr recognize the margin changes effected by geometry.)

Note that redefining \thepage itself by, e.g., writing

\renewcommand*{\thepage}{--~\roman{page}~--}

is a bad idea because this will also affect the page number format in, e.g., cross-references.

\documentclass[12pt]{article}
% \usepackage[backend=biber]{biblatex}
\usepackage[top=2.54cm,bottom=2.54cm,left=3.81cm,right=2.54cm]{geometry}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyfoot[C]{--~\thepage~--}
\usepackage{setspace}
\doublespacing
\pagenumbering{roman}
\setcounter{page}{11}

\begin{document}
\begin{flushright}
    \begin{singlespace}
        John Doe \\
        March 2012 \\
        Department of Computer Science \\
    \end{singlespace}
\end{flushright}
\begin{center}
    Some Generic Title \\
\bigskip
    \textbf{\underline{Abstract}}
\end{center}
\vspace{-13pt}
Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah
Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah
Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah.

Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah
Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah
Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah.

Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah
Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah
Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah.

\end{document}
share|improve this answer
    
You may need to remove the header rule using \renewcommand{\headrulewidth}{0pt}. –  Werner Jan 5 '12 at 6:52
    
Werner - you are the genius! –  Bob Alexander Jan 5 '12 at 6:55

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.