A packing calculation reads more clearly when the substitution and result line up. In a Markdown renderer that recognizes display math and supports KaTeX’s aligned environment, put all three lines in one block.

$$
\begin{aligned}
q &= 7(2+3) \\
  &= 7\times 5 \\
  &= 35
\end{aligned}
$$

A source excerpt marks the alignment ampersand and TeX row breaks in an aligned block.

Example source. Put the alignment marker before each equals sign.

Preview the whole calculation

The ampersands mark the alignment column. The double backslashes end the first two rows. In the preview, confirm that all three equals signs share a column and the last line reads 35.

The preview shows three equalities aligned at one column, ending in 35.

Example render. Check the line count and the final value.

If you see literal dollar signs or the environment name, check whether the destination enables the same math syntax. Keep an ordinary sentence with the result if the note also travels to a plain-text destination.

KaTeX’s supported environments.