我正在使用 Overleaf 中的 pdfLaTeX 编译器创建一个用于报告文档类的模板。
我已经能够格式化章节标题、节标题等。我在格式化参考文献后记时遇到了麻烦。“参考文献”标题之间的间隙对于我试图满足的要求来说太大了。
我如何控制参考文献标题(上方和下方)的间隙?其他章节/标题的间隙设置正确。所有格式都包含在下面,以防出现一些重要的上游冲突。
\documentclass[12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage{natbib}
% page, paragraph dimensions
\usepackage[letterpaper, margin=1in]{geometry}
\setlength{\parindent}{0.5in}
\setlength{\parskip}{6pt}
% use Calibri font
\usepackage[sfdefault]{carlito}
% headings
\usepackage{titlesec}
\titleformat{\chapter}%
{\normalfont\fontsize{22pt}{0pt}\bfseries}%
{\thechapter}{0.5in}{}
\titlespacing*{\chapter}{0pt}{80pt}{40pt}
\titleformat{\section}%
{\normalfont\fontsize{14pt}{0pt}\bfseries}%
{\thesection}{0.5in}{\MakeUppercase}
\titlespacing*{\section}{0pt}{24pt}{12pt}
% report frontmatter, mainmatter, backmatter
\makeatletter
\newcommand\frontmatter{
\cleardoublepage
\pagenumbering{roman}}
\newcommand\mainmatter{
\cleardoublepage
\pagenumbering{arabic}}
\newcommand\backmatter{
\if@openright
\cleardoublepage
\else
\clearpage
\fi
}
\makeatother
% gap between text and figure/table
\setlength{\intextsep}{24pt}
% references title page
\renewcommand{\bibname}{%
\fontsize{14pt}{0pt}%
\begin{center} REFERENCES \end{center}%
}\titlespacing*{\bibname}{0pt}{0pt}{0pt}
\def\bibfont{\fontsize{11pt}{0pt}\selectfont\hyphenpenalty=10000}
% TRIED WITH NO EFFECT
% \titlespacing*{\bibname}{0pt}{0pt}{0pt}
%-------------------------------------------------------
\begin{document}
\title{template}
\author{none}
\date{\today}
\frontmatter
\maketitle
\tableofcontents
\listoffigures
\listoftables
\mainmatter
\chapter{Introduction}
\cite{einstein1906new}
\backmatter
\bibliographystyle{plain}
\bibliography{references}
\end{document}
另外,references.bib
内容:
@article{einstein1906new,
title={A new determination of molecular dimensions},
author={Einstein, Albert},
journal={Ann. Phys.},
volume={19},
pages={289--306},
year={1906}
}
答案1
您可以改为在 的处理中添加一些内容thebibliography
,即对 的参数进行(局部)更改\titleformat
。我还建议如何将引用添加到目录中
\begin{filecontents*}{\jobname.bib}
@article{einstein1906new,
title={A new determination of molecular dimensions},
author={Einstein, Albert},
journal={Ann. Phys.},
volume={19},
pages={289--306},
year={1906}
}
\end{filecontents*}
\documentclass[12pt]{report}
\usepackage{natbib}
% page, paragraph dimensions
\usepackage[letterpaper, margin=1in]{geometry}
\setlength{\parindent}{0.5in}
\setlength{\parskip}{6pt}
% use Calibri font
\usepackage[sfdefault]{carlito}
% headings
\usepackage{titlesec}
\titleformat{\chapter}%
{\normalfont\fontsize{22pt}{0pt}\bfseries\filcenter}%
{\thechapter}{0.5in}{}
\titlespacing*{\chapter}{0pt}{80pt}{40pt}
\titleformat{\section}%
{\normalfont\fontsize{14pt}{0pt}\bfseries}%
{\thesection}{0.5in}{\MakeUppercase}
\titlespacing*{\section}{0pt}{24pt}{12pt}
% report frontmatter, mainmatter, backmatter
\makeatletter
\newcommand\frontmatter{%
\cleardoublepage
\pagenumbering{roman}%
}
\newcommand\mainmatter{%
\cleardoublepage
\pagenumbering{arabic}%
}
\newcommand\backmatter{%
\if@openright
\cleardoublepage
\else
\clearpage
\fi
}
\makeatother
% gap between text and figure/table
\setlength{\intextsep}{24pt}
\AtBeginEnvironment{thebibliography}{%
\titleformat{\chapter}%
{\normalfont\fontsize{22pt}{0pt}\bfseries\filcenter}%
{\thechapter}{0.5in}{\MakeUppercase}%
%\titlespacing*{\chapter}{0pt}{80pt}{40pt}% maybe adjust the spacing
}
\renewcommand{\bibname}{References}
\AddToHook{cmd/bibsection/after}{%
\addcontentsline{toc}{chapter}{\bibname}%
}
%-------------------------------------------------------
\begin{document}
\title{template}
\author{none}
\date{\today}
\frontmatter
\maketitle
\tableofcontents
\listoffigures
\listoftables
\mainmatter
\chapter{Introduction}
\cite{einstein1906new}
\backmatter
\bibliographystyle{plain}
\bibliography{\jobname}
\end{document}
如果您运行的是 2020-10-01 版本之前的 LaTeX,则需要添加\usepackage{etoolbox}
并\AtBeginEnvironment
更改\AddToHook{cmd/bibsection/after}
为\appto{\bibsection}
。
就文体而言,段落间同时使用非零缩进和垂直跳跃太多了。只使用其中一种(我指的是前者)。