[OS X TeX] Suppress SOME page numbers in toc?

Morten Høgholm morten.hoegholm at gmail.com
Thu Sep 13 16:03:48 EDT 2007


On Thu, 13 Sep 2007 04:34:58 +0200, david craig wrote:

>
> Emergency question:
>
> article class.  I would like the appendices listed in the toc but the  
> page NUMBERS for appendices (only) suppressed in the table of contents.
>
> I need my appendices to have section numbers, so I can't use \section*  
> and \contentsline.   I've been googling around for an hour and can't  
> find anything that will quite do what I want.


The command for setting a section level entry in the toc is called  
\l at section. If your appendices contain only sections then the following  
works:

\documentclass{article}

\makeatletter
\newcommand\removepagenumbers{%
    \expandafter\renewcommand\expandafter\l at section
    \expandafter[\expandafter2\expandafter]\expandafter{\l at section{##1}{}}%
}
\makeatother
\begin{document}

\tableofcontents

\section{Main}  Text. \clearpage

\section{Main}  Text. \clearpage

\section{Main}  Text. \clearpage

\section{Main}  Text. \clearpage

\appendix

\addtocontents{toc}{\protect\removepagenumbers}

\section{Appendix}  Text. \clearpage

\end{document}



-- 
Morten

------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/





More information about the MacOSX-TeX mailing list