12.07.2015 Views

The memoir class - The UK TeX Archive

The memoir class - The UK TeX Archive

The memoir class - The UK TeX Archive

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

9.2. <strong>The</strong> <strong>class</strong> ToC methods\renewcommand*{\cftsectionfont}{%\let\oldnl\numberline% save definition of \numberline\renewcommand*{\numberline}[1]{}% change it\oldcftsf}% use original \cftsectionfont\renewcommand*{\cftsectionafterpnum}{%\let\numberline\oldnl% % restore orginal \numberline\oldcftspn}% use original \cftsectionafterpnumProbing a little deeper, the \numberline macro is called to typeset section numbersand is defined as:\renewcommand*{\numberline}[1]{%\hb@xt@\@tempdima{\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb}Each kind of heading \lets the \@cftbsnum macro to \cftKpresnum, andthe \@cftasnum macro to \cftKaftersnum, and the \@cftasnumb macro to\cftKaftersnumb as appropriate for the heading. <strong>The</strong> second method for killing thenumber uses a <strong>TeX</strong> method for defining a macro with a delimited argument.\def\cftsectionpresnum #1\@cftasnum{}<strong>The</strong> interpretation of this is left as an exercise for anyone who might be interested.9.2.4 Example: Multicolumn entriesIf the subsection entries, say, in the ToC are going to be very short it might be worth settingthem in multiple columns. Here is one way of doing that which depends on using themulticol package [Mit98]. This assumes that subsections will be the lowest heading in theToC.\newcounter{toccols}\setcounter{toccols}{3}\newenvironment{mysection}[1]{%\section{#1}%\addtocontents{toc}{\protect\begin{multicols}{\value{toccols}}}}%{\addtocontents{toc}{\protect\end{multocols}}}<strong>The</strong> counter toccols controls the number of columns to be used. For each sectionwhere you want subsections to be typeset in multiple columns in the ToC, use themysection environment instead of \section, like:\begin{mysection}{Columns}...\subsection{Fat}...\subsection{Thin}...\end{mysection}Any ToC entries generated from within the environment will be enclosed in amulticols environment in the ToC. <strong>The</strong> \protects have to be used because environment\begin and \end commands are fragile.9.2.5 Example: Multiple contentsIt is easy to have two ToCs, one short and one long, when they are of the same style, likethis:159

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!