Latex数学公式大全,从求和符号到希腊字母、逻辑符号,应有尽有。

最近用Obsidian做笔记,一开始是打算用来建立自己的知识库,它的双向链接和知识图谱很惊艳,而且自带思维导图,~不过后来沦为了Markdown编辑器~
由于经常要输入公式,所以直接把这个贴在博客好了。
转自:mathjax-basic-tutorial-and-quick-reference
有关Letax快速入门半小时入门Letax(英)

(Deutsch: MathJax: LaTeX Basic Tutorial und Referenz)

To see how any formula was written in any question or answer, including this one, right-click on the expression and choose "Show Math As > TeX Commands". (When you do this, the '$' will not display. Make sure you add these: see the next point. There are also other ways to view the code for the formula or the whole post.)

To try formatting, visit the formatting sandbox post, select one of the answers that says “free for editing” and use the “edit” button to edit the answer however you like. Don't forget to change it back when you are finished, so it can be used again.

  1. For inline formulas, enclose the formula in $$. For displayed formulas, use $$$$.

    • These render differently. For example, type the following to show inline mode:
      $\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$
      ∑ni=0i2=(n2+n)(2n+1)6∑𝑖=0𝑛𝑖2=(𝑛2+𝑛)(2𝑛+1)6

    • or type the following for display mode:
      $$\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$$

      ∑i=0ni2=(n2+n)(2n+1)6∑𝑖=0𝑛𝑖2=(𝑛2+𝑛)(2𝑛+1)6

  2. For Greek letters, use \alpha\beta, …, \omega: α𝛼, β𝛽, …, ω𝜔.

    • For uppercase letters, use \Gamma\Delta, …, \Omega: ΓΓ, ΔΔ, …, ΩΩ.
    • Other Greek capital letters are the same as the Latin ones: A,B,E,Z and so on: A,B,E,Z𝐴,𝐵,𝐸,𝑍….
    • Some Greek letters have variant forms: \epsilon \varepsilon ϵ𝜖, ε𝜀, \phi \varphi ϕ𝜙, φ𝜑, and others.
  3. For superscripts and subscripts, use ^ and _. For example, x_i^2: x2i𝑥𝑖2, \log_2 x: log2xlog2⁡𝑥. For the prime symbol, use an apostrophe x' x'' x''': x′ x′′ x′′′𝑥′ 𝑥″ 𝑥‴.

  4. Groups. Superscripts, subscripts, and other operations apply only to the next “group”. A “group” is either a single symbol, or any formula surrounded by curly braces {}.

    • If you do 10^10, you will get a surprise: 10101010. But 10^{10} gives what you probably wanted: 10101010.
    • Use curly braces to delimit a formula to which a superscript or subscript applies: x^y^z is an error; {x^y}^z is xyz𝑥𝑦𝑧, and x^{y^z} is xyz𝑥𝑦𝑧. Observe the differences between x_i^2 x2i𝑥𝑖2, x_{i^2} xi2𝑥𝑖2 and {x_i}^2 xi2𝑥𝑖2.
  5. Parentheses Ordinary symbols ()[] make parentheses and brackets (2+3)4+4[4+4]. Use \{ and \} for curly braces {}{}.

    • These do not scale with the formula in between, so if you write (\frac{\sqrt x}{y^3}) the parentheses will be too small: (x√y3)(𝑥𝑦3). Using \left(\right) will make the sizes adjust automatically to the formula they enclose: \left(\frac{\sqrt x}{y^3}\right) is (x√y3)(𝑥𝑦3).

    • \left and\right apply to all the following sorts of parentheses: ( and ) (x)(𝑥), [ and ] [x][𝑥], \{ and \} {x}{𝑥}, | |x||𝑥|, \vert |x||𝑥|, \Vert ∥x∥‖𝑥‖, \langle and \rangle ⟨x⟩⟨𝑥⟩, \lceil and \rceil ⌈x⌉⌈𝑥⌉, and \lfloor and \rfloor ⌊x⌋⌊𝑥⌋. \middle can be used to add additional dividers. There are also invisible parentheses, denoted by .: use \left.x^2\right\rvert_3^5 = 5^2-3^2 to get

      x2∣∣53=52−32𝑥2|35=52−32

  6. Sums and integrals \sum and \int; the subscript is the lower limit and the superscript is the upper limit, so for example \sum_1^n ∑n1∑1𝑛. Don't forget {} if the limits are more than a single symbol. For example, \sum_{i=0}^\infty i^2 is ∑∞i=0i2∑𝑖=0∞𝑖2.

    • Similarly, \prod ∏∏, \int ∫∫, \bigcup ⋃⋃, \bigcap ⋂⋂, \iint ∬∬, \iiint ∭∭, \idotsint ∫⋯∫∫⋯∫.
  7. Fractions There are three ways to make fractions\frac ab applies to the next two groups, and produces ab𝑎𝑏; for more complicated numerators and denominators use {}\frac{a+1}{b+1} is a+1b+1𝑎+1𝑏+1.

    • If the numerator and denominator are complicated, you may prefer \over, which splits up the group that it is in: {a+1\over b+1} is a+1b+1𝑎+1𝑏+1.
    • For continued fractions, use \cfrac instead of \frac.
  8. Fonts

  • Use \mathbb or \Bbb for "blackboard bold": CHNQRZ𝐶𝐻𝑁𝑄𝑅𝑍.
  • Use \mathbf for boldface: CHNQRZ𝐶𝐻𝑁𝑄𝑅𝑍 chnqrz𝑐ℎ𝑛𝑞𝑟𝑧.
    • For expression based characters, use \boldsymbol instead: α𝛼
  • Use \mathit for italics: CHNQRZ𝐶𝐻𝑁𝑄𝑅𝑍 chnqrz𝑐ℎ𝑛𝑞𝑟𝑧.
  • Use \pmb for boldfaced italics: CHNQRZCHNQRZ𝐶𝐻𝑁𝑄𝑅𝑍𝐶𝐻𝑁𝑄𝑅𝑍 chnqrzchnqrz𝑐ℎ𝑛𝑞𝑟𝑧𝑐ℎ𝑛𝑞𝑟𝑧.
  • Use \mathtt for "typewriter" font: CHNQRZ𝐶𝐻𝑁𝑄𝑅𝑍 chnqrz𝑐ℎ𝑛𝑞𝑟𝑧.
  • Use \mathrm for roman font: CHNQRZCHNQRZ chnqrzchnqrz.
  • Use \mathsf for sans-serif font: CHNQRZ𝐶𝐻𝑁𝑄𝑅𝑍 chnqrz𝑐ℎ𝑛𝑞𝑟𝑧.
  • Use \mathcal for "calligraphic" letters: CHNQRZ𝐶𝐻𝑁𝑄𝑅𝑍 (Uppercase only.)
  • Use \mathscr for script letters: CHNQRZ𝐶𝐻𝑁𝑄𝑅𝑍 chnqrz𝑐ℎ𝑛𝑞𝑟𝑧
  • Use \mathfrak for "Fraktur" (old German style) letters: CHNQRZ𝐶𝐻𝑁𝑄𝑅𝑍 chnqrz𝑐ℎ𝑛𝑞𝑟𝑧.
  1. Radical signs / roots Use sqrt, which adjusts to the size of its argument: \sqrt{x^3} x3−−√𝑥3; \sqrt[3]{\frac xy} xy−−√3𝑥𝑦3. For complicated expressions, consider using {...}^{1/2} instead.

  2. Some special functions such as "lim", "sin", "max", "ln", and so on are normally set in roman font instead of italic font. Use \lim\sin, etc. to make these: \sin x sinxsin⁡𝑥, not sin x sinx𝑠𝑖𝑛𝑥. Use subscripts to attach a notation to \lim\lim_{x\to 0}

    limx→0lim𝑥→0

    Nonstandard function names can be set with \operatorname{foo}(x) foo(x)foo⁡(𝑥).

  3. There are a very large number of special symbols and notations, too many to list here; see the short listing LATEX𝐿𝐴𝑇𝐸𝑋 and AMS𝐴𝑀𝑆-LATEX𝐿𝐴𝑇𝐸𝑋 Symbols prepared by Dr. Emre Sermutlu, or the exhaustive listing The Comprehensive LATEX𝐿𝐴𝑇𝐸𝑋 Symbol List by Scott Pakin. Some of the most common include:

  • \lt \gt \le \ge \neq <<, >>, ≤≤, ≥≥,≠≠. You can use \not to put a slash through almost anything: \not\lt ≮≮ but it often looks bad.

  • \times \div \pm \mp ××, ÷÷, ±±, ∓∓. \cdot is a centered dot: x⋅y𝑥⋅𝑦

  • \cup \cap \setminus \subset \subseteq \subsetneq \supset \in \notin \emptyset \varnothing ∪∪, ∩∩, ∖∖, ⊂⊂, ⊆⊆, ⊊⊊, ⊃⊃, ∈∈, ∉∉, ∅∅, ∅∅

  • {n+1 \choose 2k} or \binom{n+1}{2k} (n+12k)(𝑛+12𝑘)

  • \to \gets \rightarrow \leftarrow \Rightarrow \Leftarrow \mapsto \implies \iff →→, ←←, →→, ←←, ⇒⇒, ⇐⇐, ↦↦, ⟹⟹, ⟺⟺

  • \land \lor \lnot \forall \exists \top \bot \vdash \vDash ∧∧, ∨∨, ¬¬, ∀∀, ∃∃, ⊤⊤, ⊥⊥, ⊢⊢, ⊨⊨

  • \star \ast \oplus \circ \bullet ⋆⋆, ∗∗, ⊕⊕, ∘∘, ∙∙

  • \approx \sim \simeq \cong \equiv \prec \lhd ≈≈, ∼∼, ≃≃, ≅≅, ≡≡, ≺≺, ⊲⊲

  • \infty \aleph_0 ∞ℵ0∞ℵ0 \nabla \partial ∇∇, ∂∂ \Im \Re Iℑ, Rℜ

  • For modular equivalence, use \pmod like this: a\equiv b\pmod n a≡b(modn)𝑎≡𝑏(mod𝑛). For the binary mod operator, use \bmod like this: a\bmod 17 amod17𝑎mod17.

  • Use \dots for the triple dots in a1,a2,…,an𝑎1,𝑎2,…,𝑎𝑛 and a1+a2+⋯+an𝑎1+𝑎2+⋯+𝑎𝑛

  • Script lowercase l is \ell ℓℓ.

    Detexify lets you draw a symbol on a web page and then lists the TEX𝑇𝐸𝑋 symbols that seem to resemble it. These are not guaranteed to work in MathJax, but it's a good place to start. To check that a command is supported, note that MathJax.org maintains a list of currently supported LATEX𝐿𝐴𝑇𝐸𝑋 commands, and one can also check Dr. Carol JVF Burns's page of TEX𝑇𝐸𝑋 Commands Available in MathJax.

  1. Spaces MathJax usually decides for itself how to space formulas, using a complex set of rules. Putting extra literal spaces into formulas will not change the amount of space MathJax puts in: a␣b and a␣␣␣␣b are both ab𝑎𝑏. To add more space, use \, for a thin space ab𝑎𝑏; \; for a wider space ab𝑎𝑏. \quad and \qquad are large spaces: ab𝑎𝑏, ab𝑎𝑏.

    To set plain text, use \text{…}: {x∈s∣x is extra large}{𝑥∈𝑠∣𝑥 is extra large}. You can nest $…$ inside of \text{…}, for example to access spaces.

  2. Accents and diacritical marks Use \hat for a single symbol x𝑥\widehat for a larger formula xyˆ𝑥𝑦^. If you make it too wide, it will look silly. Similarly, there are \bar x¯𝑥¯ and \overline xyz¯¯¯¯¯¯¯¯𝑥𝑦𝑧¯, and \vec x⃗ 𝑥→ and \overrightarrow xy−→𝑥𝑦→ and \overleftrightarrow xy←→𝑥𝑦↔. For dots, as in ddxxx˙=x˙2+xx¨𝑑𝑑𝑥𝑥𝑥˙=𝑥˙2+𝑥𝑥¨, use \dot and \ddot.

  3. Special characters used for MathJax interpreting can be escaped using the \ character: $ $$, \{ {{, \} }}, \_ __, \# ##, \& &&. If you want \ itself, you should use \backslash (symbol) or \setminus (binary operation) for ∖∖, because \\ is for a new line.

(Tutorial ends here.)

posted @ 2024-07-27 22:47  T|N  阅读(233)  评论(0)    收藏  举报