Latex and gitbook

A collection of recipes about gitbook and tex friendship šŸ’š

Quantum computing

Brackets

\left\langle \frac{1}{2} \middle| 1 \right\rangle

āŸØ12|1āŸ©\left\langle \frac{1}{2} \middle| 1 \right\rangle

Diagrams

\begin{matrix}
  && \Bbb Q(\sqrt{2},i) & \\
  &\huge\diagup & \huge| & \huge\diagdown \\
  \Bbb Q(\sqrt{2}) & & \Bbb Q(i\sqrt{2})&  & \Bbb Q(i)\\
  &\huge\diagdown & \huge| & \huge\diagup \\
  &&\Bbb Q
\end{matrix}

Q(2,i)ā•±āˆ£ā•²Q(2)Q(i2)Q(i)ā•²āˆ£ā•±Q\begin{matrix} && \Bbb Q(\sqrt{2},i) & \\ &\huge\diagup & \huge| & \huge\diagdown \\ \Bbb Q(\sqrt{2}) & & \Bbb Q(i\sqrt{2})& & \Bbb Q(i)\\ &\huge\diagdown & \huge| & \huge\diagup \\ &&\Bbb Q \end{matrix}

Mathematics

Fractions and brackets

\left( \begin{array}{cc} 2\tau & 7\phi-frac5{12} \\
3\psi & \frac{\pi}8 \end{array} \right)
\left( \begin{array}{c} x \\ y \end{array} \right)
\mbox{~and~} \left[ \begin{array}{cc|r}
3 & 4 & 5 \\ 1 & 3 & 729 \end{array} \right]

\left( \begin{array}{cc} 2\tau & 7\phi-frac5{12} \\ 3\psi & \frac{\pi}8 \end{array} \right) \left( \begin{array}{c} x \\ y \end{array} \right) \mbox{~and~} \left[ \begin{array}{cc|r} 3 & 4 & 5 \\ 1 & 3 & 729 \end{array} \right]

Function definition

f(z) = \left\{ \begin{array}{rcl}
\overline{\overline{z^2}+\cos z} & \mbox{for}
& |z|<3 \\ 0 & \mbox{for} & 3\leq|z|\leq5 \\
\sin\overline{z} & \mbox{for} & |z|>5
\end{array}\right.

f(z) = \left\{ \begin{array}{rcl} \overline{\overline{z^2}+\cos z} & \mbox{for} & |z|<3 \\ 0 & \mbox{for} & 3\leq|z|\leq5 \\ \sin\overline{z} & \mbox{for} & |z|>5 \end{array}\right.

Equations align

\eqalign{
(a+b)^2 &= (a+b)(a+b) \\
        &= a^2 + ab + ba + b^2 \\
        &= a^2 + 2ab + b^2
}

\eqalign{ (a+b)^2 &= (a+b)(a+b) \\ &= a^2 + ab + ba + b^2 \\ &= a^2 + 2ab + b^2 }

Hat

\hat\imath

\hat\jmath	

\hat ab

\hat{ab}

ı^ȷ^a^bab^\hat\imath \\ \hat\jmath \\ \hat ab \\ \hat{ab}

Matrices

Type 1


\begin{matrix}
\hline
x_{11} & x_{12} \\
x_{21} & x_{22} \strut \\
\hdashline
x_{31} & x_{32} \strut
\end{matrix}

\begin{matrix} \hline x_{11} & x_{12} \\ x_{21} & x_{22} \strut \\ \hdashline x_{31} & x_{32} \strut \end{matrix}

Type 2

A = \pmatrix{
a_{11} & a_{12} & \ldots & a_{1n} \cr
a_{21} & a_{22} & \ldots & a_{2n} \cr
\vdots & \vdots & \ddots & \vdots \cr
a_{m1} & a_{m2} & \ldots & a_{mn} \cr
}

A = \pmatrix{ a_{11} & a_{12} & \ldots & a_{1n} \cr a_{21} & a_{22} & \ldots & a_{2n} \cr \vdots & \vdots & \ddots & \vdots \cr a_{m1} & a_{m2} & \ldots & a_{mn} \cr }

Limits

\sum_{k=1}^n a_k

āˆ‘k=1nak\sum_{k=1}^n a_k

References

A complete list is available at https://www.onemathematicalcat.org/MathJaxDocumentation/TeXSyntax.htm

Last updated