Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Mysterious vertical space in TOC (LaTeX)

331 views
Skip to first unread message

Tom

unread,
Oct 29, 1998, 3:00:00 AM10/29/98
to
I'm making a local article class. In the Table of Contents, I need
to take out the (default) vertical space added around section
entries. I also need to add the line of dots from the section to
the page number of the section.

Here are the changes I made.

\renewcommand*\l@section[2]{%
\ifnum \c@tocdepth >\z@
\addpenalty\@secpenalty
% \addvspace{1.0em \@plus\p@}% %%% Don't need this space
\setlength\@tempdima{1.5em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode %\bfseries
\@dottedtocline{1}{0em}{1.5em}{#1}{#2}%%% Added this line
% \advance\leftskip\@tempdima
% \hskip -\leftskip
% #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\endgroup
\fi}

Suddenly, there's a large amount of vertical space before each section
heading in the TOC. If I comment out the dottedtocline and format the
section header with the three lines following it, then I get the
vertical spacing correct with no line of dots.

Can anyone suggest where the extra vertical space is coming from?

It might also be important (though I don't think it is) that I've
redefined \section as follows:

\renewcommand\section{\if@openright\cleardoublepage\else\clearpage\fi
\global\@topnum\z@%%% prevents floats at top of page
\secdef\@section\@ssection}

\def\@section[#1]#2{\ifnum \c@secnumdepth > \@ne
\refstepcounter{section}%
\addcontentsline{toc}{section}%
{\protect\numberline{\thesection}{\MakeUppercase{#1}}}%
\fi
\if@twocolumn
\@topnewpage[\@makesectionhead{#2}]%
\else
\@makesectionhead{#2}%
\fi}

Wolfgang May

unread,
Oct 29, 1998, 3:00:00 AM10/29/98
to
Tom (tbr...@NOSPAM.arlut.utexas.edu) wrote:
: I'm making a local article class. In the Table of Contents, I need

: to take out the (default) vertical space added around section
: entries. I also need to add the line of dots from the section to
: the page number of the section.

: Here are the changes I made.

: \renewcommand*\l@section[2]{%
: \ifnum \c@tocdepth >\z@
: \addpenalty\@secpenalty
: % \addvspace{1.0em \@plus\p@}% %%% Don't need this space
: \setlength\@tempdima{1.5em}%
: \begingroup
: \parindent \z@ \rightskip \@pnumwidth
: \parfillskip -\@pnumwidth
: \leavevmode %\bfseries
: \@dottedtocline{1}{0em}{1.5em}{#1}{#2}%%% Added this line
: % \advance\leftskip\@tempdima
: % \hskip -\leftskip
: % #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
: \endgroup
: \fi}

: Suddenly, there's a large amount of vertical space before each section
: heading in the TOC. If I comment out the dottedtocline and format the
: section header with the three lines following it, then I get the
: vertical spacing correct with no line of dots.

What is the definition of \dottedtocline ?

We faced a similar problem with a class provided by a publisher
where the problem was in \dottedtocline: it added invisible vspace
although nothing was typeset then.

(in detail, \dottedtocline contained sth of the form

\def\@dottedtocline#1#2#3#4#5{%
% \vskip1pt << must be *inside* the \if; otherwise entries with
% #1>\c@tocdepth produce unwanted \vskip
% (happens for \paragraph{...}) WM 2.10.97
\ifnum #1>\c@tocdepth \else
\vskip1pt % <<< put it here. WM 2.10.97
...}
)

If \dottedtocline is redefined in your class, check how often it is
called.

Wolfgang

-- -----------------------------------------------------------------
Dipl.Inform.Wolfgang May E-mail: m...@informatik.uni-freiburg.de
Universitaet Freiburg http://www.informatik.uni-freiburg.de/~may/
Institut fuer Informatik D-79110 Freiburg / Germany
Lehrstuhl fuer Datenbanken und Informationssysteme


Tom

unread,
Oct 29, 1998, 3:00:00 AM10/29/98
to
Wolfgang May wrote:
>
> What is the definition of \dottedtocline ?
>
> We faced a similar problem with a class provided by a publisher
> where the problem was in \dottedtocline: it added invisible vspace
> although nothing was typeset then.
>
> (in detail, \dottedtocline contained sth of the form
>
> \def\@dottedtocline#1#2#3#4#5{%
> % \vskip1pt << must be *inside* the \if; otherwise entries with
> % #1>\c@tocdepth produce unwanted \vskip
> % (happens for \paragraph{...}) WM 2.10.97
> \ifnum #1>\c@tocdepth \else
> \vskip1pt % <<< put it here. WM 2.10.97
> ...}

Thanks, but that doesn't look like the problem. Of course, I don't
fully understand the code for @dottedtocline in article.cls, but I don't
have this problem with non-section headdings. The extra space is always
over section headings, and some of those sections have subsections,
subsubsections, and paragraphs while others have no
lower level sectioning commands.

In article.cls, the little vskip is properly placed inside of the \else.

\def\@dottedtocline#1#2#3#4#5{%
\ifnum #1>\c@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
\leaders\hbox{$\m@th
\mkern \@dotsep mu\hbox{.}\mkern \@dotsep
mu$}\hfill
\nobreak
\hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor #5}%
\par}%
\fi}

Tom

unread,
Oct 30, 1998, 3:00:00 AM10/30/98
to
Stefan Ulrich wrote:
>
> Tom <tbr...@NOSPAM.arlut.utexas.edu> writes:
> Umm, why not just try:
>
> \renewcommand*\l@section[2]{\@dottedtocline{1}{0em}{1.5em}{#1}{#2}}
>
> if you don't want bold or larger font for the titles anyway?

Nope. I tried it, but it didn't take care of the problem.
It still looks like

CONTENTS

1. INTRODUCTION................ 3
\___ Basically, I'd like this
/ extra space to vanish.
2. PRELIMINARIES............... 5
\___ This too.
/
3. SECTION..................... 7
3.1 Subsection............... 7
3.1.1 Subsubsection...... 8
3.1.2 Subsubsection...... 8
3.2 Subsection............... 9


4. CONCLUSION..................10

I'm pretty sure the problem is in something @dottedtocline is doing.
Maybe I'll try redefining @dottedtocline to isolate the offending
command.

Tom

unread,
Nov 2, 1998, 3:00:00 AM11/2/98
to
Stefan Ulrich wrote:
>
> Tom <tbr...@NOSPAM.arlut.utexas.edu> writes:
>
> > It still looks like
> >
> > CONTENTS
> >
> > 1. INTRODUCTION................ 3
> > \___ Basically, I'd like this
> > / extra space to vanish.
> > 2. PRELIMINARIES............... 5
> > \___ This too.
> > /
> > 3. SECTION..................... 7

Actually, I was wrong. Using

\renewcommand*\l@section[2]{\@dottedtocline{1}{0em}{1.5em}{#1}{#2}}

does work. It looks like I had (at some point) put two identical
\renewcommand*\l@section macros in the document! :-O When I tried,
your suggestion, I changed the first one, and it was being redefined.

Anyway, I think I also found the piece of my code that causes the
vertical space. When I comment out the \leavemode line, everything
looks fine. Now I'd just like to figure out how

\leavemode
{\@dottedtocline...}

causes vertical space to appear.

Donald Arseneau

unread,
Nov 4, 1998, 3:00:00 AM11/4/98
to
In article <363DF8...@NOSPAM.arlut.utexas.edu>, Tom <tbr...@NOSPAM.arlut.utexas.edu> writes...

>looks fine. Now I'd just like to figure out how
>
>\leavemode
>{\@dottedtocline...}
>
>causes vertical space to appear.

That's simple: your "vertical space" is actually an empty line of text.

\leavevmode starts a paragraph
\@dottedtocline begins with a (small) vskip, which ends the paragraph.

To see what is happening, try

\leavemode
{\@dottedtocline...}
\leavemode
{\@dottedtocline...}
\leavemode Ooops!
{\@dottedtocline...}

Donald Arseneau as...@triumf.ca

0 new messages