latex笔记(学习课程来自b站Castelu)

本文详细介绍了如何在LaTeX中正确使用数学符号、排版技巧以及创建定理环境,包括行内公式、行间公式、数学表达式、符号排版、图形插入等内容,适合论文写作和数学表达需求。
摘要由CSDN通过智能技术生成

\documentclass[a4paper,11pt,UTF8]{article}
\usepackage{CTEX}%可以输入中文
\usepackage{diagbox}%可以输入表格
\usepackage{graphicx}%可以插入图片
\usepackage{amssymb}%数学字体与符号,此宏包已经包括了 amsfonts,不需要重复使用
\usepackage{mathrsfs}%数学花体
\usepackage[arrow,matrix]{xy}%绘制直线、各种曲线、箭头、多边形、直方图和交换图表
\usepackage{bm}%粗体
\usepackage{bbm}%空心数字空心字母
\usepackage{amsmath}%公式
\usepackage{amsthm}%定理
\usepackage{amscd}%只支持简单矩形图
\usepackage{xypic}%交换图
\usepackage{indentfirst}%首段缩进。此宏包会被 ctex 系列宏包引用,一般没有必要使用


\def\d{\textup{d}}%当输入 \d 时显示d的正体

%\theoremstyle{风格选项:plain, definition, remark}
%plain: 正体,花体;
%definition: 正体,正体
%remark: 花体,正体
%\newtheorem {环境名} {标题} [排序单位]
\theoremstyle{plain}
\newtheorem{thm}{定理}[section]
\newtheorem{lem}{引理}[section]
\newtheorem{prop}{命题}[section]
\newtheorem{cor}{推论}[section]

\theoremstyle{definition}
\newtheorem{defn}{定义}[section]
\newtheorem{exmp}{例子}[section]
\newtheorem*{ack}{致谢}

\theoremstyle{remark}
\newtheorem{rem}{注释}[section]

%\renewcommand{name}{definition}
%name:原先命令名称
%definition:命令的具体定义
\renewcommand{\qedsymbol}{$\square$}
\renewcommand\baselinestretch{1.25}%1.25倍段间距

\title{\LaTeX使用教学:论文}
\author{Castelu}
\date{\today}

\begin{document}
\maketitle

\begin{abstract}
    本文讲解运用\LaTeX撰写论文的方法
\end{abstract}

\setcounter{section}{-1}%把引言编号向前平移一位
\section{引言}
1、行内公式: $x+y+z=1.$

2、行间公式:
 $$x+y+z=1.$$

 3、美元号、反斜杠和大括号等是\LaTeX的内置符号

\section{数学符号}

1、加、减、乘、除、点乘、加减、减加、等于、约等于: 
$$+,-,\times,\div,\cdot,\pm,\mp,=,\approx.$$

2、小于等于、大于等于、远小于、远大于、不等于、恒等于:
$$\le,\ge,\ll,\gg,\ne,\equiv.$$

3、下标、上标、上下标:
$$x_2,x^2,C_n^m,a_{ij},f^{(n)}.$$

4、分数: $\frac{b}{a}$, 行间公式自动放大
$$\frac{b}{a}.$$

5、行内公式手动放大: $\displaystyle\frac{b}{a}.$

6、分数自带否决放大效果,不论行内还是行间,都需要手动放大
$$\frac{c}{\frac{a}{b}},\frac{c}{\displaystyle\frac{a}{b}}.$$

7、根号:$\sqrt{a},\sqrt[n]{a}.$

8、极限、连加、连乘、直和、张量积:
$$\lim\limits_{x\rightarrow 0}x,\sum\limits_{i=1}^na_i,
\prod\limits_{i=1}^nb_i,\bigoplus\limits_{i=1}^nV_i,
\bigotimes\limits_{i=1}^nW_i.$$

9、自定义正上下标与多重下标:
$$\mathop{\times}\limits_{i=1}^nc_i,
\lim\limits_{\substack{x\rightarrow 0\\y\rightarrow 0}}xy.$$

10、属于、包含、交、并、空集:
$\in,\subset,\subseteq,\supset,\supseteq,\cap,\cup,\emptyset,\varnothing.$

11、符号的否定: $\not\in,\not\subset.$

12、整除号及其否定: $\mid,\not\mid,\nmid.$

13、空心符号: $\mathbb{N},\mathbb{Z},\mathbb{Q},\mathbb{R},
\mathbb{C},\mathbb{R},\mathbb{C},\mathbb{P}.$

14、花写符号: $\mathcal{A},\mathscr{Z},\mathfrak{g}.$

15、全称量词与存在量词: $\forall,\exists.$

16、小写希腊字母: $\alpha,\beta,\gamma,\delta,\epsilon,
\varepsilon,\eta,\theta,\lambda,\mu,\pi,\rho,\sigma,\tau,
\phi,\varphi,\psi,\omega,\xi,\zeta.$

17、大写希腊字母: $\Gamma,\Delta,\Pi,\Sigma,\Phi,\Psi,\Omega.$

18、无穷大、阿列夫: $\infty,\aleph.$

19、三角函数、对数函数:$\sin,\cos,\tan,\cot,\log,\lg,\ln.$

20、微分、积分、偏微分、重积分、曲线积分:$$\d x,\int_a^bf(x)\d x,
\frac{\partial y}{\partial x},\iint_D f(x,y)\d x\d y,
\oint_DP\d x+Q\d y.$$

21、上划线、上波浪线、上尖号、向量:$\overline{AB},\widetilde{AB},
\widehat{AB},\overrightarrow{AB}.$

22、反斜杠、大括号:$\backslash,\left\{a\right\}.$

23、括号、自适应括号、单侧括号:$$(a),[a],\left(\frac{1}{2},1\right),
\left.\frac{1}{2},1\right),\left(\frac{1}{2},1\right.$$
%自适应括号,左右两边用 \left 和 \right作用; 
%单侧括号对希望隐藏的那边用 \left. 或 \right. 作用

24、线性方程组
$$\left\{\begin{array}{l}
    x+y=1,\\
    x-y=1.\\
\end{array}\right.$$
%本质上是单侧大括号与数组的合成

$$\begin{cases}
x+y=1,\\
x-y=1.
\end{cases}$$


25、矩阵
$$A=\left({\begin{array}{*{20}{c}}
    {a_{11}}&{a_{12}}&{\cdots}&{a_{1n}}\\
    {a_{21}}&{a_{22}}&{\cdots}&{a_{2n}}\\
    {\vdots}&{\vdots}&{}&{\vdots}\\
    {a_{n1}}&{a_{n2}}&{\cdots}&{a_{nn}}\\
\end{array}}\right).$$
%本质上是自适应括号与数组的合成
%水平省略号是 cdots ;竖直省略号是 vdots ;
%从左上到右下的省略号是 ddots ,从右上到左下的省略号需要用 rotate 宏包将 ddots 逆时针旋转90度得到

26、逻辑联结词:$\wedge,\vee.$

27、相抵合同、相似同构:$\sim,\cong.$

28、梯度:$\nabla.$

29、箭头
$$\rightarrow,\Rightarrow,\rightrightarrows,\Leftrightarrow,
\iff,\mapsto,\hookrightarrow.$$

30、几何
$$\circ,\triangle,\odot,\bot,\parallel.$$

\section{符号排版}

1、映射
$$\begin{array}{*{20}{c}}
    {f:}&{A\rightarrow B}\\
    {}&{a\mapsto f(a)}\\
\end{array}$$
%引入数组,可以看成不带括号的矩阵

2、换行对齐
\begin{displaymath}
    \begin{array}{lll}
        a&=&a+a+a+a+a+a+a+a+a\\
        &=&a+a+a+a+a+a+a+a+a.
    \end{array}
\end{displaymath}
%displaymath 自带 $$ 效果,最后一行不需要加 \\

\begin{displaymath}
    \begin{array}{lll}
        &&a+a+a+a+a+a+a+a+a\\
        &=&a+a+a+a+a+a+a+a+a.
    \end{array}
\end{displaymath}
    
\begin{displaymath}
    \begin{array}{lll}
        a&=&a+a+a+a+a+a+a+a+a\\
        &&+b+b+b+b+b+b+b+b+b.       
    \end{array}
\end{displaymath}

\begin{displaymath}
    \begin{array}{lll}
        a&=&a+a+\left(b+b+b+b+b+b+b\right.\\
        &&+\left.b+b\right)+a+a+a+a+a+a.
    \end{array}
\end{displaymath}
%自适应括号 \left和 \right分两行写在latex中无法被解析, 所以需要用单侧括号
%可以在两个&之间使用任何需要被对齐的符号,eg. + > ...

3、displaymath 和 frac 一样自带否决放大效果,需要手动放大,必要时调整行间距
\renewcommand*{\arraystretch}{1.5}%将段落调整为1.5倍行距
\begin{displaymath}
    \begin{array}{lll}
        \displaystyle\frac{b}{a}&=&\displaystyle\frac{a}{b}+
        \frac{b}{a}+\frac{b}{a}+\frac{b}{a}+\frac{b}{a}
        +\frac{b}{a}+\frac{b}{a}+\frac{b}{a}\\
        &=&\displaystyle\frac{b}{a}+\frac{b}{a}+\frac{b}{a}+
        \frac{b}{a}+\frac{b}{a}+\frac{b}{a}+\frac{b}{a}
        +\frac{b}{a}+\frac{b}{a}.
    \end{array}
\end{displaymath}
\renewcommand*{\arraystretch}{1}%将行距调整回来

4、公式中插入文字:
$\text{勾股定理:}a^2+b^2=c^2.$

5、交换图
$$\xymatrix{
    A_1\ar[d]_{h_1}\ar[r]^{f_1}&\ar[d]_{h_2}B_1\ar[r]^{g_1}&
    C_1\ar[d]_{h_3}\\
    A_2\ar[r]^{f_2}&B_2\ar[r]^{g_2}&C_2}$$

    $$\xymatrix{
    A\ar[drr]_h\ar[r]^f&B\ar[dr]^g &\\
    &&C} $$
%箭头下方用 _{ }, 箭头上方用 ^{ }
%箭头方向上up下down左left右right [u] [d] [l] [r]
%隐藏的顶点反映在代码中是,两个&之间什么都不写

6、项目编号:
\begin{enumerate}
    \item 第一
    \item 第二
    \item 第三
\end{enumerate}
\begin{enumerate}
    \item[(1)] 第一
    \item[(2)] 第二
    \item[(3)] 第三
\end{enumerate}

7、表格%用到了 diagbox 宏包
\begin{center}%表示居中
    \begin{tabular}{|m{3cm}<{\centering}|m{3cm}
        <{\centering}|m{3cm}<{\centering}|}%3cm表示列宽
        \hline%表示换行
        \textbf{第一列}&\textbf{第二例}&\textbf{第三列}\\
        \hline
        &&\\
        \hline
    \end{tabular}
\end{center}
8、插图
\begin{center}
    \includegraphics[scale=0.7]{./fermat.png}
\end{center}
\section{定理环境}
\begin{lem}
    引理
 \end{lem}

\begin{thm}
        定理
\end{thm}

\begin{prop}
    命题
\end{prop}

\begin{cor}
    推论
\end{cor}

\begin{defn}
    定义
\end{defn}

\begin{exmp}
    例子
\end{exmp}

\begin{proof}
    证明
\end{proof}

\begin{lem}[名称]
    带有名称的引理
\end{lem}

使用标签,生成两次后失效:
\begin{defn}\label{D3.2}
    带有标签的定义
\end{defn}

\begin{defn}
    定义\ref{D3.2}中我们提到...
\end{defn}

\begin{ack}
    感谢大家观看
\end{ack}

\bibliographystyle{elsarticle-num-names}

\begin{thebibliography}{60}
    \bibitem{1}作者,\emph{题目},期刊,\textbf{卷号}(年份)
    ,页码.
\end{thebibliography}
\end{document}


  • 7
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值