Hi all,

Somebody (besides me) was asking how to vertically condense your table of 
contents, eliminating the huge spacing that the TOC defaults to.

The following code was placed between \preamble and \endpreamble in my layout 
file to achieve a much more compact TOC:

\renewcommand\tableofcontents{%
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{\contentsname
        \@mkboth{%
           \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
    {
      \small\setlength{\parskip}{2pt}\setstretch{0.8}%
      \@starttoc{toc}%
    }
    \if@restonecol\twocolumn\fi
    }

Many of you will notice that this code is stolen from the standard book.cls. 
My only addition was to put curly braces around @starttoc{toc}, and within 
those braces to make it small, 2point parskip instead of 10 point or whatever 
it was, and to make the line spacing 0.8 instead of the default single. The 
short linespacing is so there isn't more space between lines of a wrapped 
entry than between the entries themselves.

Because what I described is all enclosed in curly brackets, its effect 
extends only within those curly brackets, which means it effects only typeset 
created by \@starttoc{toc}. Note that the use of \setstretch requires a 
previous \usepackage{setspace}.

I figured this out by diff'ing tex files created by lyx files with and 
without a table of contents, and with and without 0.8 spacing, and then 
grep'ping for files containing a definition or redefinition of 
\tableofcontents{}. Book.cls was the most generic file defining 
\tableofcontents{}, so I started with its code.

Steve

-- 
Steve Litt
Webmaster, Troubleshooters.Com
http://www.troubleshooters.com
[EMAIL PROTECTED]
(Legal Disclaimer) Follow these suggestions at your own risk.




Reply via email to