在Markdown中輸入數學公式

寫在前面

最近想要把一些數學編程方面的筆記記錄成電子筆記,因為修改、插入新內容等比較方便。這里記一下在Markdown中輸入數學公式的方法。

基礎知識

公式與文本的區別

  1. 公式輸入和文本輸入屬于不同的模式,公式中無法通過空格來控制空白,通過特殊的符號來調整空白
  2. 公式不允許空行
  3. 公式中的字母全部會被解釋為變量,輸入普通文字需要特殊方法

插入行內公式

$a+b$
復制代碼

這是一個行內公式: a+b

插入單行公式

$$a+b$$
復制代碼

這是一個單行公式:

a+b

拔、撇、尖、向量箭頭 (Accents)

a', f'(x)a', f'(x)
\overline{A}, \overline{AB}\overline{A}, \overline{AB}
\hat{\theta}\hat{\theta}
\overrightarrow{AB}\overrightarrow{AB}

括號、絕對值、取整 (Delimiters)

(a)(a)[a][a]\{a\}\{a\}
\lvert a\rvert|a| or \lvert a\rvert\lfloor a\rfloor\floor a\rfloor\lceil a\rceil\lceil a\rceil

行列式、矩陣、線性方程組 (Environments)

\begin{vmatrix}a&b\\c&d\end{vmatrix}\begin{vmatrix}a&b\\c&d\end{vmatrix}
\begin{bmatrix}a&b\\c&d\end{bmatrix}\begin{bmatrix}a&b\\c&d\end{bmatrix}

方程組對齊: 以&為標準線

\begin{alignedat}{3}  10x&        &    +3&z&-4&= 2\\    3x&+13y&+100&z&   &=4 \end{alignedat}
$$\begin{alignedat}{3}
	10x&     &  +3&z&-4&=2\\
	 3x& +13y&+100&z&  &=4\end{alignedat}$$
復制代碼

HTML

字母、字體 (Letters and Unicode)

希臘字母

var前綴代表字母變體寫法

\Alpha\Alpha\Beta\Beta\Gamma\Gamma\Phi\Phi\varPhi\varPhi
\alpha\alpha\beta\beta\gamma\gamma\phi\phi\varphi\varphi

數集

\N\N 自然數
\R\R 實數
\Z^{+}\Z^{+} 正整數

\TeX

特殊字體

更多詳細用法見: 參考資料2-Formatting mathematics symbols

\KaTeX命令例子用法
\mathrm{...}\mathrm{ABC\ abc\ 123}f(x)\mathrm{\textcolor{red}{d}}x
\mathit{...}\mathit{ABC\ abc\ 123}比普通格式排版稍好一點
\mathbf{...}\mathbf{ABC\ abc\ 123}向量加粗
\mathbb{...}\mathbb{ABC\ k}特殊數集

加粗還可以使用\boldsymbol{...}

布局 (Layout)

刪除線、方框、橫向大括號 (Annotation)

\sout{abc}\sout{abc}1=\not21=\not2
\underbrace{x_1+\dots+x_n=0}_{\text{共n個}}$\underbrace{x_1+\dots+x_n=0}_{\text{共n個}}\boxed{x}+1=0\boxed{x}+1=0

上標、下標、空格 (Vertical Layout & Spacing)

\limits可以改變求和限、極限變量式的位置 \substack{...}中可以利用\\來實現二元極限: 二元極限例子(\KaTeX不支持)

邏輯運算符、集合運算符 (Logic and Set Teory)

\forall\forall\exist\exist\neg\neg
\cup\cup\cap\cap
\subset\subset or \sub\supset\supset or \sup\in\in
\to\to\gets\gets\leftrightarrow\leftrightarrow
\implies\implies\impliedby\impliedby\iff\iff

宏 (Macros)

運算符 (Operators)

可以直接從鍵盤輸入的符號

+ - = ! / ( ) [ ] < > | ' : *

+ - = ! / ( ) [ ] < > | ' : *
復制代碼

求和、求積、積分

\sum_{i=1}^{n}x_i\sum_{i=1}^{n}x_i\prod\prod
\sum\limits_{i=1}^{n}x_i\sum\limits_{i=1}^{n}x_i
\int_{a}^{+\infty}f(x)\mathrm{d}x\int_{a}^{+\infty}f(x)\mathrm{d}x\oiint\oiint

模、正負號、叉乘

分數 (Fractions and Binomials)

二項式(Binomials)用法見: 參考資料1-Fractions and Binomials

\frac{a}{1 + \frac{1}{b}}\frac{a}{1 + \frac{1}{b}}\dfrac{a}{1 + \frac{1}{b}}\dfrac{a}{1 + \frac{1}{b}}
\cfrac{a}{1 + \cfrac{1}{b}}\cfrac{a}{1 + \cfrac{1}{b}}\dfrac{a}{1 + \dfrac{1}{b}}\dfrac{a}{1 + \dfrac{1}{b}}

\cfrac似乎和\dfrac沒什么區別

三角函數、極限號、最大最小 (Math Operators)

\sin\sin\sh\sh
\log_{a}^{x}\log_{a}^{x}\ln(ax+b)\ln(ax+b)
\lim\limits_{x\to \infty,\ y\to\infty}(ax+b)\lim\limits_{x\to \infty}(ax+b)\lim_{x\to \infty}(ax+b)\lim_{x\to \infty}(ax+b)

根號 (\sqrt)

\sqrt{x}\sqrt{x} \sqrt[3]{ax+b}\sqrt[3]{ax+b}

關系符號 (Relations)

樣式、顏色、字號(Style, Color, Size, and Font)

顏色

\color{blue}F=ma\color{blue}F=ma \textcolor{blue}{F}=ma\textcolor{blue}{F}=ma \textcolor{#228B22}{F=ma}\textcolor{#228B22}{F=ma} \colorbox{aqua}{A}\colorbox{aqua}{A} \fcolorbox{red}{aqua}{A}\fcolorbox{red}{aqua}{A}

字號

\Huge AB\Huge AB\normalsize AB\normalsize AB
\huge AB\huge AB\small AB\small AB
\LARGE AB\LARGE AB\footnotesize AB\footnotesize AB
\Large AB\Large AB\scriptsize AB\scriptsize AB
\large AB\large AB\tiny AB\tiny AB

樣式

\displaystyle\sum_{i=1}^n\displaystyle\sum_{i=1}^n
\textstyle\sum_{i=1}^n\textstyle\sum_{i=1}^n

其他符號和標點 (Symbols and Punctuation)

\dots\dots\cdots\cdots\ddots\ddots\vdots\vdots
\square\square\blacksquare\blacksquare\blacktriangleright\blacktriangleright
\checkmark\checkmark\infty\infty\degree\degree

參考資料

  1. \KaTeX Supported Functions (字典)
  2. \LaTeX Mathematics Wiki (用法)

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/387968.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/387968.shtml
英文地址,請注明出處:http://en.pswp.cn/news/387968.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

如何不部署Keras / TensorFlow模型

While the most articles about deep learning are focusing at the modeling part, there are also few about how to deploy such models to production. Some of them say “production”, but they often simply use the un-optimized model and embed it into a Flask web…

[BZOJ3626] [LNOI2014] LCA 離線 樹鏈剖分

題面 考慮到詢問的\(l..r,z\)具有可減性&#xff0c;考慮把詢問差分掉&#xff0c;拆成\(r,z\)和\(l-1,z\)。 顯然這些LCA一定在\(z\)到根的路徑上。下面的問題就是怎么統計。 考慮不是那么暴力的暴力。 我們似乎可以把\(1..r\)的所有點先瞎搞一下&#xff0c;求出一個點內部有…

Linux查看系統各類信息

說明&#xff1a;Linux下可以在/proc/cpuinfo中看到每個cpu的詳細信息。但是對于雙核的cpu&#xff0c;在cpuinfo中會看到兩個cpu。常常會讓人誤以為是兩個單核的cpu。其實應該通過Physical Processor ID來區分單核和雙核。而Physical Processor ID可以從cpuinfo或者dmesg中找到…

biopython中文指南_Biopython新手指南-第1部分

biopython中文指南When you hear the word Biopython what is the first thing that came to your mind? A python library to handle biological data…? You are correct! Biopython provides a set of tools to perform bioinformatics computations on biological data s…

整合后臺服務和驅動代碼注入

整合后臺服務和驅動代碼注入 Home鍵的驅動代碼&#xff1a; /dev/input/event1: 0001 0066 00000001 /dev/input/event1: 0000 0000 00000000 /dev/input/event1: 0001 0066 00000000 /dev/input/event1: 0000 0000 00000000 對應輸入的驅動代碼&#xff1a; sendevent/dev/…

Java作業09-異常

6. 為如下代碼加上異常處理 byte[] content null; FileInputStream fis new FileInputStream("testfis.txt"); int bytesAvailabe fis.available();//獲得該文件可用的字節數 if(bytesAvailabe>0){content new byte[bytesAvailabe];//創建可容納文件大小的數組…

為數據計算提供強力引擎,阿里云文件存儲HDFS v1.0公測發布

2019獨角獸企業重金招聘Python工程師標準>>> 在2019年3月的北京云棲峰會上&#xff0c;阿里云正式推出全球首個云原生HDFS存儲服務—文件存儲HDFS&#xff0c;為數據分析業務在云上提供可線性擴展的吞吐能力和免運維的快速彈性伸縮能力&#xff0c;降低用戶TCO。阿里…

對食材的敬畏之心極致產品_這些數據科學產品組合將給您帶來敬畏和啟發(2020年中的版本)

對食材的敬畏之心極致產品重點 (Top highlight)為什么選擇投資組合&#xff1f; (Why portfolios?) Data science is a tough field. It combines in equal parts mathematics and statistics, computer science, and black magic. As of mid-2020, it is also a booming fiel…

android模擬用戶輸入

目錄(?)[-] geteventsendeventinput keyevent 本文講的是通過使用代碼&#xff0c;可以控制手機的屏幕和物理按鍵&#xff0c;也就是說不只是在某一個APP里去操作&#xff0c;而是整個手機系統。 getevent/sendevent getevent&sendevent 是Android系統下的一個工具&#x…

真格量化常見報錯信息和Debug方法

1.打印日志 1.1 在代碼中添加運行到特定部分的提示&#xff1a; 如果我們在用戶日志未能看到“調用到OnQuote事件”文字&#xff0c;說明其之前的代碼就出了問題&#xff0c;導致程序無法運行到OnQuote函數里的提示部分。解決方案為仔細檢查該部分之前的代碼是否出現問題。 1.2…

向量積判斷優劣弧_判斷經驗論文優劣的10條誡命

向量積判斷優劣弧There are a host of pathologies associated with the current peer review system that has been the subject of much discussion. One of the most substantive issues is that results reported in leading journals are commonly papers with the most e…

自定義PopView

改代碼是參考一個Demo直接改的&#xff0c;代碼中有一些漏洞&#xff0c;如果發現其他的問題&#xff0c;可以下方直接留言 .h文件 #import <UIKit/UIKit.h> typedef void(^PopoverBlock)(NSInteger index); interface CustomPopView : UIView //property(nonatomic,copy…

線控耳機監聽

當耳機的媒體按鍵被單擊后&#xff0c;Android系統會發出一個廣播&#xff0c;該廣播的攜帶者一個Action名為MEDIA_BUTTON的Intent。監聽該廣播便可以獲取手機的耳機媒體按鍵的單擊事件。 在Android中有個AudioManager類&#xff0c;該類會維護MEDIA_BUTTON廣播的分發&#xf…

當編程語言掌握在企業手中,是生機還是危機?

2019年4月&#xff0c;Java的收費時代來臨了&#xff01; Java是由Sun微系統公司在1995年推出的編程語言&#xff0c;2010年Oracle收購了Sun之后&#xff0c;Java的所有者也就自然變成了Oracle。2019年&#xff0c;Oracle宣布將停止Java 8更新的免費支持&#xff0c;未來Java的…

sql如何處理null值_如何正確處理SQL中的NULL值

sql如何處理null值前言 (Preface) A friend who has recently started learning SQL asked me about NULL values and how to deal with them. If you are new to SQL, this guide should give you insights into a topic that can be confusing to beginners.最近開始學習SQL的…

名言警句分享

“當你想做一件事&#xff0c;卻無能為力的時候&#xff0c;是最痛苦的。”基拉大和轉載于:https://www.cnblogs.com/yuxijun/p/9986489.html

文字創作類App分享-簡書

今天我用Mockplus做了一套簡書App的原型&#xff0c;這是一款文字創作類的App&#xff0c;用戶通過寫文、點贊等互動行為&#xff0c;提高自己在社區的影響力&#xff0c;打造個人品牌。我運用了Mockplus基礎組件、交互組件、移動組件等多個組件庫&#xff0c;簡單拖拽&#xf…

數據可視化 信息可視化_動機可視化

數據可視化 信息可視化John Snow’s map of Cholera cases near London’s Broad Street.約翰斯諾(John Snow)在倫敦寬街附近的霍亂病例地圖。 John Snow, “the father of epidemiology,” is famous for his cholera maps. These maps represent so many of our aspirations …

android 接聽和掛斷實現方式

轉載▼標簽&#xff1a; android 接聽 掛斷 it 分類&#xff1a; android應用技巧 參考&#xff1a;android 來電接聽和掛斷 支持目前所有版本 注意&#xff1a;android2.3版本及以上不支持下面的自動接聽方法。 &#xff08;會拋異常&#xff1a;java.lang.Securi…

Eclipse External Tool Configration Notepad++

Location&#xff1a; C:\Program Files\Notepad\notepad.exe Arguments&#xff1a;  ${resource_loc} 轉載于:https://www.cnblogs.com/rgqancy/p/9987610.html