我正在使用 MasterDoctoralThesis 课程,您可以在这里找到https://www.latextemplates.com/template/masters-doctoral-thesis。
这是我的主要内容:
\documentclass[
11pt,
english,
singlespacing,
headsepline
]{MastersDoctoralThesis}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{mathpazo}
\usepackage[backend=bibtex,style=authoryear,natbib=true]{biblatex} )
\addbibresource{example.bib}
\usepackage[autostyle=true]{csquotes}
%----------------------------------------------------------------------------------------
% MARGIN SETTINGS
%----------------------------------------------------------------------------------------
\geometry{
paper=a4paper,
inner=2.5cm,
outer=3.8cm,
bindingoffset=.5cm,
top=1.5cm,
bottom=1.5cm
}
%----------------------------------------------------------------------------------------
% THESIS INFORMATION
%----------------------------------------------------------------------------------------
\thesistitle{Title Thesis}
\supervisor{Prof. X \textsc{Y} \\ Dr. Z \textsc{W}}
\degree{Master of Science in Electronic Engineering}
\author{Name \textsc{Surname}}
\subject{Electronic Engineering}
\keywords{}
\university{{Università}}
\department{{Department of Information Engineering, Electronics and Telecommunications}}
\group{{Master of Science in Electronic Engineering}}
\faculty{{Faculty of Information Engineering, Informatics and Statistics}}
\AtBeginDocument{
\hypersetup{pdftitle=\ttitle}
\hypersetup{pdfauthor=\authorname}
\hypersetup{pdfkeywords=\keywordnames}
}
\begin{document}
\frontmatter
\pagestyle{plain}
%----------------------------------------------------------------------------------------
% TITLE PAGE
%----------------------------------------------------------------------------------------
\begin{titlepage}
\begin{center}
\includegraphics[scale=1]{logo.jpg}
\end{center}
\begin{center}
\vspace*{.01\textheight}
\textsc{\Large Master Thesis}\\[1cm]
\HRule \\[0.4cm]
{\huge \bfseries \ttitle\par}\vspace{0.4cm}
\HRule \\[1.5cm]
\begin{minipage}[t]{0.4\textwidth}
\begin{flushleft} \large
\emph{Author:}\\
\href{}{\authorname}
\end{flushleft}
\end{minipage}
\begin{minipage}[t]{0.4\textwidth}
\begin{flushright} \large
\emph{Supervisor:} \\
{\supname}
\end{flushright}
\end{minipage}\\[2cm]
\begin{center}
\includegraphics[scale=0.4]{logo2.jpg}\hfill\includegraphics[scale=0.5]{logo3.jpg}
\end{center}
\vspace*{1.5cm}
\groupname\\\deptname\\[1.5cm]
\vfill
\rule{3cm}{1pt}\\
{\large \today}\\[4cm]
%\includegraphics{Logo}
\vfill
\end{center}
\end{titlepage}
%----------------------------------------------------------------------------------------
% QUOTATION PAGE
%----------------------------------------------------------------------------------------
\vspace*{0.2\textheight}
\begin{flushright}
\thispagestyle{empty}
\vspace*{5cm}
\itshape\enquote{Something}\\[0.3cm]
\end{flushright}
\hfill Name
%----------------------------------------------------------------------------------------
% ABSTRACT PAGE
%----------------------------------------------------------------------------------------
\begin{abstract}
\addchaptertocentry{\abstractname}
The Thesis Abstract is written here (and usually kept to just this page). The page is kept centered vertically so can expand into the blank space above the title too\ldots
\end{abstract}
%----------------------------------------------------------------------------------------
% ACKNOWLEDGEMENTS
%----------------------------------------------------------------------------------------
\begin{acknowledgements}
\addchaptertocentry{\acknowledgementname}
The acknowledgments and the people to thank go here, don't forget to include your project advisor\ldots
\end{acknowledgements}
%----------------------------------------------------------------------------------------
% LIST OF CONTENTS/FIGURES/TABLES PAGES
%----------------------------------------------------------------------------------------
\tableofcontents
\listoffigures
\listoftables
%----------------------------------------------------------------------------------------
% ABBREVIATIONS
%----------------------------------------------------------------------------------------
\begin{abbreviations}{ll} %
\textbf{LAH} & \textbf{L}ist \textbf{A}bbreviations \textbf{H}ere\\
\textbf{WSF} & \textbf{W}hat (it) \textbf{S}tands \textbf{F}or\\
\end{abbreviations}
%----------------------------------------------------------------------------------------
% PHYSICAL CONSTANTS/OTHER DEFINITIONS
%----------------------------------------------------------------------------------------
\begin{constants}{lr@{${}={}$}l}
Speed of Light & $c_{0}$ & \SI{2.99792458e8}{\meter\per\second} (exact)\\
\end{constants}
%----------------------------------------------------------------------------------------
% SYMBOLS
%----------------------------------------------------------------------------------------
\begin{symbols}{lll}
$a$ & distance & \si{\meter} \\
$P$ & power & \si{\watt} (\si{\joule\per\second}) \\
%Symbol & Name & Unit \\
\addlinespace
$\omega$ & angular frequency & \si{\radian} \\
\end{symbols}
%----------------------------------------------------------------------------------------
% DEDICATION
%----------------------------------------------------------------------------------------
\dedicatory{For my family}
\end{document}
%----------------------------------------------------------------------------------------
% THESIS CONTENT - CHAPTERS
%----------------------------------------------------------------------------------------
\mainmatter
\pagestyle{thesis}
\include{Chapters/Introduction}
%\include{Chapters/Chapter1}
这是我的第一章,其中有一个人物:
% Chapter 1
\chapter{Titlte} % Main chapter title
\label{Chapter1} % For referencing the chapter elsewhere, use \ref{Chapter1}
%----------------------------------------------------------------------------------------
% Define some commands to keep the formatting separated from the content
%\newcommand{\keyword}[1]{\textbf{#1}}
%\newcommand{\tabhead}[1]{\textbf{#1}}
%\newcommand{\code}[1]{\texttt{#1}}
%\newcommand{\file}[1]{\texttt{\bfseries#1}}
%\newcommand{\option}[1]{\texttt{\itshape#1}}
%----------------------------------------------------------------------------------------
Introduction
\section{Layout}
Write here my text
\begin{center}
\includegraphics[scale=0.5]{Layout.jpg}
\caption{This is the caption of the figure}
\end{center}
问题是,我试图为我的图添加标题,在这样做之前,主程序编译没有问题,但我一添加\caption
它就返回了一些错误。特别是在主程序中,我有:
I can't write on file 'Chapters/Introduction.aux'\include{Chapters/Introduction}
Emergency stop \include{Chapters/Introduction}
由于我没有改变简介,所以我真的无法理解。
然后在第一章中我出现了这个错误:
Undefined control sequence \section
如果我删除,\caption
一切都会恢复正常。
另外,我想知道是否有办法自动将图形添加到图形列表中。
有人能帮帮我吗?谢谢。
答案1
您不能\caption
在浮点数之外使用宏(例如figure
或table
环境)。对于此类用例,有一个capt-of
包。有了它,您可以在所述环境之外使用,因此可以在序言中\captionof
执行以下操作:\usepackage{capt-of}
\begin{minipage}
\centering
\includegraphics{example-image-duck}
\captionof{figure}{A friendly looking duck\label{fig:duck}}
\end{minipage}
capt-of
如果您正在使用包caption
或类似 KOMA 脚本类scrartcl
,那么即使没有包,上述操作也是可能的。
但包含数字的正常方式是与figure
环境一起:
\begin{figure}
\centering
\includegraphics{example-image-duck}
\caption{A friendly looking duck\label{fig:duck}}
\end{figure}
使用该center
环境似乎不是一个好主意,因为它不会阻止图形和其标题之间的分页符。