본문으로 바로가기

【LaTex】Mathjax Library (1)

category Coding/LaTex 2020. 6. 30. 05:38

In the last post, we tested some of Latex Cheatsheet's syntax to check if they are transferrable in Mathjax-html environment. However, most of the test turned out to be failure, with most syntax not being printed out as expected.

 

 

【LaTex】Cheat Sheet Test

It appears that not all LaTex commands work in Mathjax set-up. We will experiment with the commands listed in the Cheat Sheet and discern what works and what not. Symbols Script Output \& $\&$ \_ $..

quant-curiosity.tistory.com

 

After some additional research, I found a resource, a stackexchange discussion, with a detailed list of syntax that can be used in lieu of cheatsheet's syntax. Please find the information below.

 

번역본은 밑에 있는 링크를 통해 보실 수 있습니다.

 

【LaTex】Mathjax Library (1) :: 한글 ver.

In Pursuit of Quantamental Curiosity

quant-curiosity.tistory.com

 

 

Mathjax
Working Syntax

1. 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.)

 

 

Image 1. Show Math As > TeX Commands

 

 

Image 2. Result

 

 

 

2. 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 (inline mode)

 

$\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$

 

or type

 

$$\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$$

to show (display mode)

 

$$\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$$

 

 

 

3. For Greek letters, use \alpha, \beta, …, \omega. For uppercase, use \Gamma, \Delta, …, \Omega.

 

# Lowercase Greek Letters
\alpha, \beta, …, \omega. 

# Uppercase Greek Letters
\Gamma, \Delta, …, \Omega.

 

LowerCase:

 

$$\alpha, \beta, ..., \omega$$

 

 

UpperCase:

 

$$\Gamma, \Delta, ..., \Omega$$

 

 

 

4. For superscripts and subscripts, use ^ and _. 

 

For example,

x_i
x^2
x_i^2

\log_2
\sigma_x^2 \sigma_y^2

 

Result:

$$ x_i$$ $$x^2$$ $$x_i^2$$ $$\log_2$$ $$\sigma_x^2 \sigma_y^2 $$

 

 

5. 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: $10^{10}$. Use curly braces to delimit a formula to which a superscript or subscript applies.

 

 

 

x^5^6  >>> Error 

Observe the difference between:

{x^y}^z 
x^{y^z} 

x_i^2 x2i 
x_{i^2} xi2

 

Results:

$$x^5^6$$ $${x^y}^z$$ $$x^{y^z}$$ $$x_i^2 x2i $$ $$x_{i^2} xi2$$

 

 

{i^2} is interprested as square of i instead of squaring $x_i$. 

 

 

6. 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 (√xy3).

\left and\right apply to all the following sorts of parentheses:

 

( and )               \left(x\right)
[ and ]               \left[x\right]
\{ and \}             \left\{x\right\}
|                     \left|x\right|
\vert                 \left\vert x\right\vert
\Vert                 \left\Vert x \right\Vert
\langle and \rangle   \langle x \rangle
\lceil and \rceil     \lceil x \rceil
\lfloor and \rfloor   \lfloor x \rfloor

Results:

( and )   $\left(x\right)$

[ and ]   $\left[x\right]$

\{ and \}   $\left\{x\right\}$

|   $\left|x\right|$

\vert   $\left\vert x\right\vert$

\Vert   $\left\Vert x \right\Vert$

\langle and \rangle    $\langle x \rangle$

\lceil and \rceil    $\lceil x \rceil$

\lfloor and \rfloor    $\lfloor x \rfloor$

 

\middle ( $\middle$) can be used to add additional dividers. There are also invisible parentheses, denoted by .: \left.\frac12\right\rbrace is 12}. ($\left.\frac12\right\rbrace$).

 

If manual size adjustments are required: \Biggl(\biggl(\Bigl(\bigl((x)\bigr)\Bigr)\biggr)\Biggr) gives $\Biggl(\biggl(\Bigl(\bigl((x)\bigr)\Bigr)\biggr)\Biggr)$.

 

 

We will continue with the next 6 tips in the next post. 

'Coding > LaTex' 카테고리의 다른 글

【LaTex】Mathjax Library (1) :: 한글 ver.  (0) 2020.07.18
【LaTex】Mathjax Library (2)  (0) 2020.06.30
【LaTex】Cheat Sheet Test  (0) 2020.06.23
【LaTex】 How to set-up LaTex in Tistory Blog  (0) 2020.06.22