From the memoir
user manual (p 158):
About upper or lower casing TOC entries
Some designs call for upper (or lower casing) TOC entries. This is possible but the solution depends on whether the hyperref
package is used or not.
Without hyperref one can simply end the \cftKfont
with say \MakeTextUppercase
and the K
-type entry will be upper cased.
With hyperref
the possibilities are limited. Explanation: The upper/lower casing macros are not that robust, and need the content to be simple - for some definition of simple. When hyperref
is used, the hyperlink is wrapped around the entry before \cftKfont
gains access to it, and is thus generally too complicated for, say, \MakeTextUppercase
to handle. The following
workaround draws inspiration from hyperref
breaks my all-caps ToC entries:
\settocpreprocessor{<type>}{<code>}
Here <type>
is one of chapter
, part
or book
. If needed we will attempt to add a similar feature to the rest of the sectional types, please write the maintainer. And <code>
can be something like this:
\makeatletter
\settocpreprocessor{chapter}{%
\let\tempf@rtoc\f@rtoc%
\def\f@rtoc{%
\texorpdfstring{\MakeTextUppercase{\tempf@rtoc}}{\tempf@rtoc}}%
}
\makeatother
Where \f@rtoc
is a placeholder inside \chapter
, \part
and \book
, holding the material to be written to the actual TOC file before hyperref
accesses it. This way the upper casing is sneaked into the TOC file, and the bookmark part of hyperref
will not complain about the \MakeTextUppercase
in the data. Of course, you will not have upper cased titles in the bookmark list.
With the above in mind, you can use
\documentclass{memoir}
\makeatletter
\settocpreprocessor{chapter}{%
\let\temp@f@rtoc\f@rtoc
\def\f@rtoc{\texorpdfstring{\MakeTextLowercase{\temp@f@rtoc}}{\temp@f@rtoc}}
}
\makeatother
\renewcommand{\cftchapterfont}{\normalfont\scshape}% Formatting the \chapter ToC entries
\usepackage{hyperref}
\begin{document}
\tableofcontents*
\chapter{First}
\chapter{Second}
\end{document}
\MakeLowercase
is not expandable... sohyperref
goes mad about this ;-)memoir
manual