16LaTeX學習系列之---LaTeX數學公式的補充

目錄

[TOC]html

本系列是有關LaTeX的學習系列,共計19篇,本章節是第16篇。 前一篇:15LaTeX學習系列之---LaTeX裏插入數學公式 後一篇:17LaTeX學習系列之---LaTeX的版面設計 總目錄:19LaTeX學習系列之---LaTeX的總結函數

前言

前一節咱們學習了怎麼在LaTeX中插入數學公式,本小節,咱們補充在LaTeX中長公式的使用。學習

(一)知識點說明

1.基礎細節

  1. ** 號問題:在環境中有星號則無編號,無星號有編號。
  2. \ \ :換行
  3. \ref{fig:01}引用標籤,\label{fig:01}添加標籤,實現交叉引用
  4. \text{文字}:在數學模式中輸入文字

2.gather環境

用途:能夠寫多行公式,對齊方式是總體中間對齊spa

(1)帶編號的

%多行公式--帶編號
	\begin{gather}
		a + b +c = b + a \\
		1+2 = 2 + 1
	\end{gather}

$$ %多行公式--帶編號 \begin{gather} a + b +c = b + a \ 1+2 = 2 + 1 \end{gather} $$設計

(2)不帶編號

(下面的是否帶編號相似)code

%多行公式--不帶編號1
	\begin{gather*}
		a + b = b + a \\
		1+2 = 2 + 1
	\end{gather*}

$$ %多行公式--不帶編號1 \begin{gather*} a + b = b + a \ 1+2 = 2 + 1 \end{gather*} $$htm

(3)阻止編號

%多行公式--帶編號2 \notag 阻止編號
	\begin{gather}
	a + b = b + a \notag \\
	1+2 = 2 + 1 \notag
	\end{gather}

$$ %多行公式--帶編號2 \notag 阻止編號 \begin{gather} a + b = b + a \notag \ 1+2 = 2 + 1 \notag \end{gather} $$blog

3.align環境

按&號對齊,本身指定對齊方式get

% 按&號對齊,--帶編號
	\begin{align}
		a+b &= b+a \\
		1+2= & 2+1
	\end{align}

$$ % 按&號對齊,--帶編號 \begin{align} a+b &= b+a \ 1+2= & 2+1 \end{align} $$數學

4.split環境

當一個公式須要多行排版時,對齊方式也是按&對齊

%一個公式的多行排版--帶編號
	\begin{equation}
		\begin{split}
		\cos 2x &= \cos^2 x - \sin^2x \\
		&=2\cos^2x-1
		\end{split}	
	\end{equation}

$$ %一個公式的多行排版--帶編號 \begin{equation} \begin{split} \cos 2x &= \cos^2 x - \sin^2x \ &=2\cos^2x-1 \end{split} \end{equation} $$

5.cases環境

分段函數或者有左大括號的數學公式

%case環境, text{}在數學模式中處理中文-帶編號
	\begin{equation}
		D(x)=\begin{cases}
		1, & \text{若是} x \in \mathbb{Q};\\
		0, & \text{若是} x \in \mathbb{R}\setminus\mathbb{Q}
		\end{cases}
	\end{equation}

$$ %case環境, text{}在數學模式中處理中文-帶編號 \begin{equation} D(x)=\begin{cases} 1, & \text{若是} x \in \mathbb{Q};\ 0, & \text{若是} x \in \mathbb{R}\setminus\mathbb{Q} \end{cases} \end{equation} $$

(二)實例

1.源代碼

%導言區
\documentclass{ctexart}

%導入宏包
\usepackage{amsmath}
\usepackage{amssymb}

%正文區
\begin{document}
	%多行公式--帶編號
	\begin{gather}
		a + b +c = b + a \\
		1+2 = 2 + 1
	\end{gather}
	%多行公式--不帶編號1
	\begin{gather*}
		a + b = b + a \\
		1+2 = 2 + 1
	\end{gather*}
	
	%多行公式--帶編號2 \notag 阻止編號
	\begin{gather}
	a + b = b + a \notag \\
	1+2 = 2 + 1 \notag
	\end{gather}
	
	% 按&號對齊,--帶編號
	\begin{align}
		a+b &= b+a \\
		1+2= & 2+1
	\end{align}
	
	% 按&號對齊,--不帶編號
	\begin{align*}
	a+b &= b+a \\
	1+2 &=2+1
	\end{align*}
	
	%一個公式的多行排版--帶編號
	\begin{equation}
		\begin{split}
		\cos 2x &= \cos^2 x - \sin^2x \\
		&=2\cos^2x-1
		\end{split}	
	\end{equation}
	
	%一個公式的多行排版--不帶編號
	\begin{equation*}
	\begin{split}
	\cos 2x &= \cos^2 x - \sin^2x \\
	&=2\cos^2x-1
	\end{split}	
	\end{equation*}
	
	%case環境, text{}在數學模式中處理中文-帶編號
	\begin{equation}
		D(x)=\begin{cases}
		1, & \text{若是} x \in \mathbb{Q};\\
		0, & \text{若是} x \in \mathbb{R}\setminus\mathbb{Q}
		\end{cases}
	\end{equation}
	
	%case環境, text{}在數學模式中處理中文-不帶編號
	\begin{equation*}
	D(x)=\begin{cases}
	1, & \text{若是} x \in \mathbb{Q};\\
	0, & \text{若是} x \in \mathbb{R}\setminus\mathbb{Q}
	\end{cases}
	\end{equation*}

\end{document}

2.輸出效果

04.png

本系列是有關LaTeX的學習系列,共計19篇,本章節是第16篇。 前一篇:15LaTeX學習系列之---LaTeX裏插入數學公式 後一篇:17LaTeX學習系列之---LaTeX的版面設計 總目錄:19LaTeX學習系列之---LaTeX的總結

做者:Mark

日期:2019/03/06 週三

相關文章
相關標籤/搜索