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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ContentsEven though the list mention more macros, we only use those we have added correspondinglengths for.Next we need to store the values at the end of the document\AtBeginDocument{\AtEndDocument{\memstorevalue{widestchapter}{\the\widestchapter}\memstorevalue{widestsection}{\the\widestsection}\memstorevalue{widestsubsection}{\the\widestsubsection}}}Here is how to get the standard <strong>class</strong> setup for a three level TOC. We also add a littleextra padding to the boxes. Remember that it may take a few compilations before the ToCsettles down.\newlength\cftnumpad % padding\setlength\cftnumpad{0.5em}\AtBeginDocument{\cftsetindents{chapter}{0pt}{%\RetrieveStoredLength{widestchapter}+\cftnumpad}\cftsetindents{section}{%\cftchapterindent+\cftchapternumwidth}{%\RetrieveStoredLength{widestsection}+\cftnumpad}\cftsetindents{subsection}{%\cftsectionindent+\cftsectionnumwidth}{%\RetrieveStoredLength{widestsubsection}+\cftnumpad}}SNIPLET C.7 (USING CLASS TOOLS TO MAKE A CHAPTER TOC)By using a few hooks, we will be able to create a simple chapter toc. First a few notes:(a) In this <strong>class</strong>, the TOC data can be reused, thus we can load the TOC data as many timesas we would like.(b) Data in the TOC is stored as arguments the \contentsline macro, say (see also Figure9.1 on page 143)\contentsline{chapter}{\chapternumberline {1}Test}{3}where the first argument determins which macro is used to process the data. Each ofthese macros look at the value of the tocdepth counter to know whether to typeset ornot.(c) Using some hooks we can insert local changes to tocdepth in order to only typesetthe sections from the current chapter.405

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

Saved successfully!

Ooh no, something went wrong!