0

I am writing a thesis using a class based on book. Overall double spacing is required. Right now I have two issues: The first is finding a proper caption skip for both figure and table caption; and the second is align the paper number with section/chapter number in TOC.

A mwe is as following:

\documentclass[12pt,oneside]{book}

\usepackage{ifthen}
\usepackage{setspace} % for double spacing
\doublespacing
\usepackage{sectsty}

\usepackage{etoolbox}
%%%%%%%%%%%%%
\apptocmd\normalsize{%
 \abovedisplayskip=10pt plus 2pt minus 9pt
 \abovedisplayshortskip=0pt plus 3pt
 \belowdisplayskip=10pt plus 2pt minus 9pt
 \belowdisplayshortskip=7pt plus 3pt minus 4pt
}{}{}
%%%%%%%%%%%%%
\BeforeBeginEnvironment{equation}{\begin{singlespace}}
\AfterEndEnvironment{equation}{\end{singlespace}\noindent\ignorespaces}
\BeforeBeginEnvironment{align}{\begin{singlespace}}
\AfterEndEnvironment{align}{\end{singlespace}\noindent\ignorespaces}

\usepackage{calc}
\usepackage{geometry}
\geometry{verbose,paper=letterpaper,textheight=27\baselineskip+\topskip,tmargin=1in,lmargin=1.5in,rmargin=1in}

\makeatletter

\renewcommand{\ps@myheadings}{
  \renewcommand{\@oddhead}{ \thepage} % put page number into header
  \renewcommand{\@evenhead}{ \thepage}
  \renewcommand{\@oddfoot}{}
  \renewcommand{\@evenfoot}{}
}
\makeatother

\pagestyle{myheadings}

\usepackage{tocloft}
% Remove the dots in TOC, LOF, LOT.
\renewcommand{\cftdot}{}
\renewcommand{\cftfigaftersnum}{:}
\renewcommand{\cftfigpresnum}{\MakeUppercase{\figurename} }
\renewcommand{\cftfignumwidth}{7em}
\renewcommand{\cfttabaftersnum}{:}
\renewcommand{\cfttabpresnum}{\MakeUppercase{\tablename} }
\renewcommand{\cfttabnumwidth}{6em}

%http://tex.stackexchange.com/questions/24858/how-to-put-page-numbers-flush-with-the-upper-right-corner-when-the-section-title
\def\chaptermark#1{%
    \markboth{\@chapapp\ \thechapter.~~  #1}{}}
\def\sectionmark#1{%
    \markright{\protect\parbox[t]{.97\linewidth}{\protect\raggedright Section \thesection.~~  #1\vskip0.2em}}}


\usepackage{microtype} % better layout
%%-- mathmatical symbols and equations-----
\usepackage{amsmath,amsthm}


\usepackage{ifluatex}
% Note: When switching the compiler, delete the .aux file.
\ifluatex

\usepackage{fontspec} % to compile with LuaLatex
\setmainfont{Times New Roman} % to compile with LuaLatex
\usepackage{unicode-math}
\setmathfont{Asana-Math.otf} % latinmodern-math or xits-math
\usepackage{polyglossia}
\setdefaultlanguage{english}
\usepackage{csquotes}% Recommended

\else

\usepackage[utf8]{inputenc} 
\usepackage{charter} % nice font
\usepackage{amssymb}
\usepackage{csquotes}% Recommended
\usepackage[english]{babel}% Recommended
\fi

\usepackage[demo]{graphicx}
%http://tex.stackexchange.com/questions/44195/placeholder-for-figure-includegraphics
\makeatletter
  \AtBeginDocument{%
    \def\Ginclude@graphics#1{%
      \begingroup\fboxsep=-\fboxrule
      \fbox{\rule{\@ifundefined{Gin@@ewidth}{150pt}{\Gin@@ewidth}}{0pt}%
        \rule{0pt}{\@ifundefined{Gin@@eheight}{100pt}{\Gin@@eheight}}}\endgroup}}
\makeatother


\usepackage{subfig} % inconsistent with subcaption package
\usepackage{float} % for images

\usepackage[font=small]{caption}
%\captionsetup{belowskip=-5pt}
\setlength{\belowcaptionskip}{-\baselineskip}\addtolength{\belowcaptionskip}{3.0ex}
%\addtolength{\abovecaptionskip}{1.0ex}

\usepackage{booktabs}
\usepackage[version=3]{mhchem}
\usepackage{siunitx}

\addto\captionsenglish{%
\renewcommand\chaptername{CHAPTER}%
\renewcommand\appendixname{APPENDIX}%
\renewcommand\indexname{INDEX}%
\renewcommand{\contentsname}{TABLE OF CONTENTS}%
\renewcommand{\listfigurename}{LIST OF FIGURES}%
\renewcommand{\listtablename}{LIST OF TABLES}%
}

\usepackage{lipsum}

\usepackage[inline]{enumitem}
\setlist{nolistsep}

\usepackage{hyperref}
\hypersetup{
colorlinks,%
citecolor=black,%
filecolor=black,%
linkcolor=black,%
urlcolor=black
}

\usepackage[acronym,toc,nonumberlist,nopostdot,nogroupskip]{glossaries} % loaded after hyperref
\newacronym{ccd}{CCD}{charge coupled device}
\newacronym{xrd}{XRD}{X-ray diffraction}

\makeglossaries

\newglossarystyle{mysuper3col}{%
  \renewenvironment{theglossary}%
    {\tablehead{}\tabletail{}%
    \begin{supertabular}{rp{0.1\textwidth}p{\glsdescwidth}}}%
    {\end{supertabular}}%
  \renewcommand*{\glossaryheader}{}%
  \renewcommand*{\glsgroupheading}[1]{}%
  \renewcommand*{\glossaryentryfield}[5]{%
    \glstarget{##1}{##2} &  & ##3\\}%
  \renewcommand*{\glsgroupskip}{}%
}


\begin{document}


\title{A Long Title Long Title Long Title Long Title Long Title Long Title Long Title A}
\author{The User}
\maketitle

\setcounter{tocdepth}{2}
\clearpage
\tableofcontents
\clearpage
\listoftables
\clearpage
\listoffigures

\renewcommand{\glossarypreamble}{\thispagestyle{myheadings}}
\renewcommand{\acronymname}{LIST OF ABBREVIATIONS}
\setlength{\glsdescwidth}{0.5\textwidth}
\glossarystyle{mysuper3col}
\printglossary[type=\acronymtype, toctitle=\acronymname]

\chapter{A long long long long long long long long enough title to test the line wrapping in TOC}
\section{A long long long long long long long long enough title to test the line wrapping in TOC}
\gls{ccd},\gls{xrd}.
\lipsum[1]
\begin{table}[htb]
\centering
\caption{Another long long long long long long long caption to test the line wrapping in TOC}
\begin{tabular}{lc}
\toprule
Name & Value\\
\midrule
belowcaptionskip    & \the\belowcaptionskip \\
abovecaptionskip     & \the\abovecaptionskip \\
baselineskip            &  \the\baselineskip \\
abovedisplayskip    &  \the\abovedisplayskip \\
 aboveshortskip    & \the\abovedisplayshortskip\\
 belowdisplayskip & \the\belowdisplayskip\\
  belowshortskip & \the\belowdisplayshortskip\\
    floatsep & \the\floatsep \\
    textfloatsep & \the\textfloatsep\\
    intextsep & \the\intextsep \\
\bottomrule
\end{tabular}
\end{table}
\lipsum[2]

\section{Figure text spacing demo}

\lipsum[3]
\begin{figure}[htb]
\centering
\includegraphics{}
\caption{Another long long long long caption to test the line wrapping in TOC.}
\end{figure}
\lipsum[4]


\section{Equations in double spacing environment}

\lipsum[5]
\begin{equation}
h\nu +\ce{W^{5+}(A)} +  \ce{W^{6+}(B)} \rightarrow \ce{W^{5+}(B)} + \ce{W^{6+}(A)}
\end{equation}
%
\lipsum[21]%
\begin{align}
h\nu +\ce{W^{5+}(A)} +  \ce{W^{6+}(B)} &\rightarrow \ce{W^{5+}(B)} + \ce{W^{6+}(A)} \label{eq:cl_bl1}\\
h\nu +\ce{W^{5+}(A)} +  \ce{W^{4+}(B)} &\rightarrow \ce{W^{5+}(B)} + \ce{W^{4+}(A)} \label{eq:cl_bl2}
\end{align}
\lipsum[6]


\end{document}

It is a long example, but I have to include almost all the relevant packages. What I got are shown as:

The TOC page, The TOC page number

and the table in text.

Table caption too close to text

For the TOC, tocloft is used. A solution without changing to another package is preferred.

I also tried to shrink the space below and above align. But it seems to be designed that way. I still have it included in the mwe in case there is a method. Thanks.

Updates: The separate control of table and figure caption spacing is:

\usepackage[font={small,onehalfspacing}]{caption}
\captionsetup[table]{belowskip=0pt}
\captionsetup[figure]{belowskip=-10pt}

Other may need try different values to fit the specific documents. I want to print out the belowskip for table using \the\belowskip, but it didnot work due to a undefined control sequence error.

  • For caption, use \usepackage[font={small,doublespacing}]{caption} and TOC deserves to be separate question. – user11232 Mar 14 '15 at 1:01
  • @HarishKumar Thanks. After adding doublespacing option, the table caption indeed looks much better; meanwhile, it also increase the figure caption spacing. Still, a separate control of figure and table captions skip cannot be done. But I think I will use this. Thanks again. – tao sheng Mar 14 '15 at 15:24
  • For tables, use \captionsetup[table]{...}. similarly for figures. It is separately applied. – user11232 Mar 14 '15 at 15:42
  • @HarishKumar Thanks for pointing out this important option. Now the captions spacing issued is solved. I put my settings under the main question. – tao sheng Mar 14 '15 at 17:10

Your Answer

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

Browse other questions tagged or ask your own question.