我有以下模板:
%Loading in the packages
\documentclass[12pt]{report}
\usepackage[a4paper, width=150mm, top=25mm, bottom=25mm ,bindingoffset=6mm]{geometry}
\usepackage{graphicx}
\usepackage{titlesec}
\usepackage{fancyhdr}
\usepackage[backend=bibtex, style=alphabetic]{biblatex}
\usepackage{courier}
\usepackage[acronym, toc]{glossaries}
\usepackage{listings}
\usepackage{color}
\usepackage[nottoc]{tocbibind}
\usepackage{parskip}
\usepackage{float}
\usepackage{caption}
\usepackage{subcaption}
\restylefloat{table}
\usepackage{multirow}
\DeclareFieldFormat{labelalpha}{\mkbibbold{#1}}
\DeclareFieldFormat{extraalpha}{\mkbibbold{\mknumalph{#1}}}
\graphicspath{{images/}}
\addbibresource{references.bib}
\lstset{
basicstyle = \footnotesize\ttfamily,
breaklines=true,
xleftmargin=1cm,
xrightmargin=\parindent,
}
%Loading in the pagestyling
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\fancyhead[RO, LE]{Chapter \thechapter}
\fancyhead[LO, CE]{Section \thesection}
\fancyfoot[LO, CE]{Test Paper}
\fancyfoot[R]{\thepage}
\renewcommand{\footrulewidth}{0.4pt}
% Redefine the plain page style
\fancypagestyle{plain}{%
\fancyhead{}
\fancyfoot{}
\fancyhead[RO, LE]{Chapter \thechapter}
\fancyhead[LO, CE]{Section \thesection}
\fancyfoot[LO, CE]{Test Paper}
\fancyfoot[R]{\thepage}
}
%Titlepage Information
\titleformat{\chapter}{\Large\bfseries}{}{0pt}{\huge}
\title{
{\TEST PAPER}\\
{\TEST UNIVERSITY}\\
}
\author{TEST TEST}
\date{12th June 2015}
%Actual Document Begins and is laid out%
\begin{document}
\maketitle
%\chapter*{Acknowledgements}
%\input{chapters/Acknowledgements}
\tableofcontents
\listoffigures
\listoftables
\printglossary[type=\acronymtype,nonumberlist, style=custom_acronyms]
\chapter{Introduction}
\input{chapters/Introduction}
\chapter{Aims}
\input{chapters/Aims}
\chapter{History}
\input{chapters/History}
\chapter{Introduction}
\chapter{mistakes}
\chapter{improvments}
\chapter{results}
\chapter{analysis}
\chapter{Conclusion}
\end{document}
有人知道如何减少间距吗?作为一个完全的初学者,我希望以以下格式显示章节:编号:标题 1.简介,但我不知道如何做到这一点,任何帮助都将不胜感激。
答案1
您可以使用titlesec
已加载的包。我修改了代码以使其可编译(例如,代码给出了如下错误:missing \TEST definition
或missing custom-acronym style definition
),并删除了不需要的包。
我使用减少了上边距和标题之间的空间\vspace{...}
;您可以更改此值以获得所需的输出。
需要注意的是:latex 会给出警告,因为该文档oneside
但是的设置fancyhdr
是针对twoside
文档的(因此,一个设置是无用的)。
%Loading in the packages
\documentclass[12pt]{report}
\usepackage[a4paper, width=150mm, top=25mm, bottom=25mm ,bindingoffset=6mm]{geometry}
\usepackage{titlesec}
\usepackage{fancyhdr}
% Random text
\usepackage{lipsum}
%Loading in the pagestyling
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\fancyhead[RO, LE]{Chapter \thechapter}
\fancyhead[LO, CE]{Section \thesection}
\fancyfoot[LO, CE]{Test Paper}
\fancyfoot[R]{\thepage}
\renewcommand{\footrulewidth}{0.4pt}
% Redefine the plain page style
\fancypagestyle{plain}{%
\fancyhead{}
\fancyfoot{}
\fancyhead[RO, LE]{Chapter \thechapter}
\fancyhead[LO, CE]{Section \thesection}
\fancyfoot[LO, CE]{Test Paper}
\fancyfoot[R]{\thepage}
}
%Titlepage Information
\titleformat{\chapter}
[hang] %shape (see titlesec package documentation)
{\vspace{-2cm}\bfseries\Large}
{\thechapter}
{20pt} % distance between number and title
{}
[]
\title{
{PAPER}\\
{UNIVERSITY}\\
}
\author{TEST TEST}
\date{12th June 2015}
%Actual Document Begins and is laid out%
\begin{document}
\maketitle
\chapter*{Acknowledgements}
%\input{chapters/Acknowledgements}
\tableofcontents
\listoffigures
\listoftables
\chapter{Introduction}
%\input{chapters/Introduction}
\lipsum
\chapter{Aims}
%\input{chapters/Aims}
\lipsum
\chapter{History}
%\input{chapters/History}
\lipsum
\end{document}