【LaTex】基础语法

该文章已生成可运行项目,

一、基本语法

1.1文档

\documentclass{artical} 
%documentclass制定了文档的类型,最常用的是artical,其他的还有book、beamer等
\documentclass[UTF8]{ctexart} 
ctexart的作用是允许中文和英文混排
  1. 所有在begin{document}之前的内容都属于前言,可以在这里设置文档的格式,页面的尺寸,文档中需要导入的包等等
  2. begin和end{document}之间属于正式内容
\documentclass[UTF8]{ctexart} 
 
\title{文章的标题}
\author{zxx}
\date{\today}
\begin{document}
	\maketitle
	你好!
\end{document}

注意

  1. title 指定文章的内容

  2. author 指定作者

  3. date 说明日期

    要想让这些内容显示出来,需要在正文部分添加 \maketitle

1.2内容

  1. textbf{}–加粗
  2. textit{}–斜体
  3. underline{}–下划线

1.3章节

	\section{第一章节}
	第一章的内容
	\subsection{第一章节中的第一小节}
	第一小节的内容
	\subsection{第一章节中的第二小结}
	第二小节的内容
	\section{第二章节}
	第二章的内容

1.4图片

\usepackage{graphicx}
\begin{figure}
	\centering
	\caption{sehun}
	\includegraphics[width=0.5\textwidth]
	{C:/Users/Desktop}
\end{figure}

注意

  1. usepackage{graphicx},要想插入图片就要引入这个包
  2. \includegraphics[width=0.5\textwidth]{C:/Users/Desktop}的作用:width设置为当前文本宽度的{}里面是图片路径,注意斜杠方向
  3. 如果想要添加标题,首先要将图片放到\begin{figure}和\end{figure}中
  4. \caption里面放标题,\centering表示居中显示

1.5列表

\begin{itemize}
	\item 1
	\item 2
	\item 3
\end{itemize}
	
\begin{enumerate}
	\item 帅
	\item 超级帅
	\item 天下第一帅
\end{enumerate}

注意

  1. itemize是[无序列表],注意每一个项前面都要加上\item
  2. enumerate是[有序列表]

1.6、公式

爱因斯坦的智能守恒方程为:$E=mc^2$
	
	\begin{equation}
		a=b+c
	\end{equation}
	
	\[
	d={k\varphi(n)+1}\over e
	\]

注意

  1. 如果在行内插入公式,需要使用$$括起来
  2. 如果另起一行插入公式

常用排版

段落

居中
\begin{center}
要居中的内容
\end{center}

文本、变量

加粗
\textbf{A}、\boldsymbol{A}、\boldsymbol{我们}、\textbf{我们}、我们
斜体
\textit{我们}、\it{我们}
向量(顶有向量箭头→)
\vec v

v⃗ \vec v v

估计(顶有尖头hat)
\hat{y}

y^ \hat{y} y^

平均(顶有横线)
% \overline的线稍长,能覆盖所有字符
\bar x ,\overline x,\bar{AB} ,\overline{AB}	

xˉ∣x‾∣ABˉ∣AB‾ \bar x | \overline x | \bar{AB} | \overline{AB} xˉxABˉAB

顶有波浪号~
% \widetilde能覆盖所有字符
\tilde x ,\widetilde x,\tilde{AB} ,\widetilde{AB}

x~x~AB~AB~ \tilde x \widetilde x \tilde{AB} \widetilde{AB} x~xAB~AB

分式
\frac{分子}{分母}
\frac{2}{3}
\frac{x+y}{2}

2×35 \frac{2 \times 3}{5} 52×3

符号

属于
\in

∈ \in

集合之间的各种关系(包含于、包含、真包含于……)
A\subset B
A\supset B
A\subseteq B
A\supseteq B
A\cap B
A\cup B
% A减B
A\setminus B
\emptyset

A⊂BA⊃BA⊆BA⊇BA∩BA∪BA∖B∅ A\subset B\\ A\supset B\\ A\subseteq B\\ A\supseteq B\\ A\cap B\\ A\cup B\\ % A减B A\setminus B\\ \emptyset ABABABABABABAB

任意
\forall

∀ \forall

存在
\exist或者\exists

∃ \exist

因为、所以
\because 和 \therefore

∵∴ \because\\ \therefore

无穷大
\infty +\infty -\infty

∞+∞−∞ \infty \\ +\infty \\ -\infty +

尖括号(也就是常见的向量夹角)

注意与小于号<,大于号> 区别

\langle

\rangle

小于等于、大于等于、不等于、恒等于、恒不等于
\le 或者 \leq

≤\le

\ge 或者 \geq

≥\ge

\ne 或者 \neq

≠\ne=

\equiv

≡\equiv

\not\equiv  # 注意这里只能是拼接\not和\equiv,\nequiv无效

≢ \not\equiv

\ll,\gg

≪≫ \ll \\ \gg

\approx

\lceil x \rceil

x

\lfloor x \rfloor

x

绝对值

\left|-2\right| 或者 \vert -2\vert 或者  \lvert -2\rvert 

∣−2∣、∣−2∣、∣−2∣

开n次方

\sqrt{2}、\sqrt[3]{4}

2、43 \sqrt{2}、\sqrt[3]{4} 234

导数

% 求导
\frac{\mathrm{d}y}{\mathrm{d}x}
% 高阶导
\frac{\mathrm{d}^{n} y}{\mathrm{d}x^{n}}
% 求偏导
\frac{\partial{Loss}}{\partial{w}}
% 二阶偏导
\frac{\partial^{2}z}{\partial{x}^{2}}
\frac{\partial^{2}z}{\partial{x}\partial{y}}

sin⁡2x=2sinxcosx \sin 2x = 2sinxcosx sin2x=2sinxcosx

sin⁡2x=2sinxcosx\sin 2x = 2sinxcosxsin2x=2sinxcosx

本文章已经生成可运行项目
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值