在双倍行距中,找到适合图表和表格的标题跳过,并为长标题自定义目录页码

在双倍行距中,找到适合图表和表格的标题跳过,并为长标题自定义目录页码

我正在使用基于书籍的课程撰写论文。总体上需要双倍行距。目前我有两个问题:第一是找到适合图表和表格标题的标题跳过;第二是将论文编号与目录中的章节编号对齐。

mwe如下:

\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}

这是一个很长的例子,但我必须包含几乎所有相关的包。我得到的结果如下:

目录页, 目录页码

以及文中的表格。

表格标题离文本太近

对于 TOC,tocloft使用。最好采用不改变其他包的解决方案。

我也尝试缩小下方和上方的空间align。但它似乎是那样设计的。我仍然将其包含在 mwe 中,以防有方法。谢谢。

更新:表格与图形标题间距的单独控制为:

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

其他可能需要尝试不同的值以适应特定文档。我想使用 打印出表格的以下跳过\the\belowskip,但由于未定义的控制序列错误,它没有工作。

相关内容