为了使我的main.txt
更具可读性,我想使用与保存在同一个文件夹中的\include{titlepage}
位置。 我也使用了它,它工作正常,所以一定是哪里出了问题(对吧)?titlepage
main.txt
\include
Chapter1.txt
titlepage
titlepage.txt
看起来像这样
%titlepage
\thispagestyle{empty}
\begin{center}
\begin{minipage}{0.75\linewidth}
\centering
%University logo
\includegraphics[width=0.5\linewidth]{unilogo.png}
% \rule{0.4\linewidth}{0.15\linewidth}\par
\par
\vspace{3cm}
%Thesis title
{\uppercase{\Large the title of my thesis project which may span multiple lines\par}}
\vspace{3cm}
%Author's name
{\Large Your name\par}
\vspace{3cm}
%Degree
{\Large A thesis submitted for the degree of Doctor of Philosophy\par}
\vspace{3cm}
%Date
{\Large May 2014}
\end{minipage}
\end{center}
%\clearpage
答案1
\include{<file>}
预计<file>.tex
可用,而不是<file>.txt
,因此请重命名文件以匹配.tex
扩展名。
\include
以下是LaTeX 内核中的定义摘录latex.ltx
:
\def\include#1{\relax
\ifnum\@auxout=\@partaux
\@latex@error{\string\include\space cannot be nested}\@eha
\else \@include#1 \fi}
\def\@include#1 {%
\clearpage
\if@filesw
\immediate\write\@mainaux{\string\@input{#1.aux}}%
\fi
\@tempswatrue
\if@partsw
\@tempswafalse
\edef\reserved@b{#1}%
\@for\reserved@a:=\@partlist\do
{\ifx\reserved@a\reserved@b\@tempswatrue\fi}%
\fi
\if@tempswa
\let\@auxout\@partaux
\if@filesw
\immediate\openout\@partaux #1.aux
\immediate\write\@partaux{\relax}%
\fi
\@input@{#1.tex}% <------------------------------------ .tex extension added
\clearpage
\@writeckpt{#1}%
\if@filesw
\immediate\closeout\@partaux
\fi
\else
\deadcycles\z@
\@nameuse{cp@#1}%
\fi
\let\@auxout\@mainaux}
\@include
从 调用了subdiariare \include
,然后执行了操作\@input@{#1.tex}
(上面突出显示),暗示了.tex
扩展。