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

Quantum computing

Brackets

1
\left\langle \frac{1}{2} \middle| 1 \right\rangle
Copied!
​
⟨12|1⟩\left\langle \frac{1}{2} \middle| 1 \right\rangle

Diagrams

1
\begin{matrix}
2
&& \Bbb Q(\sqrt{2},i) & \\
3
&\huge\diagup & \huge| & \huge\diagdown \\
4
\Bbb Q(\sqrt{2}) & & \Bbb Q(i\sqrt{2})& & \Bbb Q(i)\\
5
&\huge\diagdown & \huge| & \huge\diagup \\
6
&&\Bbb Q
7
\end{matrix}
Copied!
​
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

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

Function definition

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

Equations align

1
\eqalign{
2
(a+b)^2 &= (a+b)(a+b) \\
3
&= a^2 + ab + ba + b^2 \\
4
&= a^2 + 2ab + b^2
5
}
Copied!
​

Hat

1
\hat\imath
2
​
3
\hat\jmath
4
​
5
\hat ab
6
​
7
\hat{ab}
Copied!
​
Δ±^Θ·^a^bab^\hat\imath \\ \hat\jmath \\ \hat ab \\ \hat{ab}

Matrices

Type 1

1
​
2
\begin{matrix}
3
\hline
4
x_{11} & x_{12} \\
5
x_{21} & x_{22} \strut \\
6
\hdashline
7
x_{31} & x_{32} \strut
8
\end{matrix}
Copied!
​

Type 2

1
A = \pmatrix{
2
a_{11} & a_{12} & \ldots & a_{1n} \cr
3
a_{21} & a_{22} & \ldots & a_{2n} \cr
4
\vdots & \vdots & \ddots & \vdots \cr
5
a_{m1} & a_{m2} & \ldots & a_{mn} \cr
6
}
Copied!
​
​

Limits

1
\sum_{k=1}^n a_k
Copied!
​
βˆ‘k=1nak\sum_{k=1}^n a_k

References

​