论文结构

论文结构

我正在尝试LaTeX使用从大学网站下载的模板来组织我的论文。该模板由一个“主”文件组成,该.tex文件对每个章节使用不同的文件。当我编写一个章节来编译文件时,我必须组装“主”文件。为了避免错误,我习惯每隔几分钟编译一次:这意味着我必须浪费大量时间来退出我正在编写的文件。有没有更简单的方法?

答案1

\include{...}进行部分编译的一种方法是在文档正文和\includeonly{fileA,fileB,...}序言中使用。

那么仅包含文件fileA等等。fileB

\include保留了参考标签,但引入了一个新页面,因此它注定用于带有 的外部文件\chapter

还有一个excludeonly带有\excludeonly命令的包,它基本上可以set complement完成 的功能\includeonly

还请注意,通常不需要离开编辑器,删除/编译某些内容并再次进入编辑器(我们不再处于 70 年代末、80 年代末或 90 年代初了 ;-))

个人声明:我一点也不喜欢这种分割文件的做法。

\documentclass{book}

\usepackage[innermargin=1.5cm,outermargin=2cm]{geometry}
\usepackage{hyperref}% Before cleveref
\usepackage{cleveref}

\begin{filecontents}{introchapter.tex}
\chapter{Theory on Brontosaurs} \label{theory}


\begin{enumerate}
  \item Brontosaurs were large
  \item Brontosaurs are thin at one end, thick in the middle and thin again on the other end.
\end{enumerate}
\end{filecontents}


\begin{filecontents}{excavations.tex}
\chapter{Excavations of  Brontosaurs} \label{excavations}

After we stated the theory in \cref{theory} we want to provide you with the most exciting rules of excavating a Brontosaur.

This is the basic strategy:

\begin{itemize}
  \item Dig a hole
  \item Throw away anything that does not really resemble a Brontosaur
  \item In the very end you should have at least some parts of a Brontosaur
\end{itemize}
\end{filecontents}

\begin{filecontents}{results.tex}
\chapter{Results} \label{results}

We found that Brontosaurs are thin at one end, thick in the middle and thin again on the other end. Period!
\end{filecontents}


% Make sure to run the file first with this disabled, after that remove the % before \includeonly 
%\includeonly{excavations,results}


\title{Theory of Brontosaurs}
\author{Ann Elk (Misses)}
\date{April 05, 2063}

\begin{document}

\frontmatter
\maketitle

\tableofcontents

\mainmatter
\include{introchapter}
\include{excavations}
\include{results}

\backmatter

% Other stuff here, e.g. Appendix, references etc. 

\end{document}

在此处输入图片描述

相关内容