目录中的标题间距

目录中的标题间距

我是 LaTeX 新手,我想减少 ToC、LoF 和 LoT 中的标题间距。它们之所以采用这种格式,是因为我使用的章节样式,但我想在不修改章节样式的情况下减少它们的间距。这是代码,这些是我得到的图像。如果您建议,请更改致谢部分的样式。

\documentclass[a4paper,oneside,onecolumn,openany,12pt]{book}
\usepackage[spanish]{babel} 
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage{microtype} 
\usepackage[garamond]{mathdesign}
\usepackage{garamondx}%%
\usepackage[x11names]{xcolor}
\usepackage{graphicx}
\usepackage{etoolbox}
\usepackage{environ} 
\usepackage{anysize}
\usepackage{geometry}
\usepackage{titlesec}%[newparttoc]
%\usepackage{tocloft}
\usepackage[colorlinks=true,linkcolor=blue]{hyperref}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\setlength\fboxrule{0.8pt}
\definecolor{titlecolour}{rgb}{0,0,0}
\newlength\labelframewd
\settowidth{\labelframewd}{~\footnotesize\textsc{capitulo}~}

\newsavebox\chapterlabelbox%

\newcommand\chapterlabel{%
\makebox[1pt]{\fcolorbox{titlecolour}{titlecolour}{%
\raisebox{14ex}[5pt]{\rlap{\hspace{-\fboxsep}\resizebox*{\dimexpr\labelframewd+2\fboxsep\relax}{!}{\color{titlecolour}\lsstyle\scshape\scriptsize{capitulo}}}}%
\usebox{\chapterlabelbox}}}
\hskip-\fboxsep\color{titlecolour}{\raisebox{-13ex}{\fbox{\phantom{\usebox{\chapterlabelbox}}}}}
}%

\titleformat{\chapter}[display]{}
{%
 \sbox{\chapterlabelbox}{\raisebox{0pt}[12ex][27ex]{\resizebox{\labelframewd}{!}{\hfill\color{white}{\arabic{chapter}}\hfill}}}
\smash{\chapterlabel}}%
{6ex}
{\thispagestyle{empty}{\color{titlecolour}\titlerule[\fboxrule]}\vskip3.0ex\hspace*{2.5\labelframewd}\fontsize{32}{30}\itshape}%

\titlespacing{\chapter}{1pt}{1.25\baselineskip}{9\baselineskip}
\renewcommand*\thechapter{\arabic{chapter}}
%\setlength\cftaftertoctitleskip{8pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\marginsize{4cm}{2cm}{3cm}{3cm}
\pagenumbering{arabic}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document} 
\begin{titlepage}
\begin{center}
\begin{Huge}
\textsc{Un buen título es muy importante}
\end{Huge}
\end{center}
\end{titlepage}
\newpage
$\ $
\thispagestyle{empty} % para que no se numere esta pagina
\newpage
\chapter*{}
\setcounter{page}{5}
\begin{flushright}
\textit{Dedicado a mis padres y hermanos \\}
\end{flushright}
\chapter*{Agradecimientos}
jdlksajkdjalkjda
\tableofcontents % indice de contenidos
\listoffigures % indice de figuras
\listoftables % indice de tablas
\chapter{INTRODUCCIÓN}
Text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text.

\end{document}

图片

答案1

由于您使用了,请对章节titlesec进行单独的格式化:numberless

\documentclass[a4paper,oneside,onecolumn,openany,12pt]{book}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage{microtype}
\usepackage[garamond]{mathdesign}
\usepackage{garamondx}%%
\usepackage[x11names]{xcolor}
\usepackage{graphicx}
\usepackage{etoolbox}
\usepackage{environ}
\usepackage{anysize}
\usepackage{geometry}
\usepackage{titlesec}%[newparttoc]
%\usepackage{tocloft}
\usepackage[colorlinks=true,linkcolor=blue]{hyperref}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\setlength\fboxrule{0.8pt}
\definecolor{titlecolour}{rgb}{0,0,0}
\newlength\labelframewd
\settowidth{\labelframewd}{~\footnotesize\textsc{capitulo}~}

\newsavebox\chapterlabelbox%

\newcommand\chapterlabel{%
\makebox[1pt]{\fcolorbox{titlecolour}{titlecolour}{%
\raisebox{14ex}[5pt]{\rlap{\hspace{-\fboxsep}\resizebox*{\dimexpr\labelframewd+2\fboxsep\relax}{!}{\color{titlecolour}\lsstyle\scshape\scriptsize{capitulo}}}}%
\usebox{\chapterlabelbox}}}
\hskip-\fboxsep\color{titlecolour}{\raisebox{-13ex}{\fbox{\phantom{\usebox{\chapterlabelbox}}}}}
}%

\titleformat{\chapter}[display]{}
{%
 \sbox{\chapterlabelbox}{\raisebox{0pt}[12ex][27ex]{\resizebox{\labelframewd}{!}{\hfill\color{white}{\arabic{chapter}}\hfill}}}
\smash{\chapterlabel}}%
{6ex}
{\thispagestyle{empty}{\color{titlecolour}\titlerule[\fboxrule]}\vskip3.0ex\hspace*{2.5\labelframewd}\fontsize{32}{30}\itshape}%
\titlespacing{\chapter}{1pt}{1.25\baselineskip}{9\baselineskip}
\renewcommand*\thechapter{\arabic{chapter}}

%%%% Numberless chapters%
\titleformat{name=\chapter, numberless}[block]{\filcenter}{}{0pt}
{\thispagestyle{empty}\fontsize{32}{30}\itshape}%
\titlespacing{name=\chapter, numberless}{1pt}{0\baselineskip}{5\baselineskip}
%\setlength\cftaftertoctitleskip{8pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\marginsize{4cm}{2cm}{3cm}{3cm}
\pagenumbering{arabic}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{titlepage}
\begin{center}
\begin{Huge}
\textsc{Un buen título es muy importante}
\end{Huge}
\end{center}
\end{titlepage}
\newpage
$\ $
\thispagestyle{empty} % para que no se numere esta pagina
\newpage
\chapter*{}
\setcounter{page}{5}
\begin{flushright}
\textit{Dedicado a mis padres y hermanos \\}
\end{flushright}
\chapter*{Agradecimientos}
jdlksajkdjalkjda
\tableofcontents % indice de contenidos
\listoffigures % indice de figuras
\listoftables % indice de tablas
\chapter{INTRODUCCIÓN}
Text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text.
\section{Primera sección}

\end{document} 

在此处输入图片描述

答案2

您可以使用tocloft包并设置长度\cftbeforetoctitleskip(以及 LoF 和 LoT 的等效值)。为了使最终文档看起来与原始文档相似,您还必须使用 调整 ToC 的名称\renewcommand{\contentsname}{new ToC name}

用于设置间距谢谢部分我建议使用\vspace{}命令。

这是基于您的代码的 MWE:

\documentclass[a4paper,oneside,onecolumn,openany,12pt]{book}
\usepackage[spanish]{babel} 
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage{microtype} 
\usepackage[garamond]{mathdesign}
\usepackage{garamondx}%%
\usepackage[x11names]{xcolor}
\usepackage{graphicx}
\usepackage{etoolbox}
\usepackage{environ} 
\usepackage{anysize}
\usepackage{geometry}
\usepackage{titlesec}%[newparttoc]
\usepackage{tocloft}
\usepackage[colorlinks=true,linkcolor=blue]{hyperref}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\setlength{\cftbeforetoctitleskip}{-12em}
\setlength{\cftbeforeloftitleskip}{-12em}
\setlength{\cftbeforelottitleskip}{-12em}

\setlength\fboxrule{0.8pt}
\definecolor{titlecolour}{rgb}{0,0,0}
\newlength\labelframewd
\settowidth{\labelframewd}{~\footnotesize\textsc{capitulo}~}

\newsavebox\chapterlabelbox%

\newcommand\chapterlabel{%
\makebox[1pt]{\fcolorbox{titlecolour}{titlecolour}{%
\raisebox{14ex}[5pt]{\rlap{\hspace{-\fboxsep}\resizebox*{\dimexpr\labelframewd+2\fboxsep\relax}{!}{\color{titlecolour}\lsstyle\scshape\scriptsize{capitulo}}}}%
\usebox{\chapterlabelbox}}}
\hskip-\fboxsep\color{titlecolour}{\raisebox{-13ex}{\fbox{\phantom{\usebox{\chapterlabelbox}}}}}
}%

\titleformat{\chapter}[display]{}
{%
 \sbox{\chapterlabelbox}{\raisebox{0pt}[12ex][27ex]{\resizebox{\labelframewd}{!}{\hfill\color{white}{\arabic{chapter}}\hfill}}}
\smash{\chapterlabel}}%
{6ex}
{\thispagestyle{empty}{\color{titlecolour}\titlerule[\fboxrule]}\vskip3.0ex\hspace*{2.5\labelframewd}\fontsize{32}{30}\itshape}%

\titlespacing{\chapter}{1pt}{1.25\baselineskip}{9\baselineskip}
\renewcommand*\thechapter{\arabic{chapter}}
%\setlength\cftaftertoctitleskip{8pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\marginsize{4cm}{2cm}{3cm}{3cm}
\pagenumbering{arabic}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document} 
\begin{titlepage}
\begin{center}
\begin{Huge}
\textsc{Un buen título es muy importante}
\end{Huge}
\end{center}
\end{titlepage}
\newpage
$\ $
\thispagestyle{empty} % para que no se numere esta pagina
\newpage
\chapter*{}
\setcounter{page}{5}
\begin{flushright}
\textit{Dedicado a mis padres y hermanos \\}
\end{flushright}
\chapter*{Agradecimientos}
\vspace{-8em}
jdlksajkdjalkjda

\chapter*{\contentsname}
\renewcommand{\contentsname}{}
\tableofcontents % indice de contenidos

\chapter*{\listfigurename}
\renewcommand{\listfigurename}{}
\listoffigures % indice de figuras

\chapter*{\listtablename}
\renewcommand{\listtablename}{}
\listoftables % indice de tablas

\chapter{INTRODUCCIÓN}
Text text text text text.

\end{document}

相关内容