SmarterEd

Aussie Maths & Science Teachers: Save your time with SmarterEd

  • Login
  • Get Help
  • About

K_EXAM Tables and matrices built with mathjax array

Use ampersand & to align delineate columns, two backslashes 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*}

 

Text within a single box (LATEX) 

\begin{array} {|l|}
\hline
\ \rule{0pt}{4ex} \textit{Utilitarian Ethics}\\
\ \text{An ethical activity is one that provides the greatest balance of good over} \quad \\
\ \text{harm for society and the environment.}\\
\text{}\\
\ \textit{The Precautionary Principle}\\
\ \text {If there is doubt about the harm that may be caused by an activity, the}\\
\ \text {proposers of the activity must prove the harm is not significant for society}\\
\ \text {and the environment.}\rule[-3ex]{0pt}{0pt} \\
\hline
\end{array}

Text within a single box (HTML)

Instructions: in the Text editor tab, insert the following HTML snippet. You can add/edit the content in the Visual tab afterwards.

<div style="padding: 16px; border: 1px solid black; margin-left: 30px; width: 35rem; text-align: left; font-family: 'Times New Roman', Times, serif; font-size: 1.1rem;"><em>Content goes here</div>

SAMPLE: 

Content goes here

Text within a single box with self filling dots in line with text (HTML)

Instructions: in the Text editor tab, insert the following HTML snippet. You can add/edit the content in the Visual tab afterwards.

<div style="padding: 16px 16px 4px 16px; border: 1px solid black; margin-left: 30px; width: 35rem; text-align: left; font-family: 'Times New Roman', Times, serif; font-size: 1.1rem; display: flex; align-items: baseline;">Content goes here <span style="flex: 1; border-bottom: 2px dotted black; margin-left: 5px; padding-bottom: 2px; margin-bottom: 6px;"> </span></div>

SAMPLE: 

Content goes here ................................................................................................

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)

 

 

 

Filed Under: Docs

cancel strike through latex

\( \bcancel{100} \)

\( \xcancel{100} \)

\( \cancel{100} \)

\( \cancelto{50}{100} \)

100 regular text, not latex

Filed Under: Docs

HTML table example templates in editor

These are table example templates built on the "SensibleDefaultsTable"

Note: Select the "Table" in the bottom right corner of this editor (in edit mode) to then indent the entire table

Simple table
a1 b1 c1
a2 b2 c2
a3 b3 c3

 

No left border
a b1 c1
b b2 c2
c b3 c3

 

Filed Under: Docs

Tables and matrices built with mathjax array

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*}

 

Text within a single box (LATEX) 

\begin{array} {|l|}
\hline
\ \rule{0pt}{4ex} \textit{Utilitarian Ethics}\\
\ \text{An ethical activity is one that provides the greatest balance of good over} \quad \\
\ \text{harm for society and the environment.}\\
\text{}\\
\ \textit{The Precautionary Principle}\\
\ \text {If there is doubt about the harm that may be caused by an activity, the}\\
\ \text {proposers of the activity must prove the harm is not significant for society}\\
\ \text {and the environment.}\rule[-3ex]{0pt}{0pt} \\
\hline
\end{array}

Text within a single box (HTML)

Instructions: in the Text editor tab, insert the following HTML snippet. You can add/edit the content in the Visual tab afterwards.

<div style="padding: 16px; border: 1px solid black; margin-left: 30px; width: 35rem; text-align: left; font-family: 'Times New Roman', Times, serif; font-size: 1.1rem;"><em>Content goes here</div>

SAMPLE: 

Content goes here

Text within a single box with self filling dots in line with text (HTML)

Instructions: in the Text editor tab, insert the following HTML snippet. You can add/edit the content in the Visual tab afterwards.

<div style="padding: 16px 16px 4px 16px; border: 1px solid black; margin-left: 30px; width: 35rem; text-align: left; font-family: 'Times New Roman', Times, serif; font-size: 1.1rem; display: flex; align-items: baseline;">Content goes here <span style="flex: 1; border-bottom: 2px dotted black; margin-left: 5px; padding-bottom: 2px; margin-bottom: 6px;"> </span></div>

SAMPLE: 

Content goes here ................................................................................................

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)

 

 

 

Filed Under: Docs

Mathjax latex/tex like alternative to asciimath with chemistry physics and tables example

Asciimath uses backticks for inline maths, e.g. `x^2`

Latex/tex can be used now also e.g. \(x^2\), and instead of backticks, uses:

  • A backslash and left round bracket to start, and a backslack and right round bracket to end for inline "small" formula such as \(f_k = f(x_k),\: x_k = x^*+kh,\: k=-\frac{N-1}{2},\dots,\frac{N-1}{2}\)
  • Two dollar signs to start, and two to end, for "display" or "large" formula which always display on their own line such as below:

$$f_k = f(x_k),\: x_k = x^*+kh,\: k=-\frac{N-1}{2},\dots,\frac{N-1}{2}$$

 

For us, latex/tex works like a superset of asciimath.  For example, with the extra capabilities (via ams [which includes alignment] and mathtools [which includes special math symbols, arrow, etc.] with further mathtools detail here) that latex/tex gives us, we can auto-align the equals signs in equations with the following (note for these special items, the begin/end elements are sufficient to indicate math formula):

\begin{align}
3x-1 &= -10 \\
3x &= -9 \\
x &= -3
\end{align}

Or use simple array formatting with a single indent, such as:

\begin{array}{cc}
a & b \\
c & c
\end{array}

Two more examples of inline (small) and display (large) are the following:

\(\int_0^\infty \frac{x^3}{e^x-1}\,dx = \frac{\pi^4}{15}\)

$$\int_0^\infty \frac{x^3}{e^x-1}\,dx = \frac{\pi^4}{15}$$

 

We can also insert chemistry formula via the mhchem extension such as:

Example 1: \(\ce{C6H5-CHO}\)

Example 2: \(\ce{$A$ ->[\ce{+H2O}] $B$}\)

Example 3: \(\ce{SO4^2- + Ba^2+ -> BaSO4 v}\)

Example 4: \(\ce{Zn^2+ <=>[+ 2OH-][+ 2H+] $\underset{\text{amphoteres Hydroxid}}{\ce{Zn(OH)2 v}}$ <=>[+ 2OH-][+ 2H+] $\underset{\text{Hydroxozikat}}{\ce{[Zn(OH)4]^2-}}$}\)

 

And physics capabilities/special symbols via another extension such as:

\( -{1\over2}\nabla^2\psi({\bf x})+V(r)\psi({\bf x})=E\psi({\bf x}) \)

 

You can also mix and match all these elements such as formula alignment (see https://teacher.smartermaths.com.au/tables-built-with-mathjax-array/ for further detail) from the ams package with chemistry:

\begin{align}
\ce{C6H5-CHO} &= \ce{C6H5-CHO} \\
 &= \ce{C6H5-CHO}
\end{align}

Note: There are also extensions for physics and many other topics: please see tex/latex extensions

Show Answers Only

\(\ce{C6H5-CHO}\)

Show Worked Solution

\begin{align}
\ce{C6H5-CHO} &= \ce{C6H5-CHO} \\
 &= \ce{C6H5-CHO}
\end{align}

 

 

Filed Under: Docs

Copyright © 2014–2025 SmarterEd.com.au · Log in