1

I want a certain layout for the heading and footer for a document I'm writing using Memoir documentclass. The problem is that the entire document follows the defined heading and footer, except the TOC.

The image below shows the desired heading for even and odd pages of the body of the document.

Body headings

This image shows the current heading for the table of contents, which is not consistent with the desired layout.

TOC heading

The MWE code is attached below:

\documentclass[letterpaper,12pt,openany,final]{memoir}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[top=4cm,right=2.5cm,left=4cm, bottom=2.5cm]{geometry}
\usepackage{setspace}
  \DisemulatePackage{setspace}
 \linespread{1.1}
 \usepackage[sc]{mathpazo} %Fuente
 \renewcommand\familydefault{\rmdefault}
 \usepackage[protrusion=true,expansion=true]{microtype}  %Alineado óptico
\usepackage[activeacute,spanish] {babel}
\setlength{\footmarksep}{-1.8em}
\setlength{\footmarkwidth}{1.8em}
\setlength{\footmarksep}{0em}
%%=================%%
%%Header and footer%%
%%=================%%
\makepagestyle{TOC}
\makepsmarks{TOC}{%
  \createmark{chapter}{left}{nonumber}{}{}
   \createmark{section}{right}{nonumber}{}{}

  }
\makeevenhead{TOC}{}{}{\bfseries \leftmark}
\makeoddhead{TOC}{}{}{\bfseries \rightmark}
\makeevenfoot{TOC}{}{\thepage}{}
\makeoddfoot{TOC}{}{\thepage}{}
\makefootrule{TOC}{\textwidth}{0.5pt}{0pt}
\makeheadrule{TOC}{\textwidth}{0.5pt}
%%=================%%
%%=================%%
\begin{document}
\setlength{\evensidemargin}{\oddsidemargin}
\setlength{\footskip}{30pt}
\tableofcontents{\pagestyle{TOC}}
\chapter{Lorem Ipsum}
\section{Lorem Ipsum}
\subsection{Lorem Ipsum}
\section{Lorem Ipsum}
\section{Lorem Ipsum}
\subsection{Lorem Ipsum}
\chapter{Lorem Ipsum}
\section{Lorem Ipsum}
\subsection{Lorem Ipsum}
\subsection{Lorem Ipsum}
\section{Lorem Ipsum}
\section{Lorem Ipsum}
\subsection{Lorem Ipsum}
\section{Lorem Ipsum}
\subsection{Lorem Ipsum}
\section{Lorem Ipsum}
\chapter{Lorem Ipsum}
\section{Lorem Ipsum}
\section{Lorem Ipsum}
\section{Lorem Ipsum}
\subsection{Lorem Ipsum}
\subsection{Lorem Ipsum}
\subsection{Lorem Ipsum}
\chapter{Lorem Ipsum}
\section{Lorem Ipsum}
\section{Lorem Ipsum}
\section{Lorem Ipsum}
\section{Lorem Ipsum}
\chapter{Lorem Ipsum}
\section{Lorem Ipsum}
\section{Lorem Ipsum}
\section{Lorem Ipsum}
\chapter{Lorem Ipsum}
\section{Lorem Ipsum}
\section{Lorem Ipsum}
\subsection{Lorem Ipsum}
\section{Lorem Ipsum}
\chapter{Lorem Ipsum}
\section{Lorem Ipsum}
\section{Lorem Ipsum}
\section{Lorem Ipsum}
\chapter{Lorem Ipsum}
\section{Lorem Ipsum}
\section{Lorem Ipsum}
\subsection{Lorem Ipsum}
\subsection{Lorem Ipsum}
\section{Lorem Ipsum}
\chapter{Lorem Ipsum}
\section{Lorem Ipsum}
\chapter{Lorem Ipsum}
\section{Lorem Ipsum}
\chapter{Lorem Ipsum}
\section{Lorem Ipsum}
\chapter{Lorem Ipsum}
\subsection{Lorem Ipsum}
\subsection{Lorem Ipsum}
\section{Lorem Ipsum}
\chapter{Lorem Ipsum}
\section{Lorem Ipsum}
\section{Lorem Ipsum}
\subsection{Lorem Ipsum}
\subsection{Lorem Ipsum}
\section{Lorem Ipsum}
\chapter{Lorem Ipsum}
\section{Lorem Ipsum}
\chapter{Lorem Ipsum}
\section{Lorem Ipsum}
\chapter{Lorem Ipsum}
\section{Lorem Ipsum}
\chapter{Lorem Ipsum}
\subsection{Lorem Ipsum}
\subsection{Lorem Ipsum}
\section{Lorem Ipsum}
\end{document}

Is there anyway to make the TOC follow the heading definitions?

Thanks in advance.

  • 1
    As far as I remember, even with all of memoir's enhancements, the only 'argument' \tableofcontents might take is an '*'. Change this line of yours, \tableofcontents{\pagestyle{TOC}}, into these two: \pagestyle{TOC} \tableofcontents. That should do the trick. – jon Oct 17 '14 at 3:26
1

The MWE makes testing the solution easy (which is always nice). If you change the line that reads

\tableofcontents{\pagestyle{TOC}}

into

\pagestyle{TOC} 
\tableofcontents

the output should be as expected. Note that in the memoir class you have two \tableofcontents commands:

\tableofcontents  % <-- adds its respective title to the Table of Contents
\tableofcontents* % <-- does not do so; this mimics the behaviour of the standard classes

The same holds true for the \listoffigures(*) and \listoftables(*) commands.

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.