Skip to content

Reactions

A reaction has reactants, an arrow, and products. Conditions sit in bracketed groups immediately after the arrow.

ArrowKindUse
->:forwardNet forward reaction
<-:reverseNet reverse reaction
<=>:equilibriumEquilibrium (Haber, acid/base)
<=>+:donationEquilibrium carrying an electron-pair donation (mhchem’s form)
<=>-:removalEquilibrium carrying an electron-pair removal
<->:resonanceResonance structures
Source Rendered
2H_2 + O_2 -> 2H_2O HCl + NaOH -> NaCl + H_2O CH_4 + 2O_2 -> CO_2 + 2H_2O
Install the asciichem gem to see this rendered.

Reactants and products are each a +-separated list of molecules. The + operators are stripped from the model; the renderer reinserts them.

The equilibrium arrow carries an electron-pair marker the way mhchem spells it — <=>+ donates a pair onto the equilibrium, <=>- removes one; conditions still attach after the marker:

Source Rendered
A <=>+ B A <=>-[hv] B
Install the asciichem gem to see this rendered.

The MathML renderer emits the marker beside the equilibrium glyph (⇌⁺ / ⇌⁻); the canonical text round-trips verbatim.

The Haber process — nitrogen and hydrogen over an iron catalyst at elevated temperature:

Source Rendered
N_2 + 3H_2 <=>[Fe][400°C] 2NH_3
Install the asciichem gem to see this rendered.

The first bracketed group [Fe] is the above condition (catalyst). The second bracketed group [400°C] is the below condition (temperature). Both are captured as Reaction#conditions.

The MathML renderer emits the arrow as an <munderover>:

<munderover>
<mo>⇌</mo>
<mtext>Fe</mtext>
<mtext>400°C</mtext>
</munderover>

Only the above condition:

Source Rendered
A <=>[H_2O] B
Install the asciichem gem to see this rendered.

Only the below:

Source Rendered
A <=>[Δ] B
Install the asciichem gem to see this rendered.

(Use the second form when the condition is energy/heat, by convention placed below the arrow.)

A condition can name its role explicitly when the above/below convention is not the whole story:

Source Rendered
A + B ->[cat: Pd; base: Na_2CO_3][solv: THF] C
Install the asciichem gem to see this rendered.

cat/catalyst, solv/solvent, and reag/reagent prefixes produce typed entries (Conditions#entries); ; separates entries inside one bracket; anything else stays free text. The bracket text is preserved verbatim, so the round-trip stays exact. See the Reaction model for the entry shape.

Source Rendered
Ag^+ + Cl^- -> AgCl
Install the asciichem gem to see this rendered.

Ions on either side are full Molecule instances with their charge captured on the relevant atom. Round-trip is exact.

  • Reversible resonance is supported; tautomerism arrows are not.
  • Multi-step reactions (chained arrows) require explicit Reaction nodes per step.
  • Rates and stoichiometry validation are out of scope for the parser — a separate linter pass can verify balancing.
Play