「LaTex」- 快速开始(学习笔记)

  CREATED BY JENKINSBOT

通过参考 Learn LaTeX in 30 minutes – Overleaf, Online LaTeX Editor 页面,我们对 LaTex 展开快速学习。

该笔记将记录:在学习上述页面时,我们记下的笔记。

编辑工具

使用纯文本编辑器可以完成 LaTeX 编写,但是工具让我们更加高效、准确:
1)使用 Overleaf 在线编辑查看;
2)Visual Studio Code + LaTeX Workshop;(我们正在使用的工具)

编写简单的 LaTeX 文档

% 指定文档类型,除了 article 还有 book、report 等等
\documentclass{article}

% 文档开始,以 \end{document} 结束
% This is known as the body of the document.
\begin{document}
First document. This is a simple example, with no
extra parameters or packages included.

% This is a commnet.
\end{document}

稍微复杂的 LaTex 文档

% 定义字体大小与纸张大小
\documentclass[12pt, letterpaper]{article}
\usepackage[utf8]{inputenc} % 指定文档编码

% 为文档添加标题
\title{First document}
\author{Hubert Farnsworth \thanks{funded by the Overleaf team}}
\date{February 2014}

\begin{document}

% 使标题能够显示出来
\maketitle

% 这是一行普通的文本
We have now added a title, author and date to our first \LaTeX{} document!

% 为字体设置特殊样式
Some of the \textbf{greatest} % bold
discoveries in \underline{science} % italics
were made by \textbf{\textit{accident}}. % Underline

% \emph 的命令取决与上下文:在正常情况下,会将字体倾斜;在斜体中,会将字体变正常
Some of the greatest \emph{discoveries}
in science
were made by accident.

\textit{Some of the greatest \emph{discoveries}
in science
were made by accident.}

\textbf{Some of the greatest \emph{discoveries}
in science
were made by accident.}

% Unordered lists
\begin{itemize}
  \item The individual entries are indicated with a black dot, a so-called bullet.
  \item The text in the entries may be of any length.
\end{itemize}

% Ordered lists
\begin{enumerate}
  \item This is the first entry in our list
  \item The list numbers increase with each entry we add
\end{enumerate}

\end{document}

引用图片

\documentclass{article}
\usepackage{graphicx} % 引入 graphicx 包
\graphicspath{ {images/} } % 指定图片搜索路径

\begin{document}
The universe is immense and it seems to be homogeneous,
in a large scale, everywhere we look at.

\includegraphics{universe} % 使用图片(可以省略扩展名,LaTeX 会自动搜索)

There's a picture of a galaxy above
\end{document}

旋转文本

rotating – How to rotate text inline? – TeX – LaTeX Stack Exchange

\documentclass{article}
\usepackage{graphicx} % 需要引入该包

\begin{document}
	A\rotatebox{90}{B}C
	A\rotatebox{270}{B}C
	A\rotatebox[origin=c]{270}{B}C
\end{document}

参考文献

Commenting in Latex – texblog
Page size and margins – Overleaf, Online LaTeX Editor