根据模板正确格式化目录

根据模板正确格式化目录

我需要格式化论文中各个章节和小节的标题以及目录。我改编了部门网站上提供的模板。我得到了完全符合预期的结果。

我还希望您在序言末尾对以下代码进行解释。

\makeatletter
\catcode`\ =12\let\@nl@space= \catcode`\ =10
\newcount\@nl@rlevel
\newcount\@nl@llevel
\@nl@llevel=-1

\def\@nl{%
    \catcode`\ =12
    \global\@nl@rlevel=0
    \futurelet\@nl@store\@nl@%
}


\makeatother

顺便说一句,这不是我的论文。一时兴起,我决定发布带有童话故事文字的模板代码。

这是主文件。

\documentclass[10pt, oneside]{book}

% packages
\usepackage{amssymb, amsmath, amsthm}

% these make top, right, bottom margins confirming to the requirements

\usepackage[a4paper,bindingoffset=0.0in,%
left=1.5in,right=1in,top=1in,bottom=1in,%
footskip=.25in]{geometry}

\usepackage{setspace}
\usepackage{blindtext}

% small stuff
\usepackage{amsfonts}
\usepackage{amscd}
\usepackage{mathbbol}
\usepackage{hyperref}
\urlstyle{same}

\usepackage{footnote}

\hypersetup{colorlinks,linkcolor={black},citecolor={black},urlcolor={black}}

\usepackage{microtype}
% \usepackage{showkeys}
% uncomment this when editing cross-references
\numberwithin{equation}{section}

% this makes the chapters start with a 2" margin
\makeatletter
\renewcommand*\@makechapterhead[1]{%
    \vspace*{0.75in}%
    {\parindent \z@ \raggedright \normalfont
        \ifnum \c@secnumdepth >\m@ne
        \huge\bfseries \@chapapp\space \thechapter
        \par\nobreak
        \vskip 20\p@
        \fi
        \interlinepenalty\@M
        \Huge \bfseries #1\par\nobreak
        \vskip 40\p@
}}
\renewcommand*\@makeschapterhead[1]{%
    \vspace*{0.75in}%
    {\parindent \z@ \raggedright
        \normalfont
        \interlinepenalty\@M
        \Huge \bfseries  #1\par\nobreak
        \vskip 40\p@
}}
\makeatother

% theorem style


\theoremstyle{plain}

\newtheorem{theorem}[subsection]{Theorem}
\newtheorem{proposition}[subsection]{Proposition}
\newtheorem{lemma}[subsection]{Lemma}
\newtheorem{corollary}[subsection]{Corollary}
\newtheorem{conjecture}[subsection]{Conjecture}
\newtheorem{principle}[subsection]{Principle}
\newtheorem{claim}[subsection]{Claim}
%\newtheorem*{main-theorem-1}{Main Theorem}
%\newtheorem*{nil-to-local-repeat}{Proposition \ref{nil-to-local}}
%\newtheorem*{restate-tech-thm}{Theorem \ref{mainthm-tech}}

\theoremstyle{definition}

\newtheorem{definition}[subsection]{Definition}
\newtheorem{problem}{Problem}

\theoremstyle{remark}

\newtheorem{example}{Example}
\newtheorem{examples}{Examples}
\newtheorem*{remark}{Remark}
\newtheorem*{remarks}{Remarks}

%I prefer slanted leq and geq symbols
\renewcommand{\leq}{\leqslant}
\renewcommand{\geq}{\geqslant}

%This is all so I could finish a proof with an equation if need be.
\newsavebox{\proofbox}
\savebox{\proofbox}{\begin{picture}(7,7)%
    \put(0,0){\framebox(7,7){}}\end{picture}}
\def\boxeq{\tag*{\usebox{\proofbox}}}



%\def\proof{\noindent\textit{Proof. }}
\def\endproof{\hfill{\usebox{\proofbox}}}




\parindent 0mm
\parskip   5mm % this should make \ni and  obsolete, hopefully
%\newenvironment{proof}{\noindent {\bf Proof} }{\endprf\par}
\def \endprf{\hfill  {\vrule height6pt width6pt depth0pt}\medskip}



\makeatletter
\catcode`\ =12\let\@nl@space= \catcode`\ =10
\newcount\@nl@rlevel
\newcount\@nl@llevel
\@nl@llevel=-1

\def\@nl{%
    \catcode`\ =12
    \global\@nl@rlevel=0
    \futurelet\@nl@store\@nl@%
}


\makeatother
%------------------------------------------------




% doesn't count introduction when numbering theorems, etc.
\setcounter{chapter}{0}

% makes page numbers appear
\pagestyle{plain}


\begin{document}

% makes the page numbers roman numerals, doesn't count
% these pages in the table of contents
\frontmatter

\thispagestyle{empty}

\vbox to 1truein{}

\centerline{Fairy Tales throughout History}



\vskip 200pt

\centerline{BY}
\vskip 10pt

\centerline{A Storyteller}
\vskip 10pt

\centerline{BA, Bard College}
\centerline{MA, Columbia University}

\vskip 215pt

\centerline{DISSERTATION}
\vskip 10pt

\centerline{Submitted in partial fulfillment of the requirements for}
\centerline{the degree of Doctor of Philosophy in English}
\centerline{in the Graduate School of}
\centerline{Columbia University}


\newpage


\thispagestyle{empty}

\vbox to 9.0truein{}

\centerline{\copyright\ Copyright by A Storyteller 2023}

\

\centerline{All Rights Reserved}

\newpage



\chapter*{Abstract}
\begin{doublespace}
Fairy tales' rich, imaginative stories for children~---~involving fantastical creatures and exotic places~---~offer far more than entertainment and happily-ever-after endings. They furnish children with a landscape for critical thinking skills and a context in which children can evaluate their own emotions and decision making.
\end{doublespace}


\newpage

\chapter*{Dedication}
\bigskip

\centerline{Dedicated to the Grimm Brothers and Hans Christian Anderson}

\newpage

\chapter*{Acknowledgements}
I wish to thank Walt Disney for animating various fairy tales in full color.


\newpage

\tableofcontents

% Changes page numbers to regular numbers, resets the counter
\mainmatter

%This gives 10pt font with 20pt spacing, text from here should be double spaced
\fontsize{10}{20pt} \selectfont

% \include puts in the .tex file with the given name
% make sure that these files don't have any preamble material

\begin{doublespacing}
    
\include{introduction_February_9}

\include{chapter_1_February_9}


\include{chapter_2_February_9}


\include{chapter_3_February_9}


\include{conclusion_February_9}


\end{doublespacing}

% add a new chapter without a chapter # for the references
\addcontentsline{toc}{chapter}{Bibliography}

\begin{thebibliography}{9}

\bibitem[Southey 1837]{Southey}Robert Southey, \emph{The Doctor},  Longman, Rees, Orme, Brown, Green and Longman, London, England, 1837, pages 318-326

\end{thebibliography}



\end{document}

这是简介。文件的名称是“introduction_February_9”。

%
%
%
% Introduction
%
%

%Make the Introduction a chapter without a number.
\chapter*{Introduction}

% and include it on the table of contents
\addcontentsline{toc}{chapter}{Introduction}


We will look at various fairy tales and myths in civilizations throughout history!

这是第 1 章。文件名为“chapter_1_February_9”。

%
%  Chapter 1
%
%
%
%
%
\chapter{Fairy Tales from Ancient Greece}
\label{ch1}
% the label lets you refer to the chapter by number later.





\section{Theogony: Clash of the Titans}
\label{s1.1}

Talk some more.

\subsection{Subsection Title}
\label{ss1.1.1}

Be specific.

% if you want a subsection, but with no number
\subsection*{Numberless Subsection}

% you have to manually add it to the table of contents
\addcontentsline{toc}{subsection}{Numberless Subsection}
\label{ss1.1.2}

\section{Prometheus and the Theft of Fire}
\label{s1.2}

Talk it up.

% you can do the same with sections, just * them and add them to the contents if you want.



\section{Pandora’s Box}

Keep going


\section{The Abduction of Persephone by Hades}

Way to go!

这是第 2 章。文件名为“chapter_2_February_9”。

%
%  Chapter 2
%
%
%
%
%
\chapter{Fairy Tales from Ancient Rome}
\label{ch2}
% the label lets you refer to the chapter by number later.

{\em Talk a little.} \cite{keyword1}

\section{Romulus and Remus}

{\em Pages of exposition.}

\section{Aeneas (by the poet Virgil)}

{\em Pages of exposition.}
\label{s2.1}

{\em Talk a lot.}

%\begin{thm}[Theorem 1 \cite{keyword2}]
\label{thm1}
%Stuff is important.
%\end{thm}

\section{Scaevola}

{\em Pages of exposition.}
\label{s2.2}

{\em Do it again.}

\section{The Legend of Lucretia}

{\em Pages of exposition.}


%Theorem~\ref{thm1} is really important.  Chapter~\ref{ch1} was awesome.

这是第 3 章。文件名是“chapter_3_February_9”。

%
%  Chapter 3
%
%
%
%
%
\chapter{European Fairy Tales}
\label{ch3}
%This label lets you refer to the chapter by number later.

{\em A paragraph} \cite{keyword1}

\section{English Fairy Tales}

{\em Pages of exposition.}

\subsection{Cinderella}

{\em Talk a little}

\subsection{Beauty and the Beast}

{\em Talk a little}


\subsection{Snow White and the Seven Dwarfs}

{\em Talk a little}


\subsection{Jack and the Beanstalk}

{\em Talk a little}


\subsection{Sleeping Beauty}

{\em Talk a little}

\subsection{Puss in Boots}

{\em Talk a little}



%\begin{thm}[Theorem 1 \cite{keyword2}]
\label{thm1}
%Stuff is important.
%\end{thm}

\section{German}

{\em Pages of exposition.}


\subsection{Rapunzel}

{\em Talk a little}

\subsection{Little Red Riding Hood (retold by The Brothers Grimm)}
{\em Talk a little}


\subsection{Rumpelstiltskin}
{\em Talk a little}

\section{Norwegian}

{\em Pages of exposition.}


\subsection{East of the Sun and West of the Moon}
{\em Talk a little}

\subsection{The Boy with the Beer Keg}
{\em Talk a little}

\subsection{Legends from the Mill}
{\em Talk a little}

\subsection{An evening at the neighbors}
{\em Talk a little}

这是结论。文件的名称是“conclusion_February_9”。

%
%
%
%Conclusions
%
%
%Do not put a chapter number on this section.
\chapter*{Conclusions}

% but include it on the contents
\addcontentsline{toc}{chapter}{Conclusions}

Draw some conclusions.

相关内容