[texhax] Tables of contents
Lars Madsen
daleif at imf.au.dk
Wed Jun 20 10:10:46 CEST 2012
Ivan Griffin wrote, On 2012-06-19 22:24:
>
>
> Hi,
>
> Depends on what your base document class is and what additional support
> packages you are using (for example, memoir or koma-script).
>
> I'm not sure if there is a really easy way of doing it (like a dedicated
> package or an option to a package or other), but you can do it
> relatively easily by some macro redefinitions.
>
> If vanilla LaTeX classes like book, or report, you could try something
> like the following crude example - note you don't need to redefine
> \l at chapter for article.cls as it doesn't define it so we check if its
> defined first before trying to redefine it...
>
in memoir it is relatively easy, one can switch off page numbers for
each different entry type
>
> \documentclass{book} % or article, or report
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> %
> % Begin redefinitions to remove page numbers from TOC
> % \makeatletter
>
> % remove page numbers from \part
> \let\oldl at part=\l at part
> \renewcommand*{\l at part}[2]
> {
> \oldl at part{#1}{ }
> }
>
> % remove page numbers from \chapter for book.cls and report.cls
> \@ifundefined{l at chapter}
> {
> % undefined so nothing to do
> }
> {
> % \l at chapter only defined in book.cls and report.cls
> \let\oldl at chapter=\l at chapter
> \renewcommand*{\l at chapter}[2]
> {
> \oldl at chapter{#1}{ }
> }
> }
>
> % remove page numbers from \section for article.cls
> \let\oldl at section=\l at section
> \renewcommand*{\l at section}[2]
> {
> \oldl at section{#1}{ }
> }
>
> % remove dots and page numbers for all document classes (*.cls)
> \renewcommand{\@dottedtocline}[5]
> {
> \ifnum #1>\c at tocdepth \else
> \vskip \z@ \@plus.2\p@
> {\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip
> \parindent #2\relax\@afterindenttrue
> \interlinepenalty\@M
> \leavevmode
> \@tempdima #3\relax
> \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
> {#4}\nobreak
> % removed the dotting until the page number (#5) from here
> \par
> \fi}
> }
> \makeatother
>
> %
> % End redefinitions
> %
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
>
> \begin{document}
>
> \tableofcontents
>
> \chapter{Foobar} % Obviously remove if changing the doc class to article
>
> \section{Foo}
>
> \subsection{Foo}
>
> \section{Foo}
>
> \subsection{Foo}
>
> \subsection{Foo}
>
>
>
> \end{document}
>
>
> Hope this helps,
> Ivan.
>
>
>
> On Mon, 18 Jun 2012, T. Michael Sommers wrote:
>
>> Is there a relatively easy way to create a table of contents that does
>> not have page numbers? That is, I just want a table of the sections
>> and subsections, etc.
>>
>> --
>> T.M. Sommers -- tmsommers2 at gmail.com -- ab2sb
>> _______________________________________________
>> TeX FAQ: http://www.tex.ac.uk/faq
>> Mailing list archives: http://tug.org/pipermail/texhax/
>> More links: http://tug.org/begin.html
>>
>> Automated subscription management: http://tug.org/mailman/listinfo/texhax
>> Human mailing list managers: postmaster at tug.org
>>
>>
> _______________________________________________
> TeX FAQ: http://www.tex.ac.uk/faq
> Mailing list archives: http://tug.org/pipermail/texhax/
> More links: http://tug.org/begin.html
>
> Automated subscription management: http://tug.org/mailman/listinfo/texhax
> Human mailing list managers: postmaster at tug.org
--
/daleif
More information about the texhax
mailing list