我已经自定义了章节标题,所以我想减少参考书目标题的间距而不影响章节的样式。非常感谢。这是代码:
\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{ragged2e}
\usepackage[colorlinks=true,linkcolor=blue,urlcolor=red,
citecolor=magenta]{hyperref}
\usepackage[square,numbers]{natbib}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setlength{\cftbeforetoctitleskip}{-12em}
\setlength{\cftbeforeloftitleskip}{-12em}
\setlength{\cftbeforelottitleskip}{-12em}
\renewcommand\cftsecafterpnum{\vskip 8pt}
\renewcommand\cftchapafterpnum{\vskip 8pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\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{13.5ex}[6pt]{\rlap{\hspace{-\fboxsep}\resizebox* {\dimexpr\labelframewd+2\fboxsep\relax}{!}{\color{titlecolour}\lsstyle\scshape\scriptsize{capitulo}}}}%
\usebox{\chapterlabelbox}}}
\hskip-\fboxsep\color{titlecolour}{\raisebox{-15ex}{\fbox{\phantom{\usebox{\chapterlabelbox}}}}}
}%
\titleformat{\chapter}[display]{}
{%
\sbox{\chapterlabelbox}{\raisebox{-5pt}[12ex][27ex]{\resizebox{\labelframewd}{!}{\hfill\color{white}{\arabic{chapter}}\hfill}}}
\smash{\chapterlabel}}%
{6ex}
{\thispagestyle{empty}{\color{titlecolour}\titlerule[\fboxrule]}\vskip3.0ex\hspace*{3\labelframewd}\fontsize{32}{32}\itshape}%
\titlespacing{\chapter}{1pt}{1.25\baselineskip}{10\baselineskip}
\renewcommand*\thechapter{\arabic{chapter}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\marginsize{4cm}{2cm}{3cm}{3cm}
\pagenumbering{arabic}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
...
\addcontentsline{toc}{chapter}{Bibliografía}
\bibliographystyle{plainnat}
\bibliography{tesis1}
\end{document}
答案1
更改 中的最后一个参数的值,\titlespacing
并为 中的代码编写\titleformat
无数章节。此外,当您想要将颜色设置为某些已知颜色(例如黑色)时,设置其rgb
值并不是特别有用。使用\colorlet
中的命令要简单得多xcolor
。我擅自删除了参考书目章节标题上方的水平线:
\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{ragged2e}
\usepackage[colorlinks=true,linkcolor=blue,urlcolor=red,
citecolor=magenta]{hyperref}
\usepackage[square,numbers]{natbib}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setlength{\cftbeforetoctitleskip}{-12em}
\setlength{\cftbeforeloftitleskip}{-12em}
\setlength{\cftbeforelottitleskip}{-12em}
\renewcommand\cftsecafterpnum{\vskip 8pt}
\renewcommand\cftchapafterpnum{\vskip 8pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setlength\fboxrule{0.8pt}%
\colorlet{titlecolour}{black}
\newlength\labelframewd
\settowidth{\labelframewd}{~\footnotesize\textsc{capitulo}~}
\newsavebox\chapterlabelbox%
\newcommand\chapterlabel{%
\makebox[1pt]{\fcolorbox{titlecolour}{titlecolour}{%
\raisebox{13.5ex}[6pt]{\rlap{\hspace{-\fboxsep}\resizebox* {\dimexpr\labelframewd+2\fboxsep\relax}{!}{\color{titlecolour}\lsstyle\scshape\scriptsize{capitulo}}}}%
\usebox{\chapterlabelbox}}}
\hskip-\fboxsep\color{titlecolour}{\raisebox{-15ex}{\fbox{\phantom{\usebox{\chapterlabelbox}}}}}
}%
\titleformat{\chapter}[display]{}
{%
\sbox{\chapterlabelbox}{\raisebox{-5pt}[12ex][27ex]{\resizebox{\labelframewd}{!}{\hfill\color{white}{\arabic{chapter}}\hfill}}}
\smash{\chapterlabel}}%
{6ex}
{\thispagestyle{empty}{\color{titlecolour}\titlerule[\fboxrule]}\vskip3.0ex\hspace*{3\labelframewd}\fontsize{32}{32}\itshape}%
\titlespacing{\chapter}{1pt}{1.25\baselineskip}{10\baselineskip}
\renewcommand*\thechapter{\arabic{chapter}}
\titleformat{name=\chapter, numberless}[block]{}
{}%
{0ex}
{\thispagestyle{empty}\vskip3.0ex\hspace*{3\labelframewd}\fontsize{32}{32}\itshape}%
\titlespacing{name=\chapter, numberless}{1pt}{1.25\baselineskip}{4\baselineskip}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\marginsize{4cm}{2cm}{3cm}{3cm}
\pagenumbering{arabic}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\chapter{A first chapter}
...
\nocite{*}
\addcontentsline{toc}{chapter}{Bibliografía}
\bibliographystyle{plainnat}
\bibliography{tesis1}
\end{document}