Dear Oliver
The idea to write `\*[H2O]` to relay the (all/most/much) of the work to
manually call subscripts in molecular formulae to an algorithm reminds me a
bit to mhchem[1] available both as a package to LaTeX[2] as well as an
extension available for posts on chemistry.stackexchange.com[3] to extend
their markdown syntax for simple chemical (redox) equations. Hence I welcome
your announcement of your work. Maybe your work is extendable so that future
versions equally can consider superscripts as in charges ($\ce{Cu^+}$,
$\ce{Mg^{2+}}$, $\ce{Cl^-}$, etc), or isotopic elements ($\ce{^{31}P}$,
$\ce{^{13}CDCl3}$, etc.
By now, the English edition of Wikipedia contains 21876 records of chemicals
which can be searched by chemical structure.[4] I can send you a list of them,
including one of their chemical names in a separate mail.
Based on the .pdf file you shared in your email, I get the impression the
molecular formula would become "the shorthand", or "a tag" which eventually
is resolved to yield the CAS registry number. This can work for BaSiF6
presuming Chemical Abstracts by the American Chemical Society doesn't change
the CAS number for this material. However, it is their book keeping, and they
occasionally do retire and reassign these numbers -- see, for instance,
water.[5]
Note, for many organic compounds provision of the sum formula still is
ambiguous. See for instance 2-methylpyridine,[6] 3-methyl pyridine,[7] and
4-methyl pyridine.[8] These are three isomers of CH3C5H4N each -- they differ
"only" in the way how the individual atoms are joined to yield a molecule (and
consequentially, different CAS registry numbers were assigned to them).
Best regards
Norwid
[1] https://mhchem.github.io/MathJax-mhchem/
[2] https://www.ctan.org/pkg/mhchem
[3]
https://chemistry.stackexchange.com/questions/40098/how-to-balance-this-redox-reaction
[4] https://wikipedia.cheminfo.org/
[5] https://commonchemistry.cas.org/detail?cas_rn=7732-18-5&search=water
[6] https://en.wikipedia.org/wiki/2-Methylpyridine
[7] https://en.wikipedia.org/wiki/3-Methylpyridine
[8] https://en.wikipedia.org/wiki/4-Methylpyridine
On Sat, 9 Nov 2024 22:15:34 +0100
Oliver Corff via GNU roff typesetting system discussion <groff@gnu.org> wrote:
Dear All,
once I had compiled a short list of macros for chemical names which
allowed me to express subscripted chemical formulae in a simple manner,
like writing H2O for water. \*[H2O] will take care of the subscripts.
This afternoon, my wandering mind thought it would be nice to expand
this list. In wikipedia, there is a list of more than 2,000 names. I
converted these into a list of macros which can produce the correct
formula, the substance name and also, if available, the CAS number. The
whole macro package is technically trivial but it might help save some work.
Once the documentation is ready (in the form of a huge table) and
provided there is an interest in the community, I'll be happy to
contribute this to groff.
Currently, there are still some minor deficiencies; and I'll only have
time for the documentation in December.
Best regards,
Oliver.
--
Dr. Oliver Corff
Mail:oliver.corff@email.de