# MathJax basic tutorial and quick reference

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}$ $$\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$$ • or type the following for display mode: $$\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$$ $$\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$$ 2. For Greek letters, use \alpha, \beta, …, \omega: $$\alpha$$, $$\beta$$, …, $$\omega$$. • For uppercase letters, use \Gamma, \Delta, …, \Omega: $$\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 $$\epsilon$$, $$\varepsilon$$, \phi \varphi $$\phi$$, $$\varphi$$, and others. 3. For superscripts and subscripts, use ^ and _. For example, x_i^2: $$x_i^2$$, \log_2 x: $$\log_2 x$$. 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: $$10^10$$. But 10^{10} gives what you probably wanted: $$10^{10}$$. • Use curly braces to delimit a formula to which a superscript or subscript applies: x^y^z is an error; {x^y}^z is $${x^y}^z$$, and x^{y^z} is $$x^{y^z}$$. Observe the differences between x_i^2 $$x_i^2$$, x_{i^2} $$x_{i^2}$$ and {x_i}^2 $${x_i}^2$$. 5. 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: $$(\frac{\sqrt x}{y^3})$$. Using \left(\right) will make the sizes adjust automatically to the formula they enclose: \left(\frac{\sqrt x}{y^3}\right) is $$\left(\frac{\sqrt x}{y^3}\right)$$. • \left and\right apply to all the following sorts of parentheses: ( and ) $$(x)$$, [ and ] $$[x]$$, \{ and \} $$\{ x \}$$, | $$|x|$$, \vert $$\vert x \vert$$, \Vert $$\Vert x \Vert$$, \langle and \rangle $$\langle x \rangle$$, \lceil and \rceil $$\lceil x \rceil$$, and \lfloor and \rfloor $$\lfloor x \rfloor$$. \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 $$\left.x^2\right\rvert_3^5 = 5^2-3^2$$ 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 $$\sum_1^n$$. Don't forget {} if the limits are more than a single symbol. For example, \sum_{i=0}^\infty i^2 is $$\sum_{i=0}^\infty i^2$$. • Similarly, \prod $$\prod$$, \int $$\int$$, \bigcup $$\bigcup$$, \bigcap $$\bigcap$$, \iint $$\iint$$, \iiint $$\iiint$$, \idotsint $$\idotsint$$. 7. Fractions There are three ways to make fractions. \frac ab applies to the next two groups, and produces $$\frac ab$$; for more complicated numerators and denominators use {}: \frac{a+1}{b+1} is $$\frac{a+1}{b+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+1\over b+1}$$. • For continued fractions, use \cfrac instead of \frac. 8. Fonts • Use \mathbb or \Bbb for "blackboard bold": $$\mathbb{CHNQRZ}$$. • Use \mathbf for boldface: $$\mathbf{CHNQRZ}$$ $$\mathbf{chnqrz}$$. • For expression based characters, use \boldsymbol instead: $$\boldsymbol{\alpha}$$ • Use \mathit for italics: $$\mathit{CHNQRZ}$$ $$\mathit{chnqrz}$$. • Use \pmb for boldfaced italics: $$\pmb{CHNQRZ}$$ $$\pmb{chnqrz}$$. • Use \mathtt for "typewriter" font: $$\mathtt{CHNQRZ}$$ $$\mathtt{chnqrz}$$. • Use \mathrm for roman font: $$\mathrm{CHNQRZ}$$ $$\mathrm{chnqrz}$$. • Use \mathsf for sans-serif font: $$\mathsf{CHNQRZ}$$ $$\mathsf{chnqrz}$$. • Use \mathcal for "calligraphic" letters: $$\mathcal{CHNQRZ}$$ (Uppercase only.) • Use \mathscr for script letters: $$\mathscr{CHNQRZ}$$ $$\mathscr{chnqrz}$$ • Use \mathfrak for "Fraktur" (old German style) letters: $$\mathfrak{CHNQRZ}$$ $$\mathfrak{chnqrz}$$. 1. Radical signs / roots Use sqrt, which adjusts to the size of its argument: \sqrt{x^3} $$\sqrt{x^3}$$; \sqrt[3]{\frac xy} $$\sqrt[3]{\frac xy}$$. 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 $$\sin x$$, not sin x $$sin x$$. Use subscripts to attach a notation to \lim: \lim_{x\to 0} $$\lim_{x\to 0}$$ Nonstandard function names can be set with \operatorname{foo}(x) $$\operatorname{foo}(x)$$. 3. There are a very large number of special symbols and notations, too many to list here; see the short listing $$\LaTeX$$ and $$\mathcal{A}_{\Large\mathcal{M}}\mathcal{S}$$-$$\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 $$\lt$$, $$\gt$$, $$\le$$, $$\ge$$,$$\neq$$. You can use \not to put a slash through almost anything: \not\lt $$\not\lt$$ but it often looks bad. • \times \div \pm \mp $$\times$$, $$\div$$, $$\pm$$, $$\mp$$. \cdot is a centered dot: $$x\cdot y$$ • \cup \cap \setminus \subset \subseteq \subsetneq \supset \in \notin \emptyset \varnothing $$\cup$$, $$\cap$$, $$\setminus$$, $$\subset$$, $$\subseteq$$, $$\subsetneq$$, $$\supset$$, $$\in$$, $$\notin$$, $$\emptyset$$, $$\varnothing$$ • {n+1 \choose 2k} or \binom{n+1}{2k} $${n+1 \choose 2k}$$ • \to \gets \rightarrow \leftarrow \Rightarrow \Leftarrow \mapsto \implies \iff $$\to$$, $$\gets$$, $$\rightarrow$$, $$\leftarrow$$, $$\Rightarrow$$, $$\Leftarrow$$, $$\mapsto$$, $$\implies$$, $$\iff$$ • \land \lor \lnot \forall \exists \top \bot \vdash \vDash $$\land$$, $$\lor$$, $$\lnot$$, $$\forall$$, $$\exists$$, $$\top$$, $$\bot$$, $$\vdash$$, $$\vDash$$ • \star \ast \oplus \circ \bullet $$\star$$, $$\ast$$, $$\oplus$$, $$\circ$$, $$\bullet$$ • \approx \sim \simeq \cong \equiv \prec \lhd $$\approx$$, $$\sim$$, $$\simeq$$, $$\cong$$, $$\equiv$$, $$\prec$$, $$\lhd$$ • \infty \aleph_0 $$\infty\, \aleph_0$$ \nabla \partial $$\nabla$$, $$\partial$$ \Im \Re $$\Im$$, $$\Re$$ • For modular equivalence, use \pmod like this: a\equiv b\pmod n $$a\equiv b\pmod n$$. For the binary mod operator, use \bmod like this: a\bmod 17 $$a\bmod 17$$. • Use \dots for the triple dots in $$a_1, a_2, \dots, a_n$$ and $$a_1+a_2+\dots+a_n$$ • Script lowercase l is \ell $$\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 $$a b$$. To add more space, use \, for a thin space $$a\,b$$; \; for a wider space $$a\;b$$. \quad and \qquad are large spaces: $$a\quad b$$, $$a\qquad b$$. To set plain text, use \text{…}: $$\{x\in s\mid x\text{ 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 $$\hat x$$, \widehat for a larger formula $$\widehat{xy}$$. If you make it too wide, it will look silly. Similarly, there are \bar $$\bar x$$ and \overline $$\overline{xyz}$$, and \vec $$\vec x$$ and \overrightarrow $$\overrightarrow{xy}$$ and \overleftrightarrow $$\overleftrightarrow{xy}$$. For dots, as in $$\frac d{dx}x\dot x = \dot x^2 + x\ddot x$$, 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 $$\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.

## Contents

Alphabetical list of links to MathJax topics, by title:

• Some capital Greek letters are the same as the Roman equivalents, so they are not separated in $\LaTeX$. For a capital beta, one must use something like \mathrm{B}: $\mathrm{B}$
– robjohn Mod
Commented Aug 28, 2012 at 2:06
• Two related questions: How do I insert a table when asking a question? and How to show the integral symbol on this site? Commented Aug 28, 2012 at 13:26
• A quick addition to point 11: If you want to use a $\sin$-like symbol that is not already defined, the command is \operatorname: e.g., \operatorname{Spec} A gives $\operatorname{Spec} A$. Commented Aug 28, 2012 at 16:45
• It might be useful to mention hanging subscripts for things like _5C_3 $_5C_3$. You could also mention \frac vs \dfrac. Commented Aug 29, 2012 at 18:09
• My basic idea is that if a beginner can express a formula clearly, then someone else can come in and clean up the typesetting afterwards. I am considering getting rid of the section about \big, \left, and \right for this reason, and trimming the section on spacing.
– MJD
Commented Aug 30, 2012 at 2:06
• Most of the references to TeX or LaTeX in this and the answers ought to be to MathJaX (the exception that I can see being the output of Detexify). I know this is a bit pedantic, but would it be alright to correct this? Commented Sep 11, 2012 at 14:13
• @AndrewStacey Thanks for pointing this out. Let's by all means be as correct as possible, particularly when there's no extra cost.
– MJD
Commented Sep 11, 2012 at 14:15
• @MJD Okay, I've had a go (also the answer about arrays). I wonder also whether or not it is worth a sentence at the end pointing out that whilst MathJaX does its best to emulate TeX, it isn't TeX and so while knowing how something is done in TeX gives you a starting point, it isn't a guarantee that the same thing works in MathJaX. (As a case in point, questions about MathJaX are generally off-topic over on TeX-SX.) Commented Sep 11, 2012 at 14:22
• @AndrewStacey I wouldn't. They are close enough that it seems to me to be a needless refinement. I might even argue that MathJax is $\TeX$, although an alternative implementation. We're willing to accept that other programming languages (JavaScript, for example) that have slightly incompatible implementations are nevertheless the same language; why not in this case as well?
– MJD
Commented Sep 11, 2012 at 14:35
• @MJD Except that this is meant as a tutorial for those who aren't familiar with the distinction (and there really is a distinction: "slightly incompatible implementations" doesn't really fit the bill here). One thing tutorials often include is a "Where to find out more" section. This doesn't. Someone who doesn't know the distinction might be tempted to search for help on TeX or LaTeX instead and wonder why it doesn't work. Commented Sep 11, 2012 at 14:40
• @AndrewStacey All the tips given here would work in any $\TeX$/$\LaTeX$ environment with the proper packages. MathJax is just the service used to render it. You wouldn't say "Miktex tutorial" or "texlive tutorial". Commented Sep 11, 2012 at 15:01
• @axblount But that's precisely the wrong way around to think about it! The likelihood is that someone will look at this tutorial to figure out how to write something on the Maths-SX site: i.e., to use MathJaX. If they can't find help here, where do they go? If they have the idea that MathJaX is "just a javascript implementation of TeX" then they might think to look for help with TeX, but that is quite possibly not going to be helpful. Commented Sep 11, 2012 at 15:08
• @axblount For a start, you've changed the goalposts: "LaTeX math expressions". LaTeX is so much more than just a way of typesetting maths! Second, I don't really know but it wouldn't take me long to cook one up. I don't use MathJaX so I haven't explored it. But I know, for example, that it can't handle catcode changes. Which means that I can't make ( and ) automatically resizeable. I can in LaTeX. Commented Sep 11, 2012 at 16:04
• I wish I saw this post when I first joined. This post should be a main link on the home page. There should be a button under each box: NEW TO LATEX, CLICK HERE FOR EXAMPLES. This is extremely useful, concise. Commented May 31, 2013 at 18:09
• @MJD: I use \mathrm in many places; e.g. $\mathrm{d}x$ in integrals and derivatives and for operator names that don't need the full force of \operatorname. \mathrm was intended for roman symbols in math mode; \text was intended for text because of the way it spaces things. See this TEX thread. Since I don't believe we can use preambles in MathJax, we can't use \DeclareMathOperator, though we can use \newcommand, but that is orthogonal to the use of \mathrm vs \text for math symbols.
– robjohn Mod
Commented Jun 10, 2013 at 16:23

# Mixing code and MathJax formatting on lines

To give an example of how this might be useful, I wanted to express an algorithm in more or less the same indentation and symbolic way it appears in a paper.

On my desktop browsers (Chrome, Firefox) the following appears reasonably well spaced and indented, but loses indentation on my Android smartphone:

Input: positive integer $n$
Output: Tangent numbers $T_1,\ldots,T_n$
$T_1\gets 1$
for$k$ from $2$ to$n$
$T_k\gets (k−1)T_{k−1}$
for$k$ from $2$ to$n$
for$j$ from$k$ to$n$
$T_j\gets (j −k)T_{j−1} + (j −k+2)T_j$
return $\;T_1,T_2,\ldots,T_n$.

The source can be examined for specific techniques, but the basic trick is that a MathJax dollar-delimiter can follow a closing back-tick code delimiter, but an opening back-tick should be preceded by a space when following the (closing) dollar-sign delimiter.

Here is a version using \phantom rather than code monospacing to produce indents and tweaking the spacing between code and MathJax expressions with \;, so that the results appear clear on Android browsers:

Input: positive integer $n$
Output: Tangent numbers $T_1,\ldots,T_n$
$T_1\gets 1$
for $\;k\;$ from $2\;$ to $\;n$
$\phantom{{}++{}}$ $T_k\gets (k−1)T_{k−1}$
for $\;k\;$ from $2\;$ to $\;n$
$\phantom{{}++{}}$ for $\;j\;$ from $\;k\;$ to $\;n$
$\phantom{{}++{}}$ $\phantom{{}++{}}$ $T_j\gets (j −k)T_{j−1} + (j −k+2)T_j$
return $\;T_1,T_2,\ldots,T_n$.

• But this is why we have \space, \quad, and \qquad Commented Nov 7, 2016 at 0:41
• While those are among the ways $\LaTeX$ provides control over spacing, they do not suffice for mixing code and MathJax formatting on a line. Commented Nov 7, 2016 at 1:05
• I'm not sure if the topic of mixing other code in is well-suited here. Commented Nov 7, 2016 at 2:05
• I would write the code in TeX using \texttt if I were you. Regardless, this answer probably does not belong here.
– pzp
Commented May 21, 2017 at 14:10
• @pzp: Thanks, that is an interesting suggestion. Commented May 22, 2017 at 16:15
• @hardmath you can shorten the <code></code> spacers a bit by writing <codde/>, at least in my Jupyter notebooks in Chrome. Commented Feb 6, 2018 at 22:28

# Markov Chains

This is a heuristic solution for coding Markov chains in Mathjax using a combination of commutative diagrams, the encircle tool and font sizes. There are a few minor issues with this method, for instance the arrows' ends should be attached closer to their targets. Also, it lacks double-headed diagonal arrows and it is difficult to attach probabilities to diagonal arrows. Therefore, it's mostly useful for small chains.

$$\require{enclose} \begin{array}{ccccccccc} \Large{\enclose{circle}{A}} & \xrightarrow{0.1} & \Large{\enclose{circle}{B}} & \xrightarrow{0.2} & \Large{\enclose{circle}{C}} & \xleftarrow{0.3} & \Large{\enclose{circle}{D}} & \xleftarrow{0.4} & \Large{\enclose{circle}{E}}\\\ \scriptsize{0.5}\large{\downarrow} & \scriptsize{0.6}\large{\searrow} & \scriptsize{0.7}\large{\downarrow} & \scriptsize{0.8}\large{\nearrow} & \scriptsize{0.9}\large{\downarrow} & \scriptsize{0.1}\large{\swarrow} & \scriptsize{0.2}\large{\downarrow} & \scriptsize{0.3}\large{\nwarrow} & \scriptsize{0.4}\large{\downarrow}\\\ \Large{\enclose{circle}{F}} & \xrightarrow[0.5]{} & \Large{\enclose{circle}{G}} & \xrightarrow[0.6]{} & \Large{\enclose{circle}{H}} & \xleftarrow[0.7]{} & \Large{\enclose{circle}{I}} & \xleftarrow[0.8]{} & \Large{\enclose{circle}{J}}\\ \circlearrowright\tfrac12\\ \end{array}$$

\require{enclose}
$$\begin{array}{ccccccccc} \Large{\enclose{circle}{A}} & \xrightarrow{0.1} & \Large{\enclose{circle}{B}} & \xrightarrow{0.2} & \Large{\enclose{circle}{C}} & \xleftarrow{0.3} & \Large{\enclose{circle}{D}} & \xleftarrow{0.4} & \Large{\enclose{circle}{E}}\\\ \scriptsize{0.5}\large{\downarrow} & \scriptsize{0.6}\large{\searrow} & \scriptsize{0.7}\large{\downarrow} & \scriptsize{0.8}\large{\nearrow} & \scriptsize{0.9}\large{\downarrow} & \scriptsize{0.1}\large{\swarrow} & \scriptsize{0.2}\large{\downarrow} & \scriptsize{0.3}\large{\nwarrow} & \scriptsize{0.4}\large{\downarrow}\\\ \Large{\enclose{circle}{F}} & \xrightarrow[0.5]{} & \Large{\enclose{circle}{G}} & \xrightarrow[0.6]{} & \Large{\enclose{circle}{H}} & \xleftarrow[0.7]{} & \Large{\enclose{circle}{I}} & \xleftarrow[0.8]{} & \Large{\enclose{circle}{J}}\\ \circlearrowright\tfrac12\\ \end{array}$$


Credit to Zev Chonoles for the commutative diagram.

• Is there is code that generates Feynman diagrams? Commented Jul 12, 2021 at 14:55

## Tables

W/ Sub-Variables

After spending too much time searching for a way to make tables of this form (to no avail), I spent even longer searching for the pieces (of which most were found here) to Frankenstein my own. I made this table for a combinatorics q on MSE...

$$\begin{array}{l} \begin{array}{c|c} \hskip36.5pt & \hskip42.5pt\style{font-family:inherit}{\text{Ordering}} \end{array} \\[-7pt]\hline\hskip-5.5pt \begin{array}{c|c|c} \style{font-family:inherit}{\text{Repetition}} & \style{font-family:inherit}{\text{w/}} & \style{font-family:inherit}{\text{w/o}} \\\hline \style{font-family:inherit}{\text{w/}} & P_r^n=n^r & C_r^n=\left(\!\left(\begin{smallmatrix} n \\ r \end{smallmatrix}\right)\!\right)=\left(\begin{smallmatrix} n+r-1 \\ r \end{smallmatrix}\right) \\[0pt]\hline \style{font-family:inherit}{\text{w/o}} & nPr=\frac{n!}{(n-r)!} & nCr=\left(\begin{smallmatrix} n \\ r \end{smallmatrix}\right)=\frac{n!}{r!(n-r)!} \end{array}\hskip-5.5pt \end{array}$$

W/o Sub-Variables

While searching, I found several tables of this form...

$$\begin{array}{c|c|c|c} \style{font-family:inherit}{\text{Day}} & \style{font-family:inherit}{\text{Credit}} & \style{font-family:inherit}{\text{Debit}} & \style{font-family:inherit}{\text{Total}}\\\hline 0 & 0 & 0 & 10000 \\\hline 1 & 100 & 500 & 9600 \\\hline 2 & 0 & 400 & 10000 \\\hline 3 & 1000 & 500 & 10500 \end{array}$$

• I still consider myself a MathJax novice so please comment any code simplifications/corrections & I'll make the edit. Commented Mar 20, 2019 at 5:21
• Commented Mar 20, 2019 at 5:35
• @MartinSleziak That was 1 of the questions I came across while searching for a way to make tables w/ sub-variables. Commented Mar 20, 2019 at 6:17

# Tensor indices

T^{\alpha\beta}{}_{\gamma\delta}

$$T^{\alpha\beta}{}_{\gamma\delta}$$

T^{\alpha \beta}{}_{\gamma\delta}{}^{\lambda}

$$T^{\alpha \beta}{}_{\gamma\delta}{}^{\lambda}$$

So for instance, a $$(2,2)$$-tensor would act on two covectors ($$\omega$$, $$\varphi$$) and two vectors ($$v$$,$$w$$) to produce a real number like this:

$$[T^{\alpha \beta}{}_{\gamma\delta}e_\alpha\otimes e_\beta\otimes e^\gamma \otimes e^\delta](\omega,\varphi,v,w).$$

• This trick of raising nothing to an exponent is also used by some to denote e.g. transposes, {}^t\! A yields ${}^t\! A$ Commented Oct 31, 2019 at 8:32

# Overlaying symbols

(using negative spacing)

To overlay the $$\wedge$$ \wedge and the $$\bigcirc$$ \bigcirc, to make the Kulkarni Nomizu Product:

$$\mathbin{\rlap{\,\wedge}\bigcirc}$$

Which is \mathbin{\rlap{\,\wedge}\bigcirc}.

Just for another example: Overlaying of $$\}$$ \} and $$\div$$ \div: $$\rlap{\,\,\}}\div$$

Which is \rlap{\,\,\}}\div.

The command \rlap{c1}c2 prints the character c1 with zero-width on the right-hand side of the current position, so that c2 overlaps with c1. In practice, you might want to

1. choose the widest character as c2
2. adjust the horizontal spacing by prepending c1 with extra horizontal space \,.
3. if necessary, wrap up the symbol with \mathbin so that MathJax treats the symbol like an operator, and the spacing around the symbol is correct.

As you can see, the number of \! is different, for exact overlaying of each symbol. \! makes the characters left and right to it move a little bit closer.

e.g, the code ab produces $$ab$$.
And the code a\!b produces $$a\!b$$

• The required horizontal spacing is device dependent. An alternative construct is \overset{\bullet}{\smash{cup}}. This introduces a possibly device dependent vertical offset that cannot be adjusted, but I think(??) is always perfectly horizontally centered which is sometimes better. Using mathbin one can get $A\mathbin{\overset{\bullet}{\smash\cup}}B$ for instance. Somehow a further nesting is needed for a \bigcup version: \operatorname*{\overset{\bullet}{\smash{\overset{}{\bigcup}}}}_1^\infty U_i $\operatorname*{\overset{\bullet}{\smash{\overset{}{\bigcup}}}}_1^\infty U_i$ Commented Jul 13, 2022 at 12:59

### Evaluated at (integrals):

To get a vertical bar to the right of an expression with the limits of integration, expressions such as $\Big |$$$\Big |$$ result in one-size-fits-all outputs.

\left. \right|_{}^{} works well as in the made up expression below to illustrate this feature:

$$\left. \left(3x\left(\frac{\left(\log(\frac{3x^2}{6}\right)^{\frac{-x^2}{8}}}{3x^{1/2}} \right) \right) \right|_{\;x=2}^{\;x=8}$$

• Thanks for the tip. I used to use \bigg|, but did not know you could use a period as a delimiter Commented Jul 28, 2022 at 15:56
• Upvoted. I added an answer about this here as well, only to then see your answer after-the-fact. That's okay though, as my answer expounds on it a bit more and provides additional insight. Commented Aug 27, 2022 at 4:55

Is there a way to make the Greek letters displayed upright (non-italic)?

Asked in comment. There is a way using unicode characters, for which one can search here: http://unicode-table.com/en. Normal use of phi is $\phi = ...$, which gives $$\phi = ...$$.
Looking up phi on the above site gives a couple of results, if one uses 'Greek Capital Letter Phi' and copy it with the button below its picture, and use it like
$Φ = ...$, the result is $$Φ = ...$$.
One might need to experiment which symbol(s) look(s) right.

Is there a tool to visually edit (prepare) the formulas with pre-defined symbols and paste here?

## How to draw a stretched vertical bar to indicate the bounds (upper and lower limits) after taking the anti-derivative of a definite integral

I'd like to also expound upon bullet 6 in the question, about parenthesis. I originally put my edit into the question there, but the primary editor of the question reverted my edits. I and others need this information and a good example, so here it is:

There are also invisible parentheses, denoted by ., as in \left. or \right.. These can take the place of any type of parenthesis whether it be (, [, or something else. Ex: \left.\frac12\right\rbrace is $$\left.\frac12\right\rbrace$$, and \left.\frac12\right) is $$\left.\frac12\right)$$.

To stretch a vertical bar to be tall, such as to plug in upper and lower limit values into a definite integral's antiderivative, add an invisible vertical bar on the left with \left., and a visible vertical bar on the right with \right|. For lower and upper limits of 0 and 4, respectively, the lower limit is set with _{\;0}, and the upper limit with ^{\;4}, where the \; is a wider space to shift the numbers to the right of the vertical bar.

Example: $$\left.{\left[\cfrac{x}{\cfrac{a+b}{c}}\right]}\right|_{\;0}^{\;4}$$ produces:

$$\left.{\left[\cfrac{x}{\cfrac{a+b}{c}}\right]}\right|_{\;0}^{\;4}$$