Use ampersand & to align delineate columns, two backslahes for rows, and (c)enter (l)eft and (r)ight to align, plus horizontal lines as needed:
Centered, no lines:
\begin{array} {ccc} 12345.678 & 0_1 & 0_2 \\ 1_0 & 1_1 & 1_2 \\ 2_0 & 2_1 & 2_2 \\ 3_0 & 3_1 & 3_2 \end{array}
Centered, top/header line underlined
\begin{array} {ccc} 12345.678 & 0_1 & 0_2 \\ \hline 1_0 & 1_1 & 1_2 \\ 2_0 & 2_1 & 2_2 \\ 3_0 & 3_1 & 3_2 \end{array}
Centered, all horizontal lines
\begin{array} {ccc}\hline 12345.678 & 0_1 & 0_2 \\ \hline 1_0 & 1_1 & 1_2 \\ \hline 2_0 & 2_1 & 2_2 \\ \hline 3_0 & 3_1 & 3_2 \\ \hline \end{array}
Centered, all lines
\begin{array} {|c|c|c|}
\hline 12345.678 & 0_1 & 0_2 \\
\hline 1_0 & 1_1 & 1_2 \\
\hline 2_0 & 2_1 & 2_2 \\
\hline 3_0 & 3_1 & 3_2 \\
\hline \end{array}
Right justified
\begin{array} {|r|r|r|}
\hline 12345.678 & 0_1 & 0_2 \\
\hline 1_0 & 1_1 & 1_2 \\
\hline 2_0 & 2_1 & 2_2 \\
\hline 3_0 & 3_1 & 3_2 \\
\hline \end{array}
Left justified
\begin{array} {|l|l|l|}
\hline 12345.678 & 0_1 & 0_2 \\
\hline 1_0 & 1_1 & 1_2 \\
\hline 2_0 & 2_1 & 2_2 \\
\hline 3_0 & 3_1 & 3_2 \\
\hline
\end{array}
Left justified (EXTRA padding)
\begin{array} {|l|c|}
\hline
\rule{0pt}{2.5ex} \text{Row1Col1} \rule[-1ex]{0pt}{0pt} & \text{Row1Col2} \\
\hline
\rule{0pt}{2.5ex} \text{Row2Col1} \rule[-1ex]{0pt}{0pt} & \text{Row2Col2} \\
\hline
\end{array}
Left justified with vertical lines only
\begin{array} {|l|l|l|} 12345.678 & 0_1 & 0_2 \\ 1_0 & 1_1 & 1_2 \\ 2_0 & 2_1 & 2_2 \\ 3_0 & 3_1 & 3_2 \end{array}
Two rows merged (plus bold and italics)
\begin{array} {|l|c|c|}
\hline \textbf{Base} & \textbf{Strand I} & \textit{Strand II} \\ & \textbf{composition} & \textit{composition} \\
\hline \text{adenine} & & \\
\hline \text{cytosine} & & \text{25%} \\
\hline \text{guanine} & & \text{14%} \\
\hline \text{thymine} & \text{29%} & \\
\hline \end{array}
Multiple Choice table format
\begin{align*}
\begin{array}{c|c}
\text{ line 1 } \\
\text{ line 2 }
\end{array}
\begin{array}{|c|c|}
\hline
\text{something here} \\
\hline
& \text{and some more} \\
\hline
\end{array}
\end{align*}
Multiple Choice format with first table line above option A (WITH EXTRA PADDING)
\begin{align*}
\begin{array}{l}
\rule{0pt}{2.5ex} \ \rule[-1ex]{0pt}{0pt}& \\
\rule{0pt}{2.5ex}\textbf{A.}\rule[-1ex]{0pt}{0pt}\\
\rule{0pt}{2.5ex}\textbf{B.}\rule[-1ex]{0pt}{0pt}\\
\rule{0pt}{2.5ex}\textbf{C.}\rule[-1ex]{0pt}{0pt}\\
\rule{0pt}{2.5ex}\textbf{D.}\rule[-1ex]{0pt}{0pt}\\
\end{array}
\begin{array}{|c|c|}
\hline
\rule{0pt}{2.5ex}\text{Heading 1}\rule[-1ex]{0pt}{0pt}& \text{Heading 2} \\
\hline
\rule{0pt}{2.5ex}\text{choice}\rule[-1ex]{0pt}{0pt}&\text{choice}\\
\hline
\rule{0pt}{2.5ex}\text{choice}\rule[-1ex]{0pt}{0pt}& \text{choice}\\
\hline
\rule{0pt}{2.5ex}\text{choice}\rule[-1ex]{0pt}{0pt}& \text{choice} \\
\hline
\rule{0pt}{2.5ex}\text{choice}\rule[-1ex]{0pt}{0pt}& \text{choice} \\
\hline
\end{array}
\end{align*}
Row/Column Labels outside table
\begin{align*}
\text{Heading}\\
\begin{array}{c}
\text{Gametes }
\begin{array}{|c|c|}
\hline
\text{TT} \\
\hline
& \text{tt} \\
\hline
\end{array}
\end{array}
\end{align*}
Alignment with display mode (big) "aligned" latex table
\[
\begin{aligned}
&\int_3^5 &&= 64, \\
&e^{\pi i} + 1 &&= 0, \\
&\sqrt{2} &&\approx 1.414.
\end{aligned}
\]
Evaluate \(
\begin{aligned}
\int_1^2x^2\, \log_e(x)\ dx \\
\end{aligned}
\) (3 marks)
Alignment tables with colorbox and fcolorbox options
- Note: colorbox and fcolorbox can be used outside of arrays also.
\begin{align}
\textbf{Die B }
\begin{array}{c}
\textbf{Die A} \\
\begin{array}{c|c|c|c|c|c|c}
\ & 1 & 2 & 3 & 4 & 5 & 6 \\
\hline
\ 1 & 1,1 & 1,2 & 1,3 & 1,4 & 1,5 & 1,6 \\
\hline
\ 2 & 2,1 & \colorbox{lightblue}{2,2} & 2,3 & 2,4 & 2,5 & 2,6 \\
\hline
\ 3 & 3,1 & 3,2 & 3,3 & 3,4 & 3,5 & 3,6 \\
\hline
\ 4 & 4,1 & 4,2 & \fcolorbox{red}{white}{4,3} & 4,4 & 4,5 & 4,6 \\
\hline
\ 5 & \textcolor{white}{\fcolorbox{red}{blue}{5,1}} & 5,2 & 5,3 & 5,4 & 5,5 & 5,6 \\
\hline
\ 6 & 6,1 & 6,2 & 6,3 & 6,4 & 6,5 & 6,6 \\
\end{array}
\end{array}
\end{align}
Matrix (2 x 1)
\[\textbf{r}_A(t)=\left(\begin{array}{c}v t \\vt-\dfrac{1}{2}\end{array}\right) \]
2 Matrices (2 x 1) on 1 line
\[\underset{\sim}{a}=\left(\begin{array}{c} 1 \\ 2 \\ -3 \end{array}\right),\ \ \underset{\sim}{b}=\left(\begin{array}{c} -1 \\ 4 \\ 2 \end{array}\right) \]
Matrix powers
\(T^{50} =\begin{bmatrix}
\frac{1}{3} & 0 & \frac{9}{10} \\
\frac{1}{3} & 1 & \frac{1}{10} \\
\frac{1}{3} & 0 & 0
\end{bmatrix}^{50}
\approx \begin{bmatrix}
0 & 0 & 0 \\
1 & 1 & 1 \\
0 & 0 & 0
\end{bmatrix}\)
Matrix multiplication
\(P \times Q =\begin{bmatrix}
1 & 0 & 0 & 0 & 0 \\
0 & 0 & 1 & 0 & 0 \\
0 & 0 & 0 & 1 & 0 \\
0 & 1 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 1
\end{bmatrix}
\begin{bmatrix}
t \\
e \\
a \\
m \\
s
\end{bmatrix}
= \begin{bmatrix}
t \\
a \\
m \\
e \\
s
\end{bmatrix}\)
Matrix with column and row labels
\begin{aligned} \\
& \quad R \ \quad \ \ M \\
B = & \begin{bmatrix}
80 & 95 \\
110 & 120 \\
120 & 125
\end{bmatrix}\begin{array}{l}
C\\
J\\
A
\end{array}
\end{aligned}
And other combinations are allowed.
Details: https://latex-programming.fandom.com/wiki/Array_(LaTeX_environment)