Chemical Structure Kerning
Kerning often comes up in the context of typography, in which it refers to adjustments made to the horizontal space between characters. Balanced whitespace can have an enormous effect on both readability and visual perception of quality, which explains why kerning has been important in typography for many years.
Chemical Structure Layout
Although rarely discussed, chemical structure layout shares many similarities to the arrangement of characters in typography. For example, the horizontal positioning of three or more structures in a row forces the author to decide how to space each structure. This is essentially the same faced when laying out a line of text and solved with kerning.
A recent question by Renée Webster on Twitter suggests that this topic might be more than an abstract mathematical puzzle.
Monospaced Structures
All of the structure drawing tools I'm aware of use monospacing, which is easy to understand and explain. Draw an imaginary box around each structure. Then make the gap between each structure equal to the amount of free horizontal space divided by one less than the number of structures.
The limitations of monospacing become pronounced with substituent crowding.
Alternative: Center Spacing
We can partially solve the problems of structure monospacing by enforcing equal spacing between the center of each structure.
But this approach breaks down once again on adding more substituents.
Solution: Structure Kerning
Fonts can aid text layout algorithms by providing kerning metrics. Unfortunately, the dynamic nature of chemical structures means that no such pre-configuration is possible. Nevertheless, structure kerning can be achieved by manual layout.
In the majority of cases, manual layout will simply be too time consuming to be practical. In fact, this is exactly the kind of thing that sofware should be doing, isn't it? Still, the simplicity of the result hides a potentially complex algorithm that would be needed for the general case:
- Define a valid metric for inter-structure crowding.
- Define a valid metric for overall structure crowding on a line.
- Determine the amount of inter-structure crowding at each gap.
- Minimize overall structure crowding, possibly with a recursive procedure.
- Handle cases in which no good solution exists.
Conclusions
Typography and chemical structure layout share many qualities, one of which being the desirability of kerning. Although automatic structure kerning would appear to be an eminently achievable feature, it would not be a simple task. Has a drawing tool ever implemented it?