改进我的序言

改进我的序言

我正处于论文写作的这个阶段,任何事情都会分散我的注意力,现在我正在清理我的 tex 序言,我的文档布局几乎完美到我想要的程度。有没有建议使用“清洁工”代码将不胜感激。这是我使用 latex 编写的第一篇文档。

%----------------------------------------------------------------------------------------
%   PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------
\documentclass[11.5pt]{report} % Change font size here
\usepackage[margin=2.5cm]{geometry} % Change margins to 2.5cm on all sides
\geometry{a4paper} % Set the page size to be A4 
\usepackage{graphicx} % Required for including pictures
\usepackage{caption}
\usepackage{subcaption}
\usepackage{float} % Allows putting an [H] in \begin{figure} to specify the exact location of the figure
\usepackage{wrapfig} % Allows in-line images
\graphicspath{{../figures/}}  % Specifies the directory where pictures are stored
\usepackage[T1]{fontenc}
\usepackage{newtxmath,newtxtext} %times new roman font
\usepackage[utf8]{inputenc} % Unicode Characters
\linespread{1.2} % Line spacing\frac{(\overline{w'c'})
\usepackage[hyphenbreaks]{breakurl}
\usepackage[hyphens]{url}

%used to center the chapter headings and decrease the space before and after the heading which is unreasonable in the normal setting
\usepackage{titlesec}
\titleformat{\chapter}[display]
  {\normalfont\huge\bfseries\centering}
  {\chaptertitlename\ \thechapter}{-5pt}{\huge}
  \titlespacing*{\chapter}{0pt}{-50pt}{10pt} 

\usepackage[colorlinks=true,urlcolor=blue,citecolor=blue,linkcolor=black,bookmarks=true,pagebackref]{hyperref} % makes color citations
\renewcommand{\backrefxxx}[3]{%
  (\hyperlink{page.#1}{$\uparrow$#1})} %this is to add backref from bib to text, used with pagebackref^

\usepackage[sort&compress,round,semicolon,authoryear]{natbib}
\usepackage{siunitx}
\usepackage{gensymb}
\usepackage{pdfpages}
\usepackage{tabularx}
\usepackage{glossaries}
\usepackage{bookmark}
\setcounter{secnumdepth}{0} % only number chapters 
\usepackage[linguistics]{forest} % to create pretty diagrams
\usepackage[nottoc,numbib]{tocbibind}
\usepackage{tikz-qtree}
\usepackage{minitoc}
\usepackage{tocloft}
\setlength\cftparskip{0pt}
\setlength\cftbeforechapskip{0pt}


\titleformat{\paragraph}
{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
\titlespacing*{\paragraph}
{0pt}{3pt plus 1pt minus 1pt}{1ex plus .2ex}

\usetikzlibrary{arrows.meta}
\tikzset{
  my rounded corners/.append style={rounded corners=2pt},
}
\colorlet{linecol}{black!75}
\setcounter{tocdepth}{1}

\bookmarksetup{
  numbered,
  open
}

\setlength{\parindent}{0pt}
\setlength{\parskip}{0.5em}
\setlength{\cftbeforetoctitleskip}{0pt}
\setlength{\cftbeforeloftitleskip}{0pt}
\setlength{\cftbeforelottitleskip}{0pt}

%\renewcommand*{\thesection}{\arabic{section}}

% document begin
\begin{document}

%----------------------------------------------------------------------------------------
%   Title page
%----------------------------------------------------------------------------------------
\pagenumbering{Roman}
\input{../1titlepage&abstract/titlepage.tex}
\thispagestyle{empty}

%----------------------------------------------------------------------------------------
%   Declaration
%----------------------------------------------------------------------------------------
\input{../2preface&acknowledgements/declaration.tex}
\thispagestyle{empty}
\newpage

%----------------------------------------------------------------------------------------
%   Abstract
%----------------------------------------------------------------------------------------
\input{../1titlepage&abstract/abstract.tex}
\newpage

%----------------------------------------------------------------------------------------
%   Dedication
%----------------------------------------------------------------------------------------
\input{../2preface&acknowledgements/dedication.tex}
\thispagestyle{empty}
\newpage

%----------------------------------------------------------------------------------------
%   Preface
%----------------------------------------------------------------------------------------
\input{../2preface&acknowledgements/preface.tex}
\newpage

%----------------------------------------------------------------------------------------
%   Table of contents
%----------------------------------------------------------------------------------------
\pagenumbering{roman}
\tableofcontents % Include a table of contents
\addtocontents{toc}{~\hfill\textbf{Page}\par}
\newpage % Begins the essay on a new page instead of on the same page as the table of contents 

%----------------------------------------------------------------------------------------
%   List of Figures
%----------------------------------------------------------------------------------------
\listoffigures
\addtocontents{lof}{~\hfill\textbf{Page}\par}
\newpage

%----------------------------------------------------------------------------------------
%   List of Tables
%----------------------------------------------------------------------------------------
\listoftables
\addtocontents{lot}{~\hfill\textbf{Page}\par}
\newpage

%----------------------------------------------------------------------------------------
%   List of Abbreviations
%----------------------------------------------------------------------------------------
%\makeglossaries
%\input{../glossaries/glossaries.tex}
%\printglossaries
%\newpage

%----------------------------------------------------------------------------------------
%   Section: Introduction and background
%----------------------------------------------------------------------------------------
\input{../3background&introduction/background&introduction.tex} 

%----------------------------------------------------------------------------------------
%   Subsection: Aims, Objectives and Layout
%----------------------------------------------------------------------------------------
\input{../5aims&objectives/aims&objectives.tex}
\newpage

%----------------------------------------------------------------------------------------
%   Study Area, Data & Methods
%----------------------------------------------------------------------------------------
\input{../4data&methods/data&methods.tex}
\newpage

%----------------------------------------------------------------------------------------
%   Objective1
%----------------------------------------------------------------------------------------
\input{../6objective1/objective1.tex}
\newpage

%----------------------------------------------------------------------------------------
%   Obejctive2
%----------------------------------------------------------------------------------------
\input{../7objective2/objective2.tex}
\newpage

%----------------------------------------------------------------------------------------
%   Obejctive3
%----------------------------------------------------------------------------------------
\input{../8objective3/objective3.tex}
\newpage

%----------------------------------------------------------------------------------------
%   Conclusion
%----------------------------------------------------------------------------------------
\chapter{Conclusion} % Major section
\label{ch:conclusion}
\newpage

%----------------------------------------------------------------------------------------
%   Bibliography
%----------------------------------------------------------------------------------------
\bibliographystyle{agsm}%Choose a bibliograhpic style
\renewcommand{\bibpreamble}{$\uparrow$ refers back to in text citations}
\bibliography{../bibliography/master}
\label{sec:bib}

%----------------------------------------------------------------------------------------

\end{document}

请原谅我为自己做的所有笔记。

编辑:我接受了 user124577 的回答,但是,我意识到组织序言的方法不止一种。我真的没想到这么快就能收到所有有用的反馈。我可以诚实地数出在我所在的大学里使用 latex 的人数,这个网站是上帝赐予我的,让我在没有太多其他支持的情况下真正理解 latex。

答案1

也许只是作为评论的未经测试的摘要(请随意编辑和添加):

\documentclass[11pt]{report} % Change font size here
\usepackage[a4paper,margin=2.5cm]{geometry} % Change margins to 2.5cm on all sides

%% language, input and output options
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} % Unicode Characters
\usepackage{newtxmath,newtxtext} %times new roman font

%% graphics and float packages
\usepackage{graphicx} % Required for including pictures
\usepackage{wrapfig} % Allows in-line images
\usepackage{caption}
\usepackage{subcaption}
\usepackage{float} % Allows putting an [H] in \begin{figure} to specify the exact location of the figure
\graphicspath{{../figures/}}  % Specifies the directory where pictures are stored

%% inclusion of other packages
\usepackage[sort&compress,round,semicolon,authoryear]{natbib}
\usepackage{siunitx}
\usepackage{gensymb}
\usepackage{pdfpages}
\usepackage{tabularx}
\usepackage{glossaries}
\usepackage{tocloft}
\usepackage[linguistics]{forest} % to create pretty diagrams
\usepackage[nottoc,numbib]{tocbibind}
\usepackage{tikz-qtree}

%% setup titles and sectioning
\usepackage{titlesec}
\titleformat{\chapter}[display]
  {\normalfont\huge\bfseries\centering}
  {\chaptertitlename\ \thechapter}{-5pt}{\huge}
  \titlespacing*{\chapter}{0pt}{-50pt}{10pt}     
\titleformat{\paragraph}
{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
\titlespacing*{\paragraph}
{0pt}{3pt plus 1pt minus 1pt}{1ex plus .2ex}

%% setup tikz, bookmarks, colors
\colorlet{linecol}{black!75}
\usetikzlibrary{arrows.meta}
\tikzset{
  my rounded corners/.append style={rounded corners=2pt},
}

%% modify links
\usepackage[hyphenbreaks]{breakurl}
\usepackage[hyphens]{url}
\usepackage[colorlinks=true,urlcolor=blue,citecolor=blue,linkcolor=black,bookmarks=true,pagebackref]{hyperref} % makes color citations
\renewcommand{\backrefxxx}[3]{%
  (\hyperlink{page.#1}{$\uparrow$#1})} %this is to add backref from bib to text, used with pagebackref
\usepackage{bookmark}
\bookmarksetup{numbered,open}

%% change lengths
\setlength{\parindent}{0pt}
\setlength{\parskip}{0.5em plus 0.2em minus 0.2em}
\linespread{1.2} % Line spacing\frac{(\overline{w'c'})
\setcounter{secnumdepth}{0} % only number chapters
\setcounter{tocdepth}{1}
\setlength{\cftbeforetoctitleskip}{0pt}
\setlength{\cftbeforeloftitleskip}{0pt}
\setlength{\cftbeforelottitleskip}{0pt}
\setlength\cftparskip{0pt}
\setlength\cftbeforechapskip{0pt}

%\renewcommand*{\thesection}{\arabic{section}}

% document begin
\begin{document}

%----------------------------------------------------------------------------------------
%   Title page
%----------------------------------------------------------------------------------------
\pagenumbering{Roman}
\input{../1titlepage&abstract/titlepage.tex}
\thispagestyle{empty}

%----------------------------------------------------------------------------------------
%   Declaration
%----------------------------------------------------------------------------------------
\input{../2preface&acknowledgements/declaration.tex}
\thispagestyle{empty}
\newpage

%----------------------------------------------------------------------------------------
%   Abstract
%----------------------------------------------------------------------------------------
\input{../1titlepage&abstract/abstract.tex}
\newpage

%----------------------------------------------------------------------------------------
%   Dedication
%----------------------------------------------------------------------------------------
\input{../2preface&acknowledgements/dedication.tex}
\thispagestyle{empty}
\newpage

%----------------------------------------------------------------------------------------
%   Preface
%----------------------------------------------------------------------------------------
\input{../2preface&acknowledgements/preface.tex}
\newpage

%----------------------------------------------------------------------------------------
%   Table of contents
%----------------------------------------------------------------------------------------
\pagenumbering{roman}
\tableofcontents % Include a table of contents
\addtocontents{toc}{~\hfill\textbf{Page}\par}
\newpage % Begins the essay on a new page instead of on the same page as the table of contents 

%----------------------------------------------------------------------------------------
%   List of Figures
%----------------------------------------------------------------------------------------
\listoffigures
\addtocontents{lof}{~\hfill\textbf{Page}\par}
\newpage

%----------------------------------------------------------------------------------------
%   List of Tables
%----------------------------------------------------------------------------------------
\listoftables
\addtocontents{lot}{~\hfill\textbf{Page}\par}
\newpage

%----------------------------------------------------------------------------------------
%   List of Abbreviations
%----------------------------------------------------------------------------------------
%\makeglossaries
%\input{../glossaries/glossaries.tex}
%\printglossaries
%\newpage

%----------------------------------------------------------------------------------------
%   Section: Introduction and background
%----------------------------------------------------------------------------------------
\input{../3background&introduction/background&introduction.tex} 

%----------------------------------------------------------------------------------------
%   Subsection: Aims, Objectives and Layout
%----------------------------------------------------------------------------------------
\input{../5aims&objectives/aims&objectives.tex}
\newpage

%----------------------------------------------------------------------------------------
%   Study Area, Data & Methods
%----------------------------------------------------------------------------------------
\input{../4data&methods/data&methods.tex}
\newpage

%----------------------------------------------------------------------------------------
%   Objective1
%----------------------------------------------------------------------------------------
\input{../6objective1/objective1.tex}
\newpage

%----------------------------------------------------------------------------------------
%   Obejctive2
%----------------------------------------------------------------------------------------
\input{../7objective2/objective2.tex}
\newpage

%----------------------------------------------------------------------------------------
%   Obejctive3
%----------------------------------------------------------------------------------------
\input{../8objective3/objective3.tex}
\newpage

%----------------------------------------------------------------------------------------
%   Conclusion
%----------------------------------------------------------------------------------------
\chapter{Conclusion} % Major section
\label{ch:conclusion}
\newpage

%----------------------------------------------------------------------------------------
%   Bibliography
%----------------------------------------------------------------------------------------
\bibliographystyle{agsm}%Choose a bibliograhpic style
\renewcommand{\bibpreamble}{$\uparrow$ refers back to in text citations}
\bibliography{../bibliography/master}
\label{sec:bib}

%----------------------------------------------------------------------------------------

\end{document}

相关内容