天天看點

LaTeX中的數學公式 - GarfieldEr007

LaTeX中的數學公式

2016-06-09 13:08 

GarfieldEr007 

閱讀(4913) 

評論(0) 

編輯 

收藏 

舉報

因為想在過年之前把論文寫出來(雖然現在看來似乎癡人說夢),用word寫PDE的公式簡直是自己找虐,就想說自己研究一下LaTex,用起來發現這東西寫格式性的文檔真心甩word幾個陳景潤啊,出來的公式不僅可以自動排版,還可以非常友善的設定Label,甚至連平時最費力的參考文獻也變得so easy了,不過這東西不是所見即所得,是以沒有程式設計基礎和樹結構概念的人可能用起來就比較吃力,但是一旦會用就完全不想打開word了....

LaTeX中的數學公式 - GarfieldEr007

數學公式是Latex的大強項,是以主要記錄了如下的一些數學公式的關鍵字,以備不時之需,其中參考了各方教程,但是看下來還是感覺英文的原版更平易近人,中文的教程好多都是湊字數來的:

%LaTex使用一個規定的數學模型來展現數學公式,如果要在Tex中進入math mode,需要

%使用$符号來包圍你所需要顯示的公式

% 一些規定

%1.數學模式中的變量為italic斜體字母

%2.數學模式中的空格全部被忽略,tex自行安排公式各部分間距

%3.公式分為行内公式和行間公式

%4.數字字型的大小(也就是顯示樣式),不做特殊說明系統自動選取,也可以強制規定

\documentclass[11pt]{article}

\usepackage{latexsym,bm,amsmath,amssymb} %Latex中數學包

\usepackage{CJK}

\begin{document}

\begin{CJK*}{GBK}{song}

\textbf{ Hi, This is Lucy\'s \LARGE \LaTeX Math Example.}\\\\

%---------------------------(一)如何顯示公式-------------------------------

\noindent公式 $1+1=??$ 的解是 $2$ \\ %需要用mathmode顯示公式的時候需要将其放在兩個$中間

\noindent而公式 \[ 2+2=?? \] 的解是 \[ 4\] \\ %如果需要将公式在獨立行居中顯示則要将其放在兩個\[之間

還有帶Label的公式顯示\begin{equation}

%這種equation的方法可以為公式建立一個lable,這個lable可以用在後面的引用中,寫論文尤其需要啊

3+3=6

\end{equation}

%-------------------(二) 如何定義顯示的樣式----------------------

普通方式顯示一個求和公式 $\sum_{i=0}^n i^3$\\

可以看到,普通大小的求和符号很難看,是以我們可以使用displaystyle 來定義

\[ \displaystyle\sum\limits_{i=0}^n i^3 \] %這樣就高大上多了

%--------------------(三) 如何排列公式----------------------------

"align*"可以幫助你非常整齊的排列一系列方程 (要使用align需要包含amsmath的包)

\begin{align*}

2x^5+2(y-3)(z-1) & =x^3+3(x^5-3y+3z-2)\\

&=2x+5x^5-6y*4+5z-3\\

&=5x^5+3y^2+z

\end{align*}

%可以看到,在align中像表格一樣用&來區分每一列 用\\來區分每一行,注意到在align中并不需要使用将

%公式轉化為數學模式的符号$或者\[\],因為它已經預設在數學模式下編輯

”align“除了可以像處理表格一樣排列公式以外,還可以為其加上label

\begin{align}

2x^2 + 3(x-1)(x-2) & = 2x^2 + 3(x^2-3x+2)\\

\nonumber &= 2x^2 + 3x^2 - 9x + 6\\

&= 5x^2 - 9x + 6

\end{align}

%nonumber可以控制是否為公式加label

%---------------------------(四)一些數學例子------------------

\section{Example}

\begin{enumerate}

\item \normalsize分數的表示——\Large {frac}

\[\displaystyle \frac{x}{4y}=\frac{y}{4z}\]

\item \normalsize開方的表示——\Large {sqrt}

\[ \sqrt{x^2-3x}+\sqrt{x^2-1}=2 \]

\[ \sqrt{8-2\sqrt{15|}} \] %嵌套

\item \normalsize 對齊公式的表示——\Large eqnarray*或者eqnarray

\begin{eqnarray*}

x+y+z=3\\

2x-y+z=5\\

3x+2y-z=16

\end{eqnarray*}

\begin{eqnarray*}

3C &=& 2G \\

7G &=& 9A \\

6T &=& 11C

\end{eqnarray*}

\item \normalsize 上标顯示—— 指數符号

\[ 2^{14X^2+5y-6z}=15^{x+4y^4} \]

\item \normalsize 點乘号——\Large cdot\\

$(1,1,8)$ since $1 \cdot 1 \cdot 8 = 8 $ \\

\item \normalsize 強調(黑體)——\Large mathbf

\[ x+y*3=\mathbf{45}\]

\item \normalsize 省略号——\Large ldots

\[ 66, 67, 70, 71, 72, 73, 74, 75, 77 \ldots \]

\item \normalsize 條件符号——\Large mid

\[ x+y \mid x \].

\item \normalsize 無窮大—— \Large infty

\[ \infty Lucy \infty\]

\item \normalsize 三角函數——\Large sin/cos/theta

\begin{eqnarray*}

A &=& 4r\sqrt{1-\frac{x^2}{r^2}} \\

x &=& r\sin^2\theta \\

\theta &=& \arcsin\frac{x}{r}

\end{eqnarray*}

\item \normalsize 不等号——\Large neq

\[ x\neq y\]

\item \normalsize 圓圈符号——\Large circ

\[ (f\circ g)(x)=f(g(x))\]

\item \normalsize 對數符号——\Large log

\[ \log_b tt=1 \]

\item \normalsize 極限——\Large lim

\[ f\'(a)= \lim_{h \rightarrow 0 }\frac{f(a+h)-f(a)}{h} \]

\item \normalsize 在數學公式中插入文字——\Large mbox

\[ 1x2=34 \mbox{Lucy測試文檔} \]

\item \normalsize 各種括号——\Large left right

` \\大括号

\[ \left\{ x+4y^3=z \right\} \]

中括号

\[ \left[ (f)(x)=498y+z \right] \]

直線

\[ \left| aga heh he \right| \]

雙豎線(範數)

\[ \left\| \frac{a}{b} \right\| \]

取整函數

\[ \lfloor \frac{a}{b} \rfloor \]

取頂函數

\[ \lceil \frac{a}{b} \rceil \]

斜線與反斜線

\[ \left/ \frac{a}{b} \right \backslash \]

上下箭頭

\[ \left\uparrow \frac{a}{b} \right\downarrow \]

\[ \left\Uparrow \frac{c}{d} \right\Downarrow \]

角括号

\[ \left\langle \frac{a}{b}\right \rangle \]

使用big Big bigg 和Bigg 控制括号的大小

\[ \Bigg( \bigg[ \Big\{ \big\langle \left| \frac{a}{b} \right| \]

\item \normalsize 矩陣——\Large matrix

用小括号括起來的矩陣

\[

\begin{pmatrix}

3 & 5 & 9\

6 & 6 & 2\

9 & 8 & 4

\end{pmatrix}

\]

用中括号括起來的矩陣

\[

\begin{bmatrix}

3 & 5 & 9\

6 & 6 & 2\

9 & 8 &4

\end{bmatrix}

\]

用單豎線括起來的矩陣

\[

\begin{vmatrix}

3 & 5 & 9\

6 & 6 & 2\

9 & 8 & 4

\end{vmatrix}

\]

用雙豎線括起來的矩陣

\[

\begin{Vmatrix}

3 & 5 & 9\

6 & 6 & 2\

9 & 8 &4

\end{Vmatrix}

\]

\end{enumerate}

\end{CJK*}

\end{document}

運作結果(因為用winEdt作為環境,需要下載下傳CJK的中文更新檔才能編譯成功)

出來的公式太好看了,而且超級友善!~

from: http://blog.sina.com.cn/s/blog_5e3213f30101gx0h.html

  • 分類 LaTeX/Markdown
  • 标簽 LaTex

    , 數學

    , 公式

    , 排版

LaTeX中的數學公式 - GarfieldEr007