锵锵~本文是基于Overleaf的Latex学习的第二部分。
目录
1. 结构化文档
这一部分更像是论文的写作,包括标题、摘要、引用等内容
\documentclass{article} %告诉Latex文档类型为Article
\title{The Title} %{}里面是标题
\author{A. Author}%{}作者
\date{\today} %{\today}Latex会智能的显示文档编辑时的日期
\begin{document} %开始写文档
\maketitle %在文档中显示之前写好的标题
\begin{abstract} %摘要部分从下面开始,注意,这里{}内就是abstract,不要改
Abstract goes here...
\end{abstract}
\end{document}
运行结果:
接下来,我们尝试为论文添加Introduction, Method, Results等部分:
\documentclass{article}
\begin{document}
\section{Introduction}
The problem of \ldots
\section{Method}
We investigate \ldots
\subsection{Sample Preparation}
\subsection{Data Collection}
\section{Results}
\section{Conclusion}
\end{document}
注意:\section不需要\end{section}。
运行结果:
好~,至此,论文的框架有了,那么如果我们想在文中(尤其是摘要中),介绍我们这几个部分的大体内容或提到我们的某个公式时,该怎么样显得好看又不会出错呢?接下来就是 \label 和 \ref大显身手的时候啦(要引用公式的话,需要用到 \eqref 即 equation reference)
\documentclass{article}
\usepackage{amsmath} % for \eqref
\begin{document}
\section{Introduction}
\label{sec:intro}
In Section \ref{sec:method}, we \ldots
\section{Method}
\label{sec:method}
\begin{equation}
\label{eq:euler}
e^{i\pi} + 1 = 0
\end{equation}
By \eqref{eq:euler}, we have \ldots
\end{document}
运行结果:
到这一步就把Overleaf官网上Free online introduction to LaTeX (part 2)的第一部分Structured Documents的知识点都练习一遍了,在随后附上的Exercise中,我犯了一个错误:在要引用处写的是 \label{...}
正确的写法应该是:\ref{...},在被引用的地方才是要给加label之处。
下面,贴出第一篇正儿八经自己打的Latex论文:
\documentclass{article}
\usepackage{amsmath}
\title{The Relationship Between the UNIVAC Computer and Evolutionary Programming}
\author{Bob, Carol and Alice}
\date{February 20, 2014}
\begin{document}
\maketitle
\begin{abstract}
Many electrical engineers would agree that, had it not been for online algorithms, the evaluation of red-black trees might never have occurred. In our research, we demonstrate the significant unification of massive multiplayer online role-playing games and the location-identity split. We concentrate our efforts on demonstrating that reinforcement learning can be made peer-to-peer, autonomous, and cacheable.
\end{abstract}
\section{Introduction}
Many analysts wo