减少边距章节

减少边距章节

我被困在这里,我无法减少章节命令前后的边距,我尝试了命令标题间距但什么也没发生。

如何减少这个空间?

代码 :

\documentclass[a4paper,12pt]{report}
\usepackage[french]{babel}
\usepackage[utf8x]{inputenc}
\usepackage[explicit]{titlesec}
\usepackage[Glenn]{fncychap}
\titlespacing{\chapter}{0}{1pt}{2pt}
\begin{document}
    \chapter{Introduction}

    \section{Les Escherichia coli pathogènes}
    \subsection{Caractères généraux}
        Escherichia coli (E.coli) est un bacille à
\end{document}

我想要减少的空格是标题前后的空格。

结果 : 本章结果

提前谢谢 <3 <3 <3

答案1

我添加了两个长度来控制间距:一个在页面顶部和章节标题之间(\beforechapter),一个在章节标题和下面的文本之间(\afterchapter

由于您使用fncychap它来布置章节标题,titleec因此在这里无关紧要。

更新

现在包括所要求的目录和参考书目页。

X 是 是

\documentclass[a4paper,12pt]{report}
\usepackage[french]{babel}
\usepackage[utf8]{inputenc}

\usepackage{showframe} % show margins
\renewcommand*\ShowFrameColor{\color{red}}

\usepackage[Glenn]{fncychap}


%% *********************************************** added
\newlength{\beforechapter}
\newlength{\afterchapter}

\setlength{\beforechapter}{-3\baselineskip} % substract some space before the chapter title <<<<<<
\setlength{\afterchapter}{2\baselineskip} % add space after chapter title   <<<<<<<<<<<<<

\makeatletter
  \renewcommand{\DOCH}{%
    \settoheight{\myhi}{\CTV\FmTi{Test}}
    \setlength{\py}{\baselineskip}
    \addtolength{\py}{\RW}
    \addtolength{\py}{\myhi}
    \setlength{\pyy}{\py}
    \addtolength{\pyy}{-1\RW}
    \vskip \beforechapter
    \raggedright
    \CNV\FmN{\@chapapp}\space\CNoV\thechapter
    \hskip 3pt\mghrulefill{\RW}\rule[-1\pyy]{2\RW}{\py}\par\nobreak}


  \renewcommand{\DOTI}[1]{%
    \addtolength{\pyy}{-4pt}
    \settoheight{\myhi}{\CTV\FmTi{#1}}
    \addtolength{\myhi}{\py}
    \addtolength{\myhi}{-1\RW}
    \vskip -1\pyy
    \rule{2\RW}{\myhi}\mghrulefill{\RW}\hskip 2pt
    \raggedleft\CTV\FmTi{#1}\par\nobreak
    \vskip \afterchapter
}


\def\@makeschapterhead#1{%
    \vspace*{50\p@}%
    \vskip \beforechapter
    {\parindent \z@ \raggedright
        \normalfont
        \interlinepenalty\@M
        \DOTIS{#1}
        \vskip -40\p@
        \vskip \afterchapter}
    }


\makeatother
%% *********************************************** added

\begin{document}
    
    \tableofcontents
    
    \chapter{Introduction}
    
    \section{Les Escherichia coli pathogènes}
    \subsection{Caractères généraux}
    Escherichia coli (E.coli) est un bacille à
    
    \chapter{Method}
    Three items are cited: \textit{The \LaTeX\ Companion} 
    book \cite{latexcompanion}, the Einstein journal paper \cite{einstein}, and the 
    Donald Knuth's website \cite{knuthwebsite}. The \LaTeX\ related items are
    \cite{latexcompanion,knuthwebsite}. 
    

\begin{thebibliography}{9}
    \bibitem{latexcompanion} 
    Michel Goossens, Frank Mittelbach, and Alexander Samarin. 
    \textit{The \LaTeX\ Companion}. 
    Addison-Wesley, Reading, Massachusetts, 1993.
    
    \bibitem{einstein} 
    Albert Einstein. 
    \textit{Zur Elektrodynamik bewegter K{\"o}rper}. (German) 
    [\textit{On the electrodynamics of moving bodies}]. 
    Annalen der Physik, 322(10):891–921, 1905.
    
    \bibitem{knuthwebsite} 
    Knuth: Computers and Typesetting,
    \\\texttt{http://www-cs-faculty.stanford.edu/\~{}uno/abcde.html}
\end{thebibliography}

\end{document}

相关内容