Dear Norwid,

I am overwhelmed by your response to my Saturday afternoon roff
exercise! Thank you for your copious feedback, also with regard mhchem,
etc. I installed IQmol on my computer to explore the field a bit
further. Besides that, there is quite a zoo of chemical notations! Of
which I was blissfully unaware.

You are right, I chose a very simple dictionary approach to display
chemical formulae, and a number of issues waits to be addressed. That
was one intent of my original post. My original motivation was to make
it easier to type formulae (and correct names) of chemical substances in
*non-Chemistry* documents, like legal papers dealing with certain
substances (think of laws, environmental protection texts, etc.). It
must be mentioned that I am not a trained chemist; I am purely driven by
a layman's curiosity.

Isomers and isotopes are not [yet] dealt with, complexes using square
brackets another one. Charges (ions) already were mentioned in our last
exchange.

In the meantime, Branden had inspected my superscript-/subscript code
and discovered a few flaws there. These flaws being fixed, probably ions
will work as well.

I did not yet look at all at different styles of chem, that was far
beyond the scope of last Saturday's session.

The fullerene C70 (or rather, its absence) shows one important
deficiency of the dictionary approach. In a normal groff run, a missing
definition risks to go by unnoticed, so warnings *must* be used. Another
possibility is to imagine some kind of string processing that would at
least produce the proper display formula.

I'll be able to return to an in-depth session on these issues in
Mid-December. Please rest assured that I read your messages even if I do
not immediately reply.

Best regards,

Oliver.


On 14/11/2024 12:39, Norwid Behrnd wrote:
Dear Oliver

At the side, I engaged the macro you shared a couple of times, and compared
its result with early tests with `chem` (i.e. chem (groff 1.23.0) 1.0.6 as
packaged in Linux Debian 13/trixie).  Because the later allows to define and
write

```
.cstart
HCl.H2O
.cend
```

as mentioned early in the manual, and paper.[1]  For illustration, I attach a
`demo.troff` and compiled `demo.pdf` to this email.

An advantage of working with `chemicals.tmac` is that after compilation, the
formula appears right on the line -- while `chem` adds at least a line feed.
Two disadvantages of `chemicals.tmac` I recognized are

- the dictionary-like approach.  The current format of CAS registry numbers
   has a key space of 10**9 records.  While only a small fraction (about 500k)
   are public, to maintain and update the/a list in/around `chemicals.tmac`
   to look-up for instance the chemical name does not appear as practical.
   Compounds unknown _to the list_ fail regarding the look-up of name and
   registry number, it is impossible to type them (example C70, an other
   fullerene).

   A more robust implementation would allow to work write the formulae locally
   without lookup / (internet) connection to a database.
- square brackets _apparently_ are not supported (yet), which eventually
   excludes Werner complexes.  At present, `chem` supports these reasonably
   well (cf. the example attached).  Perhaps the approach in `chem` can provide
   an inspiration how to address this (consider this like a feature suggestion).
   Or, if the source code of `chem` is public and its license permit it, the
   ideas of `chem` and `chemical.tmac` can be joined for mutual improvement.
   So far, however, I'm not familiar with writing troff macros -- this was
   beyond my scope of usage, and needs.

Best regards,

Norwid

[1]https://doi.org/10.1016/0097-8485(87)85006-4
--

Dr. Oliver Corff
Wittelsbacherstr. 5A
10707 Berlin
G E R M A N Y
Tel.: +49-30-85727260
Mail:oliver.co...@email.de

Reply via email to