3

I have been using the table and longtable commands quite a lot for my thesis, and I've observed they reproduce different spaces in the list of tables. Here is the MWE:

\documentclass[reqno,12pt,oneside]{report} % right-side equation numbering, 12 point font, print one-sided 

\usepackage{csm}        
\usepackage{amsmath}
\usepackage{tabu}
\usepackage{longtable}
\usepackage{booktabs, multicol, multirow}
\usepackage{setspace}    % Allows you to specify the line spacing
\onehalfspacing           % \onehalfspacing for 1.5 spacing, \doublespacing for 2.0 spacing.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}


% Table of contents, list of figures, etc.
\tableofcontents     % Required
\listoftables        % Required if there is more than one table

\startthechapters

\chapter{Examples of using table option}
Here are tables produced by table and tabular commands. 
\begin{table}[!h]
\centering
\caption{Tabular table}
\vspace{1em}
    \begin{tabular}{ | l | l | l | p{5cm} |}
    \hline
    Day & Min Temp & Max Temp & Summary \\ \hline
    Monday & 11C & 22C & A clear day with lots of sunshine.  
    However, the strong breeze will bring down the temperatures. \\ \hline
    Tuesday & 9C & 19C & Cloudy with rain, across many northern regions. Clear spells
    across most of Scotland and Northern Ireland,
    but rain reaching the far northwest. \\ \hline
    Wednesday & 10C & 21C & Rain will still linger for the morning.
    Conditions will improve by early afternoon and continue
    throughout the evening. \\
    \hline
    \end{tabular}
\end{table}

\begin{table}[!h]
\centering
\caption{Colored rows}
\vspace{10pt}
\begin{tabular}{lll}
odd     & odd   & odd \\
even    & even  & even\\
odd     & odd   & odd \\
even    & even  & even\\
\end{tabular}
\end{table}

\chapter{Examples of using longtable option}

\begin{longtabu}{ll}
\caption{Longtabu table} \\ 
Longtable & Longtable \\
Longtable & Longtable \\
Longtable & Longtable \\
Longtable & Longtable \\
Longtable & Longtable \\
\end{longtabu}

\begin{longtable}{ll}
\caption{Longtable example} \\ 
\toprule
Longtable & Longtable \\
Longtable & Longtable \\
Longtable & Longtable \\
Longtable & Longtable \\
Longtable & Longtable \\
\end{longtable}

\begin{table}[!h]
\centering
\caption{Here again tabular environment}
\vspace{10pt}
\begin{tabular}{lll}
odd     & odd   & odd \\
even    & even  & even\\
odd     & odd   & odd \\
even    & even  & even\\
\end{tabular}
\end{table}
 W
Look at the list of tables. When the longtable or longtabu commands are used, they create the less space between the entries. It is desirable for me to have spaces as in the \textbf{table environment}. 
\end{document}

The style I'm using is the Rackham style modified for my school's requirement. It is called the 'csm' style, so the file should be saved as 'csm.sty'.

Below I'm posting the 'csm.sty' file itself.

% This is an option style (substyle) for writing a dissertation
% in the Rackham required format using reportx.sty.  -- jin ji, 1/88
% Modified on 05/19/88, jj.
% Modified on 12/13/88, for "CHAPTER" in toc and \@makecaption, jj.
% Modified on 01/08/89, for sections in loa (look for \@sect), jj.
% Modified on 89/11/29  by tex
%          Removed the last three lines of file which consisted of
%          <blank line>
%          % Get something else
%          \input indent
% Modified on 07/24/1992 by Roque D. Oliveira.
%          \startappendices was modified to work
%          with the New Font Selection Scheme.
%          Further (similar) changes may be needed for other macros.
% Modified Sep. 2008 by Jason Gilbert: Obsolete code removed or updated to 
%          better conform to LaTeX2e, list of abbreviations added, 
%          made copyright page cleaner, fixed Appendices, Bibliography, 
%          margins, title page, frontispiece, bottom-center page numbers,
%          two-side printing, added in-dissertation abstract and abstract
%          that prints separately at the end.

\typeout{  }
\typeout{Substyle `rac' for Rackham dissertation.}
\typeout{  }

%-- Page styles --

\def\ps@chappage{% The first page of each chapter has bottom-center page numbers -jj.
 \def\@oddhead{}
 \def\@oddfoot{\hfil \rm \thepage \hfil}
 \let\@evenhead\@oddhead 
 \let\@evenfoot\@oddfoot
}

\def\ps@plain{%
% \def\@oddhead{\hfil \rm \thepage \hfil} % These two lines of code make top-center page numbers on other pages -jg
% \def\@oddfoot{}
 \def\@oddhead{} % These two lines of code make bottom-center page numbers on other pages -jg
 \def\@oddfoot{\hfil \rm \thepage \hfil}
 \let\@evenhead\@oddhead 
 \let\@evenfoot\@oddfoot
}

%-- Margins --
\if@twoside \oddsidemargin 0.5in \evensidemargin 0in \marginparwidth .6in \textheight=8.95in
\else \oddsidemargin 0.5in \marginparwidth .9in \textheight=9.0in\fi% left margin=1in + oddsidemargin, marginparwidth: text box for margin notes
\topmargin -0.65in \headheight 0.35in \headsep 0.35in \footskip 0.5in % header and footer margins
\textwidth=6.0in % width of the text body on a page
% The top margin = 1in plus vspace. For some reason, need to subtract 0.35in also. -jg
\def\vertadjust{\vspace{-0.35in}} % Required for proper vertical spacing. -jg
\def\twoinmar{\vertadjust\vspace{0.25in}} % Two inch top margin -jg
\def\twohalfinmar{\vertadjust\vspace{1.5in}} % Two and a half inch top margin -jg


%-- Front pages --

% jj: This \ttlpg is the same as \titlepage in report.sty.
\def\ttlpg{\@restonecolfalse \if@twocolumn \@restonecoltrue \onecolumn
 \else \newpage \fi \thispagestyle{empty} \c@page \z@}

\def\titlepage#1#2{
 \ttlpg
 \begin{singlespace}
 \hbox{ }
 \twohalfinmar
 \begin{center}
 \begin{onehalfspacing} % For the `Large' font size, this will look single spaced. -jg
\vspace{2in}  
  {\Large\MakeUppercase{#1} \mbox{}} \\
 \end{onehalfspacing}
  \vfill
  by \\
  \vspace{2ex} % ex is the height of the lowercase 'x' for the current font. -jg
  #2 \\

 \end{center}

 \end{singlespace}
}

\def\initializefrontsections{

 \setcounter{page}{1}   % -- begins with "ii"
 \pagestyle{chappage}   % -- numbers at bottom
 \renewcommand{\thepage}{\roman{page}}   % roman numeral
}

\def\frontispiece{
 \ttlpg
 \hbox{ }
 \if@twoside \clearpage\hbox{}\thispagestyle{empty} \fi
 \twoinmar
}


%-- Table of contents and lists --

\def\dotfill{\leaders\hbox{$\m@th \mkern \@dotsep mu.\mkern \@dotsep mu$}\hfill}
\def\producetableofcontents{\tableofcontents}
\def\producelistoffigures{\listoffigures}
\def\producelistoftables{\listoftables}
\def\producelistofmaps{\listofmaps}
\def\producelistofappendices{\listofappendices}
\def\producelistofabbreviations{\listofabbreviations}

% jj: The only difference is \dotfill instead of \hfil.
\def\l@chapter#1#2{\pagebreak[3]
 \vskip 1.0em plus 1pt \@tempdima 1.5em \begingroup % em is the width of capital M for the current font.
 \parindent \z@ \rightskip \@pnumwidth
 \parfillskip -\@pnumwidth
 {\leavevmode #1}\dotfill \hbox to\@pnumwidth{\hss #2}\par
 \endgroup
}

\def\l@chap{\@dottedtocline{1}{1.0em}{1.5em}}
\def\l@section{\@dottedtocline{2}{2.5em}{3.0em}}
\def\l@subsection{\@dottedtocline{3}{5.5em}{3.0em}}
\def\l@subsubsection{\@dottedtocline{4}{8.5em}{3.0em}}

\setcounter{tocdepth}{3} % Number of section layers to show in TOC (i.e. section, subsection, subsubsection)
\setcounter{secnumdepth}{3} % Number of subsection layers to allow in document

\def\l@figure{\@dottedtocline{1}{1.0em}{3.5em}}
\let\l@table\l@figure
\let\l@map\l@figure
\let\l@anything\l@figure
\def\l@appendix{\@dottedtocline{1}{1.0em}{2.5em}}
\let\l@abbreviation\l@figure

\def\tableofcontents{%
 \newpage
 \@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn\fi
 \hbox{ }
 \twoinmar
 \centerline{\large\bf TABLE OF CONTENTS}
 \vspace{0.25in}
 \begin{onehalfspace}
  \@starttoc{toc}\if@restonecol\twocolumn\fi
 \end{onehalfspace} 
}

\def\listoffigures{%
 \newpage
 \addcontentsline{toc}{chapter}{LIST OF FIGURES}
 \@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn\fi
 \hbox{ }
 \twoinmar
 \centerline{\large\bf LIST OF FIGURES}
 \vspace{0.25in}
 \begin{singlespace}
  \@starttoc{lof}\if@restonecol\twocolumn\fi
  \addtocontents{lof}{\noindent\underline{\bf Figure}\hfill\rm\protect\newline}
 \end{singlespace}
}

\def\listoftables{%
 \newpage
 \addcontentsline{toc}{chapter}{LIST OF TABLES}
 \@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn\fi
 \hbox{ }
 \twoinmar
 \centerline{\large\bf LIST OF TABLES}
 \vspace{0.25in}
 \begin{singlespace}
  \@starttoc{lot}\if@restonecol\twocolumn\fi
  \addtocontents{lot}{\noindent\underline{\bf Table}\hfill\rm\protect\newline}
 \end{singlespace}
}

%-- Start chapters --

\def\thechapter {\@arabic\c@chapter}
\def\thesection {\@arabic\c@chapter.\@arabic\c@section}
\def\thefigure {\@arabic\c@chapter.\@arabic\c@figure}
\def\thetable {\@arabic\c@chapter.\@arabic\c@table}
\def\theequation {\@arabic\c@chapter.\@arabic\c@equation}

\newcounter{map}[chapter]
\def\themap{\@arabic\c@chapter.\@arabic\c@map}
\def\fps@map{tbp}
\def\ftype@map{1}
\def\ext@map{lom}
\def\fnum@map{Map \themap}
\def\map{\@float{map}}
\let\endmap\end@float
\@namedef{map*}{\@dblfloat{map}}
\@namedef{endmap*}{\end@dblfloat}

\def\startthechapters{%
 \def\@chapapp{CHAPTER}
 \addtocontents{toc}{\protect\mbox{ }\protect\newline\noindent{CHAPTER}\protect\newline}
 \addtocontents{toc}{\hbox{ }}
 \clearpage % This has to be before the rest.
 \if@twoside \ifodd\c@page \else \ttlpg \hbox{ }\fi\fi % For two-sided printing, make sure Chapter I starts on right-hand page. jg
 \clearpage
 \setcounter{chapter}{0}
 \setcounter{page}{1} % -- ...always begin with ii.
 \renewcommand{\thepage}{\arabic{page}}
 \pagestyle{plain}
 \def\tocname{toc}
}

\def\@chapter[#1]#2{%
 \ifnum \c@secnumdepth >\m@ne
  \refstepcounter{chapter}
  \typeout{\@chapapp\space\thechapter.}
  \addtocontents{toc}{\hbox{ }}
  \addcontentsline{toc}{chap}{\protect\numberline{\hbox{ }\hfill\thechapter.\hspace{5pt}}{\MakeUppercase{#1}}}
  \addtocontents{toc}{\hbox{ }}
 \else
  \addtocontents{toc}{\hbox{ }}
  \addcontentsline{toc}{chap}{#1}
  \addtocontents{toc}{\hbox{ }}
 \fi
 \if@twocolumn \@topnewpage[\@makechapterhead{#2}]
 \else \@makechapterhead{#2} \@afterheading \fi
}

\def\@makechapterhead#1{%
 \hbox{ }
 \twoinmar
 {\parindent 0pt \raggedright
  \ifnum \c@secnumdepth >\m@ne
  \centerline{\large\bf \@chapapp{} \thechapter} \par
  \vskip 0in \fi
  \begin{center}
   \centerline{\MakeUppercase{\large\bf #1}}
   %\large\bf #1
  \end{center}
  \nobreak
 }
 \@afterindenttrue
}

\def\section{\@startsection{section}{1}{\z@}{3.25ex plus 1ex minus
 .2ex}{2.3ex plus .2ex}{\normalsize\bf}}
\def\subsection{\@startsection{subsection}{2}{\z@}{3.25ex plus 1ex minus
 .2ex}{1.3ex plus .2ex}{\normalsize\bf}}
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{3.25ex plus
 1ex minus .2ex}{1.3ex plus .2ex}{\normalsize\bf}}

\long\def\@caption#1[#2]#3{%
 \addtocontents{\csname ext@#1\endcsname}{\hbox{ }}
 \addcontentsline{\csname ext@#1\endcsname}{#1}{\protect\numberline{\csname
  the#1\endcsname}{\ignorespaces\protect\small\protect\normalsize\rm #2}}
 \par
 \begingroup
  \@parboxrestore
  \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces\protect\small\normalsize\rm #3}
  \par
 \endgroup
}

\long\def\@makecaption#1#2{
 \vskip 10pt
 \setbox\@tempboxa\hbox{#1: #2}
 \ifdim \wd\@tempboxa >\hsize
  \setbox\@tempboxa\hbox{#1: }
  \def\@tempdimj{\hsize}
  \advance\@tempdimj -\wd\@tempboxa
  \hbox to\hsize{#1: \parbox[t]{\@tempdimj}{#2}}
 \else \hbox to\hsize{\hfill\box\@tempboxa\hfill}
 \fi}

%-- Appendices and bibliography --

\def\startappendices{\par
 \def\thechapter {\Alph{chapter}}
 \def\theappendix{\Alph{chapter}}
 \def\thesection{\theappendix.\arabic{section}}
 \def\theequation{{\rm \theappendix}.\arabic{equation}}
 \def\thefigure{{\rm \theappendix}.\@arabic\c@figure}
 \def\thetable{{\rm \theappendix}.\@arabic\c@table}
 \def\themap{{\rm \theappendix}.\@arabic\c@map}

 \setcounter{chapter}{0}
 \setcounter{section}{0}
 \def\@chapapp{APPENDIX}
 \pagestyle{plain}
 \clearpage
 \hbox{}
 \if@twoside \ifodd\c@page \else\thispagestyle{empty} \clearpage\hbox{}\fi\fi
 \thispagestyle{chappage}
 \addcontentsline{toc}{chapter}{APPENDIX}
 \hbox{ }
 \vertadjust
 \vfill
 \centerline{\large\bf APPENDICES} % The half title page
 \vfill
}

So my question is: why are there different spaces in the list of tables as shown in the following figure? list of tables

I appreciate your help.

1
  • unrelated to the question but don't use [!h] or [h] it is a request to take all tables to the end of the document. LaTeX normally issues a warning and changes this to [!ht] to give itself a chance of positioning the table but it is better to always include p as well if you must use the optional argument. so [!htp] or better still don't use this optional argument. Jan 26, 2014 at 0:59

2 Answers 2

3

The inconsistency is due to the way your .sty files typesets table entries in the LoT; this can be fixed by redefining \LT@c@aption (internal command from longtable) to use the same settings (basically, to place a void box to add spacing (arghhh!)):

\makeatletter
\def\LT@c@ption#1[#2]#3{%
  \LT@makecaption#1\fnum@table{#3}%
  \def\@tempa{#2}%
  \ifx\@tempa\@empty\else
     {\let\\\space
      \addtocontents{lot}{\protect\hbox{ }}
       \addcontentsline{lot}{table}{\protect\numberline{\thetable}{\ignorespaces\protect\small\protect\normalsize\rm #2}}}%
  \fi}
\makeatother

The complete code: \documentclass[reqno,12pt,oneside]{report} % right-side equation numbering, 12 point font, print one-sided

\usepackage{csm}        
\usepackage{amsmath}
\usepackage{tabu}
\usepackage{longtable}
\usepackage{booktabs, multicol, multirow}
\usepackage{setspace}    % Allows you to specify the line spacing
\onehalfspacing           % \onehalfspacing for 1.5 spacing, \doublespacing for 2.0 spacing.


\makeatletter
\def\LT@c@ption#1[#2]#3{%
  \LT@makecaption#1\fnum@table{#3}%
  \def\@tempa{#2}%
  \ifx\@tempa\@empty\else
     {\let\\\space
      \addtocontents{lot}{\protect\hbox{ }}
       \addcontentsline{lot}{table}{\protect\numberline{\thetable}{\ignorespaces\protect\small\protect\normalsize\rm #2}}}%
  \fi}
\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}


% Table of contents, list of figures, etc.
\tableofcontents     % Required
\listoftables        % Required if there is more than one table

\startthechapters

\chapter{Examples of using table option}
Here are tables produced by table and tabular commands. 
\begin{table}[!h]
\centering
\caption{Tabular table}
\vspace{1em}
    \begin{tabular}{ | l | l | l | p{5cm} |}
    \hline
    Day & Min Temp & Max Temp & Summary \\ \hline
    Monday & 11C & 22C & A clear day with lots of sunshine.  
    However, the strong breeze will bring down the temperatures. \\ \hline
    Tuesday & 9C & 19C & Cloudy with rain, across many northern regions. Clear spells
    across most of Scotland and Northern Ireland,
    but rain reaching the far northwest. \\ \hline
    Wednesday & 10C & 21C & Rain will still linger for the morning.
    Conditions will improve by early afternoon and continue
    throughout the evening. \\
    \hline
    \end{tabular}
\end{table}

\begin{table}[!h]
\centering
\caption{Colored rows}
\vspace{10pt}
\begin{tabular}{lll}
odd     & odd   & odd \\
even    & even  & even\\
odd     & odd   & odd \\
even    & even  & even\\
\end{tabular}
\end{table}

\chapter{Examples of using longtable option}

\begin{longtabu}{ll}
\caption{Longtabu table} \\ 
Longtable & Longtable \\
Longtable & Longtable \\
Longtable & Longtable \\
Longtable & Longtable \\
Longtable & Longtable \\
\end{longtabu}

\begin{longtable}{ll}
\caption{Longtable example} \\ 
\toprule
Longtable & Longtable \\
Longtable & Longtable \\
Longtable & Longtable \\
Longtable & Longtable \\
Longtable & Longtable \\
\end{longtable}

\begin{table}[!h]
\centering
\caption{Here again tabular environment}
\vspace{10pt}
\begin{tabular}{lll}
odd     & odd   & odd \\
even    & even  & even\\
odd     & odd   & odd \\
even    & even  & even\\
\end{tabular}
\end{table}
 W
Look at the list of tables. When the longtable or longtabu commands are used, they create the less space between the entries. It is desirable for me to have spaces as in the \textbf{table environment}. 
\end{document}

enter image description here

5
  • ah that is the complementary answer to mine:-) you've added the wacky \hbox to the LT caption so the spacing matches the others. I took the hbox line out of the other caption handling. Not sure which the OP will prefer:-) Jan 26, 2014 at 0:54
  • @DavidCarlisle he has now the two possibilities :-) Jan 26, 2014 at 0:55
  • @GonzaloMedina yeah, it works. Though how can I change this '\hbox' to have less space between table titles in lot?
    – user43182
    Jan 26, 2014 at 9:15
  • @DavidCarlisle I forgot to mention that if I comment that line, it will also change my list of figures to be single-spaced.
    – user43182
    Jan 26, 2014 at 9:21
  • Question again: how can I take that Table word shown in the picture above and put in the front of each table numeration?
    – user43182
    Jan 26, 2014 at 9:23
3

Hmm use of a bare \hbox in LaTeX is almost always wrong and that csm package uses lots of them. Commenting out this one fixes it

\long\def\@caption#1[#2]#3{%
% \addtocontents{\csname ext@#1\endcsname}{\hbox{ }}

(line 243)

2
  • This works, but not according to my request. I do need some space between each of table names. Why I have single-spaced then - because for the long table (or figure titles) my school requires them (these long captions) to be single-spaced, but little separated between, for example, Table 1.1 and 1.2. Also, why is \hbox not recommended to use?
    – user43182
    Jan 26, 2014 at 9:12
  • 1
    @user43182 you may in that case prefer Gonzalo's answer, I see you accepted it:-) but note that the \hbox are a terrible way to introduce space: they do not add space but rather a blank line so the space will not stretch or be dropped at a page break, and have lots of other bad effects. As I mentioned, the sty file is doing this everywhere. The correct fix is to remove all those spurious hboxes and then (if you must) specify doublespacing using setspace or similar packages. Jan 26, 2014 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.