Syntax is the set of rules governing the composition of expressions.

Ultimately, computer syntax explores the question: how do we express things through using the keys on the keyboard?

How do you show stuff like math symbols, chemical equations and things? Well, I’m just grateful that humanity can agree on some typesettings.

latex

One format to rule them all, so yeah, latex.

math

Basics of latex:

  • a pair of single dollar signs, $$, enclose inline latex
  • a pair of double dollar signs, $$$$, enclose block display latex
  • letters are italic by default unless enclosed within \text{} or \mathrm{}

chemistry

Writing chemical equations so hard! My first instinct would be, “let’s try using latex to format chemical formulas!”

So, yeah, latex is the universally accepted method for writing everything I guess.

this reddit post published recently says that to format chemistry

  • enclose chemical formula within \mathrm{} to make letters not italic
  • use \textit{} to depict italic letters within \mathrm{}
  • use \rightarrow and \rightleftharpoons to depict arrows
  • superscripts or subscripts that precede the text can use a pair of empty brackets like {}^2H
  • if superscripts and subscripts have to stack do superscripts first
  • if superscript comes after subscript use empty brackets as separator between them