9

When I wrote the code below gave the following error:

! LaTeX Error: Command \footruleskip already defined.
               Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.302 ...and{\footruleskip}{.3\normalbaselineskip}

I want to configure the fancyhdr on memoir.

\documentclass[a4paper]{memoir}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[brazil]{babel}
\usepackage{lipsum}

% fancyhdr on memoir
\usepackage{fancyhdr}
\pagestyle{fancy}

\fancyhead{}
  \renewcommand{\chaptermark}[1]{\markboth{\thechapter.\space#1}{}}
  \renewcommand{\sectionmark}[1]{\markright{\thesection\space#1}}
  \fancyhead[LE]{\bfseries\leftmark}
  \fancyhead[RO]{\bfseries\rightmark}
  \fancyfoot{}
  \fancyfoot[LO,RE]{R\'egis \the\year}
  \fancyfoot[LE,RO]{\bfseries\thepage}
  \renewcommand{\headrulewidth}{0.5pt}
  \renewcommand{\footrulewidth}{0.5pt}
\fancypagestyle{plain}{
  \fancyhead{}
  \renewcommand{\headrulewidth}{0pt}
}

\begin{document}
\pagestyle{fancy}

\chapter{Fancyhdr on Memoir}

\lipsum

\end{document}
1
  • 1
    Since the memoir class has its own mechanism for headers and footers, there is no need to use the fancyhdr package. Just check out Section 7.3 of the class manual. – Thorsten Donig Dec 11 '11 at 11:25
20

memoir defined the command \footruleskip as

\newcommand{\footruleskip}{0.3\normalbaselineskip}

while fancyhdr does the same

\newcommand{\footruleskip}{.3\normalbaselineskip}

(something done since May 7, 1996 with version 1.99 of fancyhdr - a change from a former length \footruleskip to the current control sequence). The good thing is that they're both the same. So, undefining it before loading fancyhdr works:

%...
\let\footruleskip\undefined
\usepackage{fancyhdr}% http://ctan.org/pkg/fancyhdr
%...

Here \undefined is an undefined control sequence that might just as well have been \bleepbloopblah (...as long as that is undefined as well!). See, for example How to undo a \def (i.e., Need a \undef capability) and undefining custom commands.

Although this is your choice, memoir as a solid document class provides ample page header style modifications, and is therefore on the same footing as fancyhdr. Therefore, you may find some conflicting support if using fancyhdr instead of memoir header/footer functionality. Read up on what memoir is capable of in chapter 7 Pagination and headers (p 117) of the memoir documentation. In fact, the documentation mentions (in section 7.2 Page styles, p 118):

These facilities were inspired by the fancyhdr package [..], although the command set is different.

1
  • Plus in memoir the headers and footers a much more integrated, than fancyhdr will ever be. For example the \chapter title pages make use of a build in style called chapter (an alias for plain) and can easily be changed into something else, independently of what plain does – daleif Dec 11 '11 at 15:24

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.