本文承接LaTex入门3,同样归类于LaTex讲解专栏中。
本篇的主要内容:
1. 图像(Figure) 2. 定理(Theorem)/自定义环境 3.自定义快捷符号(Custom Macros)
在文档中的图像(Figure)操作:
also we can refer Figure \ref{sigmoid}
\begin{figure}
\centering
\includegraphics[width=\textwidth]{sigmoid.png}
\caption{Sigmoid}
\label{sigmoid}
\end{figure}
定理(Theorem)
在写作时我们经常需要引用一些定理,在overleaf中,我们可以先引入几个需要用到的package:
\usepackage{amsmath,amsfonts,amsthm}
\newtheorem{thm}{Theorem}[section]
%这里有两个参数,第一个{}中的参数代表你对新建立的theorem环境的称呼,
%换而言之就是之后\begin{} \end{}时括号内放的称呼
%第二个{}内是在文档中展现出来的样子。
%[]中代表着你的定理是依据哪个部分进行编号的,比如这里的section,意味着你的定理编号形式是:“section编号”."定理编号"
\begin{thm}[Shell Theorem]
A spherically symmetric body affects external objects gravitationally as though all of its mass were concentrated at a point at its center.
\end{thm}
\begin{thm}
Just another theorem.
\end{thm}
\begin{proof}
Just proof. %书写证明部分
\end{proof}
我们可以在这个基础上再自定义一些环境,比如我们这里定义推论(corollary)
\newtheorem{thm}{Theorem}[section]
\newtheorem{corollary}{Corollary}[thm]
\begin{thm}[Shell Theorem]
A spherically symmetric body affects external objects gravitationally as though all of its mass were concentrated at a point at its center.
\end{thm}
\begin{corollary}
This is the corollary of the shell theorem.
\end{corollary}
自定义快捷符号(Custom Macros)
我们可以使用"\newcommand{}{}" 和 "\newcommand{}[]{}" 来实现对符号以及矩阵的自定义快捷方式。
\newcommand{\R}{$\mathbb{R}$}
The real number \R
\newcommand{\M}[3]{\begin{bmatrix}
#1 \\
#2 \\
#3
\end{bmatrix}}
Marix $\M{1}{2}{3}$