MathJax basic tutorial and quick reference
2016-03-10 14:52
696 查看
To see how any formula was written in any question or answer, including this one, right-click on the expression it and choose "Show Math As > TeX Commands". (When you do this, the '$' will not display. Make sure you add these. See the next point.) For inline formulas, enclose the formula in $...$. For displayed formulas, use $$...$$. These render differently. For example, type $\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$ to show ∑ni=0i2=(n2+n)(2n+1)6 (which is inline mode) or type $$\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$$ to shown∑i=0i2=(n2+n)(2n+1)6(which is display mode). For Greek letters, use \alpha, \beta, …, \omega: α,β,…ω. For uppercase, use \Gamma, \Delta, …, \Omega: Γ,Δ,…,Ω. For superscripts and subscripts, use ^and _. For example, x_i^2: x2i. 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: 1010. But 10^{10}gives what you probably wanted: 1010. Use curly braces to delimit a formula to which a superscript or subscript applies: x^5^6is an error; {x^y}^zis xyz, and x^{y^z}is xyz. Observe the difference between x_i^2x2i and x_{i^2}xi2. Parentheses Ordinary symbols ()[]make parentheses and brackets (2+3)[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: (√xy3). Using \left(… \right)will make the sizes adjust automatically to the formula they enclose: \left(\frac{\sqrt x}{y^3}\right)is (√xy3). \leftand \rightapply to all the following sorts of parentheses: (and )(x), [and ][x], \{and \}{x}, ||x|, \langleand \rangle⟨x⟩, \lceiland \rceil⌈x⌉, and \lfloorand \rfloor⌊x⌋. There are also invisible parentheses, denoted by .: \left.\frac12\right\rbraceis 12}. Sums and integrals \sumand \int; the subscript is the lower limit and the superscript is the upper limit, so for example \sum_1^n∑n1. Don't forget {… }if the limits are more than a single symbol. For example, \sum_{i=0}^\infty i^2is ∑∞i=0i2. Similarly, \prod∏, \int∫, \bigcup⋃, \bigcap⋂, \iint∬. Fractions There are two ways to make these. \frac abapplies to the next two groups, and produces ab; for more complicated numerators and denominators use {… }: \frac{a+1}{b+1}is a+1b+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. Fonts Use \mathbbor \Bbbfor "blackboard bold": CHNQRZ. Use \mathbffor boldface: ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz. Use \mathttfor "typewriter" font: ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz. Use \mathrmfor roman font: ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz. Use \mathsffor sans-serif font: ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz. Use \mathcalfor "calligraphic" letters: ABCDEFGHIJKLMNOPQRSTUVWXYZ Use \mathscrfor script letters: ABCDEFGHIJKLMNOPQRSTUVWXYZ Use \mathfrakfor "Fraktur" (old German style) letters: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz. Radical signs Use sqrt, which adjusts to the size of its argument: \sqrt{x^3}√x3; \sqrt[3]{\frac xy}3√xy. For complicated expressions, consider using {...}^{1/2}instead. 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 xsinx, not sin xsinx. Use subscripts to attach a notation to \lim: \lim_{x\to 0}limx→0 There are a very large number of special symbols and notations, too many to list here; see this shorter listing, or this exhaustive listing. Some of the most common include: \lt \gt \le \ge \neq<>≤≥≠. You can use \notto put a slash through almost anything: \not\lt≮ but it often looks bad. \times \div \pm \mp×÷±∓. \cdotis 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) \to \rightarrow \leftarrow \Rightarrow \Leftarrow \mapsto→→←⇒⇐↦ \land \lor \lnot \forall \exists \top \bot \vdash \vDash∧∨¬∀∃⊤⊥⊢⊨ \star \ast \oplus \circ \bullet⋆∗⊕∘∙ \approx \sim \simeq \cong \equiv \prec≈∼≃≅≡≺. \infty \aleph_0∞ℵ0 \nabla \partial∇∂ \Im \Reℑℜ For modular equivalence, use \pmodlike this: a\equiv b\pmod na≡b(modn). \ldotsis the dots in a1,a2,…,an \cdotsis the dots in a1+a2+⋯+an Some Greek letters have variant forms: \epsilon \varepsilonϵε, \phi \varphiϕφ, and others. 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 are 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. 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␣band a␣␣␣␣bare both ab. To add more space, use \,for a thin space ab; \;for a wider space ab. \quadand \qquadare large spaces: ab, ab. To set plain text, use \text{…}: {x∈s∣x is extra large}. You can nest $…$inside of \text{…}. Accents and diacritical marks Use \hatfor a single symbol ˆx, \widehatfor 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 ddxx˙x=˙x2+x¨x, use \dotand \ddot. Special characters used for MathJax interpreting can be escaped using the \character: \$$, \{{, \__, etc. If you want \itself, you should use \backslash∖, because \\is for a new line. (Tutorial ends here.) It is important that this note be reasonably short and not suffer from too much bloat. To include more topics, please create short addenda and post them as answers instead of inserting them into this post. discussion faq mathjax reference
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
comments |
25 Answers
active oldest votesup vote 183down vote | MatricesUse$$\begin{matrix}…\end{matrix}$$In between the \beginand \end, put the matrix elements. End each matrix row with \\, and separate matrix elements with &. For example, $$ \begin{matrix} 1 & x & x^2 \\ 1 & y & y^2 \\ 1 & z & z^2 \\ \end{matrix} $$ produces: 1xx21yy21zz2 MathJax will adjust the sizes of the rows and columns so that everything fits. To add brackets, either use \left…\rightas in section 6 of the tutorial, or replace matrixwith pmatrix(1234), bmatrix[1234], Bmatrix{1234}, vmatrix|1234|, Vmatrix∥1234∥. Use \cdots⋯ \ddots⋱ vdots⋮ when you want to omit some of the entries: (1a1a21⋯an11a2a22⋯an2⋮⋮⋮⋱⋮1ama2m⋯anm) For "augmented" matrices, put parentheses or brackets around a suitably-formatted table; see arrays below for details. Here is an example: [123456] is produced by: $$ \left[ \begin{array}{cc|c} 1&2&3\\ 4&5&6 \end{array} \right] $$ The cc|cis the crucial part here; it says that there are three centered columns with a vertical bar between the second and third. For small inline matrices use \bigl(\begin{smallmatrix} ... \end{smallmatrix}\bigr), e.g. (abcd) is produced by: $\bigl( \begin{smallmatrix} a & b \\c & d \end{smallmatrix} \bigr)$
| ||||
|
up vote133 down vote | Aligned equationsOften people want a series of equations where the equals signs are aligned. To get this, use\begin{align}…\end{align}. Each line should end with \\, and should contain an ampersand at the point to align at, typically immediately before the equals sign. For example, √37=√732−1122=√732122⋅732−1732=√732122√732−1732=7312√1−1732≈7312(1−12⋅732) is produced by \begin{align} \sqrt{37} & = \sqrt{\frac{73^2-1}{12^2}} \\ & = \sqrt{\frac{73^2}{12^2}\cdot\frac{73^2-1}{73^2}} \\ & = \sqrt{\frac{73^2}{12^2}}\sqrt{\frac{73^2-1}{73^2}} \\ & = \frac{73}{12}\sqrt{1 - \frac{1}{73^2}} \\ & \approx \frac{73}{12}\left(1 - \frac{1}{2\cdot73^2}\right) \end{align} The usual $$marks that delimit the display may be omitted here.
| ||||||||||||||||||||||||||||||||
|
up vote 109down vote | Definitions by cases (piecewise functions)Use\begin{cases}…\end{cases}. End each case with a \\, and use &before parts that should be aligned. For example, you get this: f(n)={n/2,if n is even3n+1,if n is odd by writing this: f(n) = \begin{cases} n/2, & \text{if $n$ is even} \\ 3n+1, & \text{if $n$ is odd} \end{cases} The brace can be moved to the right:if n is even:n/2if n is odd:3n+1}=f(n) by writing this: \left. \begin{array}{l} \text{if $n$ is even:}&n/2\\ \text{if $n$ is odd:}&3n+1 \end{array} \right\} =f(n) To get a larger vertical space between cases we can use \\[2ex]instead of \\. For example, you get this: f(n)={n2,if n is even3n+1,if n is odd by writing this: f(n) = \begin{cases} \frac{n}{2}, & \text{if $n$ is even} \\[2ex] 3n+1, & \text{if $n$ is odd} \end{cases} (An ‘ex’ is a length equal to the height of the letter x; 2exhere means the space should be two exes high.)
| ||||||||||||
|
up vote105 down vote | SymbolsIn general, you have to search in long tables about a specific symbol you're looking for, things like Ψ, δ, ζ, ≥, ⊆ ...And it turns out that this operation can be frustrating and time consuming, which can cause the buddy to abandon writing the complete LATEX sentence in his answer, or in some cases, the complete answer itself. That's why the tool that I will present you in this post was conceived. Basically, it is a LATEX handwritten symbol recognition. Example in image: ![]() Here is the website: Detexify² No more frustration.
| ||||||||
|
up vote91down vote | ArraysIt is often easier to read tables formatted in MathJax rather than plain text or a fixed width font. Arrays and tables are created with thearrayenvironment. Just after \begin{array}the format of each column should be listed, use cfor a center aligned column, rfor right aligned, lfor left aligned and a |for a vertical line. Just as with matrices, cells are separated with &and rows are broken using \\. A horizontal line spanning the array can be placed before the current line with \hline. For example,nLeftCenterRight10.2411252−1189−83−2020001+10i $$ \begin{array}{c|lcr} n & \text{Left} & \text{Center} & \text{Right} \\ \hline 1 & 0.24 & 1 & 125 \\ 2 & -1 & 189 & -8 \\ 3 & -20 & 2000 & 1+10i \end{array} $$ Arrays can be nested to make an array of tables. For example,min012300000101112012230123max012300123111232222333333Δ012300123110122210133210 As the source for the preceding array is long, please right-click on one of the tables and choose Show Math As ▸ TeX Commands.
| ||||||||||||||||||||||||||||||||||||
|
up vote68 down vote | Fussy spacing issuesThese are issues that won't affect the correctness of formulas, but might make them look significantly better or worse. Beginners should feel free to ignore this advice; someone else will correct it for them, or more likely nobody will care.Don't use \fracin exponents or limits of integrals; it looks bad and can be confusing, which is why it is rarely done in professional mathematical typesetting. Write the fraction horizontally, with a slash: BadBettereiπ2eiπ2eiπ/2∫π2−π2sinxdx∫π/2−π/2sinxdx The |symbol has the wrong spacing when it is used as a divider, for example in set comprehensions. Use \midinstead: BadBetter{x|x2∈Z}{x∣x2∈Z} For double and triple integrals, don't use \int\intor \int\int\int. Instead use the special forms \iintand \iiint:BadBetter∫∫Sf(x)dydx∬Sf(x)dydx∫∫∫Vf(x)dzdydx∭Vf(x)dzdydx Use \,to insert a thin space before differentials; without this TEX will mash them together: BadBetter∭Vf(x)dzdydx∭Vf(x)dzdydx
| ||||||||||||||||||||||||||||
|
up vote 52down vote | ColorsNamed colors are browser-dependent; if a browser doesn't know a particular color name, it may render the text as black. The following colors are standard in HTML4 and CSS2 and should be interpreted the same by most browsers:\color{black}{text}text\color{gray}{text}text\color{silver}{text}text\color{white}{text}text\color{maroon}{text}text\color{red}{text}text\color{yellow}{text}text\color{lime}{text}text\color{olive}{text}text\color{green}{text}text\color{teal}{text}text\color{aqua}{text}text\color{blue}{text}text\color{navy}{text}text\color{purple}{text}text\color{fuchsia}{text}textHTML5 and CSS 3 define an additional 124 color names that will be supported on many browsers. Math Stack Exchange's default style uses a light-colored page background, so avoid using light colors for text. Stick to darker colors like maroon, green, blue, and purple, and remember also that 7–10% of men are color-blind and have difficulty distinguishing red and green. The color may also have the form #rgbwhere r,g,b are in the range or 0– 9, a– fand represent the intensity of red, green, and blue on a scale of 0–15, with a=10, b=11, … f=15. For example: #000text#00Ftext#0F0text#0FFtext#F00text#F0Ftext#FF0text#FFFtext #000text#005text#00Atext#00Ftext#500text#505text#50Atext#50Ftext#A00text#A05text#A0Atext#A0Ftext#F00text#F05text#F0Atext#F0Ftext#080text#085text#08Atext#08Ftext#580text#585text#58Atext#58Ftext#A80text#A85text#A8Atext#A8Ftext#F80text#F85text#F8Atext#F8Ftext#0F0text#0F5text#0FAtext#0FFtext#5F0text#5F5text#5FAtext#5FFtext#AF0text#AF5text#AFAtext#AFFtext#FF0text#FF5text#FFAtext#FFFtext You can have a look here for quick reference on colors in HTML.
| ||||
|
up vote 52down vote | System of equationsUse\begin{array}…\end{array}and \left\{…\right.. For example, you get this: {a1x+b1y+c1z=d1a2x+b2y+c2z=d2a3x+b3y+c3z=d3 by writing this: $$ \left\{ \begin{array}{c} a_1x+b_1y+c_1z=d_1 \\ a_2x+b_2y+c_2z=d_2 \\ a_3x+b_3y+c_3z=d_3 \end{array} \right. $$ Alternatively we can use \begin{cases}…\end{cases}. The same system {a1x+b1y+c1z=d1a2x+b2y+c2z=d2a3x+b3y+c3z=d3 is produced by the following code $$\begin{cases} a_1x+b_1y+c_1z=d_1 \\ a_2x+b_2y+c_2z=d_2 \\ a_3x+b_3y+c_3z=d_3 \end{cases} $$ To align the =signs use \begin{aligned}...\end{aligned}and \left\{…\right.(see asmeurer's comment){a1x+b1y+c1z=d1+e1a2x+b2y=d2a3x+b3y+c3z=d3 whose code is $$ \left\{ \begin{aligned} a_1x+b_1y+c_1z &=d_1+e_1 \\ a_2x+b_2y&=d_2 \\ a_3x+b_3y+c_3z &=d_3 \end{aligned} \right. $$ To align the =signs and the terms as in{a1x+b1y+c1z=d1+e1a2x+b2y=d2a3x+b3y+c3z=d3 use arraywith l(for "align left"; there are also cand r) parameters $$ \left\{ \begin{array}{ll} a_1x+b_1y+c_1z &=d_1+e_1 \\ a_2x+b_2y &=d_2 \\ a_3x+b_3y+c_3z &=d_3 \end{array} \right. $$ Vertical space between equations. As explained in Definition by cases to get a larger vertical space between equations we can use \\[2ex]instead of \\. The system {a1x+b1y+c1z=p1q1a2x+b2y+c2z=p2q2a3x+b3y+c3z=p3q3 is generated by the following code $$\begin{cases} a_1x+b_1y+c_1z=d_1 \\[2ex] a_2x+b_2y+c_2z=d_2 \\[2ex] a_3x+b_3y+c_3z=d_3 \end{cases} $$ in comparison with {a1x+b1y+c1z=p1q1a2x+b2y+c2z=p2q2a3x+b3y+c3z=p3q3 whose code is $$\begin{cases} a_1x+b_1y+c_1z=\frac{p_1}{q_1} \\a_2x+b_2y+c_2z=\frac{p_2}{q_2} \\a_3x+b_3y+c_3z=\frac{p_3}{q_3} \end{cases} $$ In response to elect's comment. The following code $$ \left\{ \begin{array}{l} 0 = c_x-a_{x0}-d_{x0}\dfrac{(c_x-a_{x0})\cdot d_{x0}}{\|d_{x0}\|^2} + c_x-a_{x1}-d_{x1}\dfrac{(c_x-a_{x1})\cdot d_{x1}}{\|d_{x1}\|^2} \\[2ex] 0 = c_y-a_{y0}-d_{y0}\dfrac{(c_y-a_{y0})\cdot d_{y0}}{\|d_{y0}\|^2} + c_y-a_{y1}-d_{y1}\dfrac{(c_y-a_{y1})\cdot d_{y1}}{\|d_{y1}\|^2} \end{array} \right. $$ produces {0=cx−ax0−dx0(cx−ax0)⋅dx0∥dx0∥2+cx−ax1−dx1(cx−ax1)⋅dx1∥dx1∥20=cy−ay0−dy0(cy−ay0)⋅dy0∥dy0∥2+cy−ay1−dy1(cy−ay1)⋅dy1∥dy1∥2
| |||
up vote51 down vote | Continued fractionsTo make a continued fraction, use\cfrac, which works just like \fracbut typesets the results differently: x=a0+12a1+22a2+32a3+44a4+⋯ Don't use regular \fracor \over, or it will look awful: x=a0+12a1+22a2+32a3+44a4+⋯ You can of course use \fracfor the compact notation: x=a0+12a1+22a2+32a3+44a4+⋯ Continued fractions are too big to put inline. Display them with $$… $$or use a notation like [a0;a1,a2,a3,…].
| ||||||||||||||||||||||||||||||||
|
up vote 49 down vote | Crossing things outUse\require{cancel}in the first formula in your post that requires cancelling; you need it only once per page. Then use: y+\cancel{x}y+x\cancel{y+x}y+xy+\bcancel{x}y+xy+\xcancel{x}y+xy+\cancelto{0}{x}y+x0\frac{1\cancel9}{\cancel95} = \frac151995=15 Use \require{enclose}for the following: \enclose{horizontalstrike}{x+y}x+y\enclose{verticalstrike}{\frac xy}xy\enclose{updiagonalstrike}{x+y}x+y\enclose{downdiagonalstrike}{x+y}x+y\enclose{horizontalstrike,updiagonalstrike}{x+y}x+y \enclosecan also produce enclosing boxes, circles, and other notations; see MathML menclosedocumentation for a complete list.
| ||||||||
|
up vote 38 down vote | Additional decorations\overline: ¯A ¯AA ¯AAA \underline: B_ BB_ BBB_ \widetilde: ˜C ~CC ~CCC \widehat: ˆD ^DD ^DDD \fbox: E EE EEE \underleftarrow: F← FF← FFF← \underrightarrow: G→ GG→ GGG→ \underleftrightarrow: H↔ HH↔ HHH↔ \overbrace: ⏞(n−2)+⏞(n−1)+n+(n+1)+(n+2) \underbrace: (n−2)+(n−1)+n+(n+⏟1)+(n+⏟2) \overbraceand \underbraceaccept a superscript or a subscript, respectively, to annotate the brace. For example, \underbrace{a\cdot a\cdots a}_{b\text{ times}}isa⋅a⋯a⏟b times Additional accents \check: ˇI \acute: ˊJ \grave: ˊK
| |||
up vote 38down vote | \implies(⟹) is a marginally preferable alternative to \Rightarrow(⇒) for implication. There's also \iff⟺ and \impliedby⟸. \to(→) is preferable to \rightarrowor \longrightarrowfor things like f:A→B. The reverse is \gets(←).
| ||||||||||||||||
|
up vote37 down vote | Tags & ReferencesFor longer calculations (or referring to other post's results) it is convenient to use the tagging/labelling/referencing system. To tag an equation use\tag{yourtag}, and if you want to refer to that tag later on, add \label{somelabel}right after the \tag. It is not necessary that yourtagand somelabelare the same, but it usually is more convenient to do so: $$ a := x^2-y^3 \tag{*}\label{*} $$ a:=x2−y3 In order to refer to an equation, just use \eqref{somelabel} $$ a+y^3 \stackrel{\eqref{*}}= x^2 $$ a+y3(*)=x2 or \ref{somelabel} Equations are usually referred to as $\eqref{*}$, but you can also use $\ref{*}$. Equations are usually referred to as (*), but you can also use *. As you can see, references are even turned into hyperlinks, which you can use externally as well, e.g. like this. Note that you can also reference labels in other posts as long as they appear on the same site, which is especially useful when referring to a question with multiple equations, or when commenting on a post. Due to a bug blocks containing a \labelwill break in preview, as a workaround you can put $\def\label#1{}$in your post while editing and remove that on submission - unfortunately this means you won't spot misspelled references before submitting... Just don't forget to remove that \defagain
| ||||||||||||
|
up vote 36 down vote | Using I would like to remark that it is possible to define LaTeX commands as you do in your TeX files. I felt so happy when I first discovered it! It's enough to insert something like |
share | edited Feb 12 '15 at 12:43 | community wiki 3 revs, 3 users 67% Abramo |
| Be aware that this affects the entire post, possibly even the frontpage, so it should be used with great care. – AlexR Feb 21 '15 at 20:55 |
up vote 34down vote | Commutative diagramsAMScd diagrams must start with a "require":$\require{AMScd}$ \begin{CD} A @>a>> B\\ @V b V V= @VV c V\\ C @>>d> D \end{CD} to get this diagram: Aa→Bb↓=↓cC→dD @>>>is used for arrow right @<<<is used for arrow left @VVVis used for arrow down @AAAis used for arrow up @=is used for horizontal double line @|is used for vertical double line @.is used for no arrow Another example: \begin{CD} A @>>> B @>{\text{very long label}}>> C \\ @. @AAA @| \\ D @= E @<<< F \end{CD} A→Bvery long label→C↑∥D=E←F Long labels increase the length of the arrow and in this version also automatically increase corresponding arrows. $\require{AMScd}$ \begin{CD} RCOHR'SO_3Na @>{\text{Hydrolysis,$\Delta, Dil.HCl$}}>> (RCOR')+NaCl+SO_2+ H_2O \end{CD} RCOHR′SO3NaHydrolysis,Δ,Dil.HCl→(RCOR′)+NaCl+SO2+H2O
| ||||||||||||||||||||||||||||
|
up vote 33down vote | Big bracesUse\leftand \rightto make braces - (round), [square] and {curly} - scale up to be the size of their arguments. Thus $$ f\left( \left[ \frac{ 1+\left\{x,y\right\} }{ \left( \frac{x}{y}+\frac{y}{x} \right) \left(u+1\right) }+a \right]^{3/2} \right) $$ renders asf([1+{x,y}(xy+yx)(u+1)+a]3/2). Note that curly braces need to be escaped as \{ \}. If you start a big brace with \leftand then need to match that to a \rightbrace that's on a different line, use the forms \right.and \left.to make "shadow" braces. Thus, $$ \begin{aligned} a=&\left(1+2+3+ \cdots \right. \\ & \cdots+ \left. \infty-2+\infty-1+\infty\right) \end{aligned} $$ renders asa=(1+2+3+⋯⋯+∞−2+∞−1+∞). There is also a \middleconstruct which is useful when one has a mid-expression brace which must also scale up: $$ \left\langle q \middle\| \frac{\frac{x}{y}}{\frac{u}{v}} \middle| p \right\rangle $$ renders as⟨q∥xyuv|p⟩. Note that constructs like \left\langle, \left|and \left\|are also possible.
| ||||
|
up vote28down vote | Arbitrary operatorsIf an operator is not available as a built-in command, use\operatorname{…}. So for things likearsinh(x) write \operatorname{arsinh}(x)since \arsinh(x)will give an error and arsinh(x)has wrong font and spacing: arsinh(x). This was already mentioned in a comment by Charles Staats. You might consider this an addition to the FAQ section on \lim, \sinand so on. For operators which need limits above and below the operator, use \operatorname*{…}, as inResz=1(1z2−z)=1
| ||||||||||||||||||||||||
|
up vote26down vote | LimitsTo make a limit (like limx→1x2−1x−1),use this syntax: First, start off with $\lim. This renders as lim. The backslash is there to prevent things like lim, where the letters are slanted. Second, add \limits_{x \to 1}inside. The code now looks like $\lim \limits_{x \to 1}$, and renders as limx→1. The \toinside makes the right arrow, rendered as →. The _makes the x→1 go underneath the lim. Finally, the pair of curly braces { }makes sure that x→1 is treated as a whole object, and not two separate things. Lastly, add the function you want to apply the limit to. To make the limit mentioned above, limx→1x2−1x−1, simply use $\lim\limits_{x \to 1} \frac{x^2-1}{x-1}$. And that is how you make a limit using MathJax.
| ||||||||||||||||||||||||||||
|
up vote18 down vote | Absolute values and normsThe absolute value of some expression can be denoted as\lvert x\rvertor, more generally, as \left\lvert … \right\rvert. It renders as ∣x∣. The norm of a vector (or similar) can be denoted as \lVert v\rVertor, more generally, as \left\lVert … \right\rVert. It renders as ∥v∥. (You may also write \left\|…\right\|instead.) In both cases, the rendering is better than what you'd get from |x|or ||v||, which render with bars that don't descend low enough and sub-optimal spacing. At least on some browsers, so here is a screenshot how it looks for me, using Firefox 31 on OS X: ![]() And here is the same formula rendered by your browser: |x|,||v||⟶∣x∣,∥v∥ It was typeset as $$|x|, ||v|| \quad\longrightarrow\quad \lvert x\rvert, \lVert v\rVert$$
| ||||||||||||||||||||
|
up vote 16 down vote | Left and Right Implication ArrowsAnother way to display the arrows for right and left implication instead of using$\Rightarrow$, $\Leftarrow$and $\Leftrightarrow$ which produces ⇒, ⇐ and ⇔ respectively, you can use $\implies$for ⟹, $\impliedby$for ⟸ and $\iff$for ⟺ The latter of which produces longer arrows which may be more desirable to some.
| |||
up vote 9 down vote | Long division$$ \require{enclose} \begin{array}{r} 13 \\[-3pt] 4 \enclose{longdiv}{52} \\[-3pt] \underline{4}\phantom{2} \\[-3pt] 12 \\[-3pt] \underline{12} \end{array} $$ 134524_1212_ One important trick shown here is the use of \phantom{2}to make a blank space that is the same size and shape as the digit 2just above it. This is adapted from http://stackoverflow.com/a/22871404/3466415 (which uses slightly different but not less valid formatting).
| |||
up vote8down vote | The degree symbol for angles is not ^\circ. Although many people use this notation, the result looks quite different from the canonical degree symbol shipped with the font: 90°renders as 90° while 90^\circrenders as 90∘. If your keyboard doesn't have a ° key, feel free to copy from this post here, or follow these suggestions. Note that comments below indicate that on some configurations at least, °renders inferior to ^\circ. And I recently had a post of mine edited just for the sake of turning °into ^\circ, indicating that someone felt rather strongly about this. So the suggestion above does seem somewhat controversial at the moment. I maintain that from a semantic point of view, °is superior to ^\circ, and if the rendering suffers from this, then it's a bug in MathJax. After all, LaTeX offers a proper degree symbol in the tex companion fonts, indicating that someone there, too, decided that ^\circis not perfect. But if things are broken now, I can't fault people from pragmatically sticking with the rendering they prefer. Personally I prefer semantics, also for the sake of screen readers.
| ||||||||||||||||
|
up vote 8 down vote | To highlight an equation, \bbox can be used. E.g,$$ \bbox[yellow] { e^x=\lim_{n\to\infty} \left( 1+\frac{x}{n} \right)^n \qquad (1) } $$ produces ex=limn→∞(1+xn)n(1) or $$ \bbox[border:2px solid red] { e^x=\lim_{n\to\infty} \left( 1+\frac{x}{n} \right)^n \qquad (2) } $$ produces ex=limn→∞(1+xn)n(2)
| |||
up vote 8 down vote | Giving reasons on each line of a sequence of equationsTo produce this:v+w=0Given−w=−w+0additiveidentity−w+0=−w+(v+w)equations (1) and (2) write this: \begin{align} v + w & = 0 &&\text{Given} \tag 1\\ -w & = -w + 0 && \text{additive identity} \tag 2\\ -w + 0 & = -w + (v + w) && \text{equations $(1)$ and $(2)$} \end{align}
| |||
up vote 4 down vote | Pack of cardsIf you are asking (or answering) a combinatorics question involving packs of cards you can make it look more elegant by using\spadesuit, \heartsuit, \diamondsuit, \clubsuitin math mode:♠♡♢♣ Or if you're really fussy: \color{red}{\heartsuit}and \color{red}{\diamondsuit} ♡♢
|
相关文章推荐
- (四) WebService-- SOAP UI 工具使用
- 太原UI设计师及web前端师郭文军讲网页中网格布局思路?
- JPA之@GeneratedValue注解
- Xcode 的蛋疼---描述文件出错
- arduino实验日记
- StringBuffer与StringBuilder的区别
- ios海哥开发笔记 (海哥原创,UILocalNotification本地通知的设置以及iOS9通知新特性 )
- TF/IDF(term frequency/inverse document frequency)
- <学习笔记> require模块(省市区下拉控件)
- NGUI具有流光效果的UISprite
- 《iOS Human Interface Guidelines》——Activity
- 基于modern ui for wpf的在线公开课平台 之一(说在前面)
- Java基础之GUI
- 1099. Build A Binary Search Tree (30)
- UITableView的段头设置
- 系统启动过程中出现:error: no such partition grub rescue
- UIImage部分拉伸——stretchableImageWithLeftCapWidth的使用
- java for循环跳出(break)/结束本次(continue)多重循环
- EasyTouch与UGUI的结合使用
- 快速排序实现(QuickSort)