我的目录中的行距(或行高?)是不规则的,见下图。
例如:1-1-1和1-1-2之间的垂直间隙大于1-1-2和1-1-3之间的垂直间隙。
正如@ChristianHupfer 在评论中所建议的那样;当一行包含带有降部字母(例如“p”或“y”)时,会占用更多的垂直空间。
有谁知道如何解决这一问题?
上面的示例可以通过以下代码生成:
\documentclass[a4paper,11pt,twoside,onecolumn,openright]{book}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Changes to the default book class style
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\makeatletter
\renewcommand\contentsname{Table of Contents}
%
\renewcommand\tableofcontents{%
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{\contentsname
\@mkboth{%
\contentsname}{\contentsname}}%
\@starttoc{toc}%
\if@restonecol\twocolumn\fi
}%
\renewcommand\listoffigures{%
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{\listfigurename}%
\@mkboth{\listfigurename}%
{\listfigurename}%
\@starttoc{lof}%
\if@restonecol\twocolumn\fi
}%
\renewcommand\listoftables{%
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{\listtablename}%
\@mkboth{%
\listtablename}%
{\listtablename}%
\@starttoc{lot}%
\if@restonecol\twocolumn\fi
}%
\makeatother
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Definitions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newcommand*{\loflotintoc}[1]%
{\def\loflot_in_toc{#1}}
%
\loflotintoc{}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Fancy Chapter Headings
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\RequirePackage{fncychap}
%
\makeatletter
\ChNameVar{\raggedleft\Huge\rm}
\ChNumVar{\Huge\rm}
\ChTitleVar{\raggedleft\Huge\sf\bfseries}
\ChRuleWidth{2pt}
\renewcommand{\DOCH}{%
\vskip -0.5\baselineskip
\mghrulefill{\RW}\par\nobreak
\CNV\FmN{\@chapapp}\space \CNoV\thechapter
\par\nobreak
\vskip -0.5\baselineskip
}
\renewcommand{\DOTI}[1]{%
\mghrulefill{\RW}\par\nobreak
\CTV\FmTi{#1}\par\nobreak
\vskip 60\p@
}
\renewcommand{\DOTIS}[1]{%
\mghrulefill{\RW}\par\nobreak
\CTV\FmTi{#1}\par\nobreak
\vskip 60\p@
}
\makeatother
%
\RequirePackage{ifthen}
\RequirePackage{ifpdf}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Change format TOC, sections, subsections, etc.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\renewcommand\thesection {\thechapter-\arabic{section}}
\renewcommand\thesubsection {\thesection-\arabic{subsection}}
\renewcommand\thesubsubsection{\thesubsection-\arabic{subsubsection}}
\renewcommand\theparagraph {\thesubsubsection-\arabic{paragraph}}
\renewcommand\thesubparagraph {\theparagraph-\arabic{subparagraph}}
\renewcommand\thefigure {\thechapter-\arabic{figure}}
\renewcommand\thetable {\thechapter-\arabic{table}}
%
\makeatletter
%
\renewcommand\section{\@startsection{section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\sffamily\Large\bfseries}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
{\sffamily\large\bfseries}}
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
{\sffamily\normalsize\bfseries}}
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
{3.25ex \@plus1ex \@minus.2ex}%
{-1em}%
{\sffamily\normalsize\bfseries}}
\renewcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
{3.25ex \@plus1ex \@minus .2ex}%
{-1em}%
{\sffamily\normalsize\bfseries}}
%
\def\@part[#1]#2{%
\ifnum \c@secnumdepth >-2\relax
\refstepcounter{part}%
\addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
\else
\addcontentsline{toc}{part}{#1}%
\fi
\markboth{}{}%
{\centering
\interlinepenalty \@M
\sffamily
\ifnum \c@secnumdepth >-2\relax
\huge\bfseries \partname\nobreakspace\thepart
\par
\vskip 20\p@
\fi
\Huge \bfseries #2\par}%
\@endpart}
%
\def\@spart#1{%
{\centering
\interlinepenalty \@M
\sffamily
\Huge \bfseries #1\par}%
\@endpart}
%
\renewcommand*\l@part[2]{%
\ifnum \c@tocdepth >-2\relax
\addpenalty{-\@highpenalty}%
\addvspace{2.25em \@plus\p@}%
\setlength\@tempdima{3em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
{\leavevmode
\large \bfseries \sffamily #1\hfil \hb@xt@\@pnumwidth{\hss #2}}\par
\nobreak
\global\@nobreaktrue
\everypar{\global\@nobreakfalse\everypar{}}%
\endgroup
\fi}
%
\renewcommand*\l@chapter[2]{%
\ifnum \c@tocdepth >\m@ne
\addpenalty{-\@highpenalty}%
\vskip 1.0em \@plus\p@
\setlength\@tempdima{1.5em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \bfseries \sffamily
\advance\leftskip\@tempdima
\hskip -\leftskip
#1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\penalty\@highpenalty
\endgroup
\fi}
%
\renewcommand*\l@section{\sffamily \@dottedtocline{1}{1.5em}{2.3em}}
\renewcommand*\l@subsection{\sffamily \@dottedtocline{2}{3.8em}{3.2em}}
\renewcommand*\l@subsubsection{\sffamily \@dottedtocline{3}{7.0em}{4.1em}}
\renewcommand*\l@paragraph{\sffamily \@dottedtocline{4}{10em}{5em}}
\renewcommand*\l@subparagraph{\sffamily \@dottedtocline{5}{12em}{6em}}
\renewcommand*\l@figure{\sffamily \@dottedtocline{1}{1.5em}{2.3em}}
\renewcommand*\l@table{\sffamily \@dottedtocline{1}{1.5em}{2.3em}}
%
\makeatother
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% HyperReference
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\RequirePackage[hyperref]{xcolor}
\ifpdf
\RequirePackage{hyperref}
\else
\RequirePackage{pstricks,pst-node}
\RequirePackage[dvips]{hyperref}
\fi
%
\RequirePackage{colortbl}
\definecolor{darkred}{rgb}{0.5,0,0}
\definecolor{darkgreen}{rgb}{0,0.3,0}
\definecolor{darkblue}{rgb}{0,0,0.5}
\definecolor{darkbrown}{rgb}{0.28,0.07,0.07}
\definecolor{black}{rgb}{0,0,0}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Extra Packages and Options
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\RequirePackage[headheight=14.6pt,hmarginratio=1:1,top=3.5cm,height=22.5cm,width=14.9cm,headsep=1.0cm,footskip=1.5cm]{geometry}
\RequirePackage{fancyhdr}
%
\RequirePackage{caption}
\RequirePackage{subcaption}
\RequirePackage{graphicx}
%
\RequirePackage{psfrag}
%
\RequirePackage[notintoc]{nomencl}[2005/09/22]
%
% separate paragraphs instead of indenting them
\setlength{\parskip}{\medskipamount}
\setlength{\parindent}{0pt}
%
% small sans-serif font family for captions
\renewcommand{\captionfont}{\small\sffamily}
\renewcommand{\captionlabelfont}{\small\bfseries\sffamily}
\setlength{\captionmargin}{20pt}
%
% better vertical spacing in tables
\newcommand\T{\rule{0pt}{2.6ex}}
\newcommand\B{\rule[-1.2ex]{0pt}{0pt}}
%
\newcommand{\clearemptydoublepage}{\newpage{\pagestyle{empty}\cleardoublepage}}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Header Definition
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\pagestyle{fancyplain}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\lhead[\fancyplain{}{\sffamily\bfseries\thepage}]{\fancyplain{}{\sffamily\bfseries\rightmark}}
\rhead[\fancyplain{}{\sffamily\bfseries\leftmark}]{\fancyplain{}{\sffamily\bfseries\thepage}}
\cfoot{}
% Headers and footers for plain (blank) pages
\fancypagestyle{plain}{%
\fancyhf{}%
%\fancyhead[RO,LE]{\bfseries \thepage}%
\fancyfoot[C]{\sffamily \bfseries \thepage}%
\renewcommand{\headrulewidth}{0pt}%
\renewcommand{\footrulewidth}{0pt}%
}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% TOC / LOF / LOT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newcommand{\toc}{
\thispagestyle{empty}
\setlength{\baselineskip}{0.5\baselineskip}
\tableofcontents\cleardoublepage
\setlength{\baselineskip}{2\baselineskip}
}
%
\newcommand{\toclof}{
\thispagestyle{empty}
\setlength{\baselineskip}{0.5\baselineskip}
\tableofcontents\cleardoublepage
\listoffigures%
\ifthenelse{ \equal{\loflot_in_toc}{0} }{\cleardoublepage}{%
\addcontentsline{toc}{chapter}{\numberline{}\listfigurename}\cleardoublepage%
%\addcontentsline{toc}{chapter}{\listfigurename}\cleardoublepage%
}%
\setlength{\baselineskip}{2\baselineskip}
}
%
\newcommand{\tocloflot}{
\thispagestyle{empty}
\setlength{\baselineskip}{0.5\baselineskip}%
\tableofcontents\cleardoublepage%
\listoffigures%
\ifthenelse{ \equal{\loflot_in_toc}{0} }{\cleardoublepage}{%
\addcontentsline{toc}{chapter}{\numberline{}\listfigurename}\cleardoublepage%
%\addcontentsline{toc}{chapter}{\listfigurename}\cleardoublepage%
}%
\listoftables%
\ifthenelse{ \equal{\loflot_in_toc}{0} }{\cleardoublepage}{%
\addcontentsline{toc}{chapter}{\numberline{}\listtablename}\cleardoublepage%
%\addcontentsline{toc}{chapter}{\listtablename}\cleardoublepage%
}%
\setlength{\baselineskip}{2\baselineskip}%
\cleardoublepage
}
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Begin document
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\begin{document}%
% Front matter
\frontmatter
\loflotintoc{1} % 1 = include LOF and LOT in TOC
\tocloflot
% Main matter
\mainmatter
\chapter{Example Chapter}
\section{Section without descender}
\subsection{Subsection with descender, such as p or y}
\subsection{Subsection without descender}
\subsection{Subsection without descender}
\section{Section without descender}
\section{Section with descender, such as p or y}
\section{Section with descender, such as p or y}
\section{Section without descender}
\section{Section without descender}
\appendix
% Back matter
\backmatter
\end{document}
答案1
你有
\setlength{\baselineskip}{0.5\baselineskip}
它告诉 latex 尝试将行的高度设为正常高度的一半,该高度小于字母的大小,因此它无法保持指定的基线间距。在这种情况下,它不会尝试保持均匀的间距,而是将行堆叠在另一行之上,\lineskip
中间留有 (1pt),因此行之间的间距取决于行中字符的大小。