System to describe the chemical formulas for WEB.

# Linear formulas

Rules and examples of description of linear chemical formulas and reaction equations.

## Quick start

Let's start with the simple. Description H2O transformed into H2O. Comments are not required...

Look more interesting options:

 H3BO3 + 3C2H5OH = (C2H5O)3B + 3H2O H3BO3 + 3C2H5OH = (C2H5O)3B + 3H2O H^+ + HCO3^- = CO2"|^" + H2O H^+ + HCO3^- = CO2"|^" + H2O CaCO3 "1000^oC"--> CaO + CO2"|^" CaCO3 "1000^oC"--> CaO + CO2"|^" 4Fe^2+ + 3[Fe(CN)6]^3- -> Fe(iii)4[Fe(ii)(CN)6]3"|v" 4Fe^2+ + 3[Fe(CN)6]^3- -> Fe(iii)4[Fe(ii)(CN)6]3"|v" [Fe(H2O)6]3^+ + H4{EDTA} <-> [Fe({EDTA})]^- + 6H2O + 4H^+ [Fe(H2O)6]3^+ + H4{EDTA} <-> [Fe({EDTA})]^- + 6H2O + 4H^+ NH2-CH2-COOH <=> N(+)H3-CH2-COO(-) NH2-CH2-COOH <=> N(+)H3-CH2-COO(-) HC%CH + Cl2 -> ClCH=CHCl HC%CH + Cl2 -> ClCH=CHCl
Apparently, you can get well-formed formula using rather simple and intuitive descriptions.

## Rules for a text description of the formulas.

Consider the possibilities in more detail.

### The general structure of the formula.

Recognition of formulas does not just describe a single substance, but the whole equation. Formally, the equation is treated as a chain of reagents (agents) and operations. Reagents and operations are separated by spaces. Reagent - a description of a substance (ion, radical, ...).

### Operations

Most of the operations used to separate the left and right sides of the equation. Operations + and * are separates reagents. Text descriptions of operations is recorded by simple characters, easily accessible from the keyboard. But then they are translated to special characters that correspond generally accepted in chemistry. These rules are not strict, but the idea was the following:
 Reaction to meet the stoichiometric ratio = = Used to refer to the direct reaction --> -> → ® --> -> → ® Designation of the reaction executing in both directions <-> ↔ <-> ↔ Designation of chemical equilibrium <=> <=>
Might reasonably ask why the symbol ® corresponds to the arrow? The fact that some sites use 'Simbol' font to display the arrow. If this arrow to select and copy to the editor, then it becomes a ®, but it does not matter, because this situation is handled correctly.

### Reagents

Numerical coefficient can stand before the reagent. Next come the items.
Itemss are most often refer to the atoms. But there may be abstract items or comments.
Atoms are designated in the same way as in the periodic table. Must be an exact match capital and small letters. For example: Sn - Tin, SN - sulfur and nitrogen, sn - error.
After the item, you can specify a quantitative factor: H2SO4 becomes H2SO4.

### Groups of items

Elements can be grouped with parentheses or brackets. If you specify a quantitative factor or other properties, the group members are regarded as a single item.
 Ca(OH)2 Ca(OH)2 Al2(SO4)3 Al2(SO4)3 K3[Fe(CN)6] K3[Fe(CN)6]

### Ionic charge and oxidation number

If you need to specify the charge of the ion, then it became a symbol ^ at the end of the reagent and the charge in a convenient way. You can write a + - ++ -- +2 2+. You can write the Roman numerals, but not capitalized (as capital letters are used to refer to the chemical elements). The oxidation number of the element can be specified immediately after the designation of this item in parentheses.
 3H^+ + PO4^3- 3H^+ + PO4^3- H(+)N(+5)O(-2)3 H(+)N(+5)O(-2)3 Fe(iii)4[Fe(ii)(CN)6]3 Fe(iii)4[Fe(ii)(CN)6]3

You can add comments to the description of the reagent or operation. This is a quoted string.    Comments written close (no space).    Inside the quotes, you can use any character (except the quotes).    There are some magical combinations for frequently used special characters:
Description Source code Output result
Degree ^o °
Arrow Up |^ or ArrowUp
Arrow Down |v or ArrowDown
Example:
 CaCO3"(s)" "1000^oC"--> CaO + CO2"|^" CaCO3"(s)" "1000^oC"--> CaO + CO2"|^"

In addition, in the comments, you can use Greek letters. To do this, enter the name of the letter in square brackets.

 2H2 + O2 -> 2H2O", [Delta]H = -483,6 kJ/mol" 2H2 + O2 -> 2H2O", [Delta]H = -483,6 kJ/mol"

### Abstract items

Sometimes you need to write a formula not for a single substance, but for a group of substances with a common property. Or replace some complicated part of the formula by short name. You can use any text in curly brackets:
 Hydroxide {R}-OH {R}-OH Amino acid NH2-CH({R})-COOH NH2-CH({R})-COOH Chelate complex of iron [Fe({EDTA})]^- [Fe({EDTA})]^-
The text in curly braces is an abstract element. In some ways it is similar to a comment. We can apply quantitative coefficients and oxidation number.

### Abstract coefficients

For polymer molecules often do not indicate the exact coefficients, and use the notation n. To do this in easyChem use the text in single quotes (apostrophes). If an abstract coefficient is in front of the reagent, it applies to all the reagent. If an abstract is coefficient after the item it is applied to the item.
 Polyethylene CH3-(CH2)'n'-CH3 CH3-(CH2)'n'-CH3 Rust Fe(OH)'3-x'O'x/2' Fe(OH)'3-x'O'x/2'
It is impossible calculation of molecular weight and empirical formula for formulas that contain abstract coefficients.

### Isotope

You can use the \$M function to specify atomic mass of the next item:
 Uranium-235 \$M(235)U \$M(235)U Heavy water \$M(2)H2O \$M(2)H2O

### Color highlight

Different parts of the formulas can be highlighted. You can use several functions listed in the table below. Color in them is given in the same way as in HTML and CSS: either by name (red, green, blue ...), or by hexadecimal values (#FF0000, #0F0, #008).
Function name Purpose Scope
\$color(red) Common color Until the end of the formula.
\$itemColor(red) Item color. No effect on bonds, operations, and a preliminary coefficient of reagents. Until the end of the formula.
\$itemColor1(green) Item color Only the next item.
\$atomColor(black) Atomic color. It is effects to atoms only. Until the end of the formula.
\$atomColor1(#F00) Atomic color. Only the next item.
You can call this functions with empty arguments list to reset default color.
Example:
2\$itemColor1(red)NaOH + \$atomColor(blue)2H2SO4\$atomColor() = \$itemColor1(#F00)Na2SO4 + \$color(#00F)H2"|^"
2\$itemColor1(red)NaOH + \$atomColor(blue)2H2SO4\$atomColor() = \$itemColor1(#F00)Na2SO4 + \$color(#00F)H2"|^"