4

I'm using the memoir documentclass, and I would like to have roman page numbering, in the front matter, in italic. Does anyone know how to do it or can reference me something to read?

P.S. I am looking just for italicising the roman page numbering of the preface and not for patching multiple things (I'd like to add only what I understand, and since I am a newby, I understand just a little)

3
  • 1
    Which page style are you using? Jul 20, 2013 at 21:47
  • 2
    Welcome to TeX.SX! Please make your code compilable, starting with \documentclass{...} and ending with \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to help you. Help them help you: remove that one hurdle between you and a solution to your problem.
    – egreg
    Jul 20, 2013 at 22:34
  • @Gonzalo I'm using the article oneside
    – Atcold
    Jul 21, 2013 at 2:36

2 Answers 2

5

A simple way to make this happen is to redefine \thepage with \textit{...} command inside \frontmatter and reset to upright after \mainmatter command. See below example:

\documentclass{memoir}

\usepackage{lipsum}

\begin{document}

\frontmatter
%% Making italic page number in frontmatter
\def\thepage{\textit{\roman{page}}}

\chapter{Preface}
\lipsum

\mainmatter
%% Making upright page number in mainmatter
\def\thepage{\arabic{page}}

\chapter{One}
\lipsum
\end{document}
1
  • Actually, it has been even easier. I just needed to add \def\thepage{\textit{\roman{page}}} right after the \frontmatter. That is all I wanted. Thank you indeed.
    – Atcold
    Jul 25, 2013 at 21:45
6

One way is to use the new macro \ThePage in the page style definitions. In the \frontmatter part, it expands to \textit{\thepage}, after \mainmatter it expands to \thepage.

Example file:

\documentclass{memoir}

\newcommand*{\FrontMatterThePageFont}[1]{\textit{#1}}
\newcommand*{\MainMatterThePageFont}[1]{#1}
\newcommand*{\ThePage}{%
  \MainMatterThePageFont{\thepage}%
}

\makeatletter

% \frontmatter
\addtodef*{\@memfront}{}{%
  \pagenumbering{Roman}%
  \renewcommand*{\ThePage}{%
    \FrontMatterThePageFont{\thepage}%
  }%
}

% \mainmatter
\addtodef*{\@memmain}{}{%
  \renewcommand*{\ThePage}{%
    \MainMatterThePageFont{\thepage}%
  }%
}
\makeatother

\makeevenfoot{plain}{}{\ThePage}{}
\makeoddfoot{plain}{}{\ThePage}{}
\makeevenhead{simple}{\ThePage}{}{}
\makeoddhead{simple}{}{}{\ThePage}
\makeevenhead{headings}{\ThePage}{}{\slshape\leftmark}
\makeoddhead{headings}{\slshape\rightmark}{}{\ThePage}
\makeevenhead{myheadings}{\ThePage}{}{\slshape\leftmark}
\makeoddhead{myheadings}{\slshape\rightmark}{}{\ThePage}
\makeevenfoot{ruled}{\ThePage}{}{}
\makeoddfoot{ruled}{}{}{\ThePage}
\makeevenfoot{Ruled}{\ThePage}{}{}
\makeoddfoot{Ruled}{}{}{\ThePage}
% ...

\usepackage{lipsum}

\begin{document}
\frontmatter
\chapter{Introduction}
\newpage
\lipsum[1]
\mainmatter
\chapter{Experiments}
\newpage
\lipsum[2]
\end{document}

Remarks:

  • I have patched \@memfront and \@memmain instead of \frontmatter and \mainmatter. because of the star forms that class memoir provides (the star forms do not change the page numbering).

  • I have added a list that changes \thepage to \ThePage for some predefined page styles. In your own page style definitions, just use \ThePage instead of \thepage.

1
  • Ehm.. Thank you, but.. isn't there an easier solution? I mean, I was simply looking for having the number italised.. and not patching LaTeX.. Can I use just part of your code? It's quite complicated, and therefore I cannot tell if it is possible to extract just what I need (the italicised part). Could you help?
    – Atcold
    Jul 25, 2013 at 2:27

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.