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.

I'm trying to modify the font size of my page numbers in footers, but running into problems with the chapter page when using an epigraph. Here is my MWE:

\documentclass[12pt,oneside]{book}
\usepackage{epigraph, fancyhdr}

\newcommand{\changefont}{\fontsize{10}{11}\selectfont}

% clear plain page style
\fancypagestyle{plain}{
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[C]{\changefont \thepage}
}

\pagestyle{fancy}

\fancyhf{}
\fancyhead[LE]{\changefont \slshape \rightmark}
\fancyhead[RO]{\changefont \slshape \leftmark}
\fancyfoot[C]{\changefont \thepage}

\renewcommand{\chaptermark}[1]{%
\markboth{\chaptername
\ \thechapter.\ #1}{}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\frontmatter{}

\fancyhead[LE,RO]{\changefont \slshape Acknowledgements}
\fancyfoot[C]{\changefont \thepage}
\chapter*{Acknowledgements}

\epigraphhead[70]{\epigraph{The isolated man does not develop any intellectual power. It is necessary for him to be immersed in an environment\ldots}{Alan Turing}}

Acknowledgements go here.

\end{document}

I've tried changing the epigraph pagestyle with the modified footer, using

\fancypagestyle{epigraph}{\fancyfoot[C]{\changefont \thepage}}

but this removes my epigraph. Any ideas?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

The correct way to modify the size of the page number in the footer is by redefining the \epigraphhead macro, which sets the page-style for that page (in which \epigraphhead[...]{...} is provided) using \ps@epigraph command. This can't be done using \fancypagestyle{epigraph}{\fancyfoot[C]{\changefont \thepage}}, as this removes the epigraph itself. The position and placement of epigraph is handled by this macro along with the pagestyle definition.

The right way is to add the macro just before \begin{document}:

\makeatletter
\renewcommand{\epigraphhead}[2][95]{%
  \def\@epitemp{\begin{minipage}{\epigraphwidth}#2\end{minipage}}
  \def\ps@epigraph{\let\@mkboth\@gobbletwo
    \@epipos
    \if@epirhs
      \def\@oddhead{\hfil\begin{picture}(0,0)
                         \put(0,-#1){\makebox(0,0)[r]{\@epitemp}}
                         \end{picture}}
    \else
      \if@epicenter
        \def\@oddhead{\hfil\begin{picture}(0,0)
                           \put(0,-#1){\makebox(0,0)[b]{\@epitemp}}
                           \end{picture}\hfil}
      \else
        \def\@oddhead{\begin{picture}(0,0)
                           \put(0,-#1){\makebox(0,0)[l]{\@epitemp}}
                           \end{picture}\hfil}
      \fi
    \fi
    \let\@evenhead\@oddhead
    \def\@oddfoot{\reset@font\hfil\changefont\thepage\hfil}
    \let\@evenfoot\@oddfoot}
  \thispagestyle{epigraph}}
\makeatother

Note: I have added \changefont to the definition of \@oddfoot.


There is also a \reset@font command provided in the \@oddfoot macro. We can also change the font size by setting \changefont to \reset@font without the above provided tweak. I think this will not be a good idea, since \reset@font work as \normalfont in core macros.

\makeatletter
\let\reset@font\changefont
\makeatother
share|improve this answer
    
Excellent! This worked perfectly. –  Kyle Niemeyer Jul 26 '13 at 16:59
    
@Jagath AR: is there a simple way to just have the "normal" page style (as without the \epigraphhead command)? –  Dan Nov 25 '13 at 20: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.