ChemText
About
TChemText is a TCustomLabel descendant which can display chemical formulas and reaction equations with automatically placed subscripts and superscripts.
Authors
The code is based on "chemtxt" written by Patrick Spanel (Patrik.Spanel@jh-inst.cas.cz). It was adapted to Lazarus and extended by Werner Pamler.
License
Modified LGPL (with linking exception, like Lazarus LCL)
Download and Installation
Release version
A zip file with the most recent release version can be found at Lazarus CCR at SourceForge. Unzip the file into any folder.
The current release version is 0.1
Development version
Use an svn client to download the current trunk version from svn://svn.code.sf.net/p/lazarus-ccr/svn/components/chemtext/
Installation
In Lazarus, go to "Package" > "Open Package File .lpk". Navigate to the folder with the callite sources, and select laz_chemtext.lkp. Click "Compile", then "Use" > "Install". This will rebuild the IDE (it may take some time). When the process is finished the IDE will restart, and you'll find TChemLabel in the component palette Misc.
Usage
Simply drop a TChemLabel component on the form and type the chemical formula/reaction into the property Caption.
The formulas are written in a straightforward way. The "2" in H2O is automatically subscripted, and the + in H+ is automatically displayed as superscript. Note that multiple-charge ions must repeat the charge sign, i.e. the double-negatively charged oxygon ion must be written as O--, not as O2-. For chemical reactions, arrows can be entered as -->, <-- or <-->. The property Arrow of the TChemLabel determines whether this simple is to be replaced by a nice UTF8 character:
- caAsciiSingle: --> <-- <-->
- caAsciiDouble: ==> <== <==>
- caUTF8: → ← ⇌
- caUTF8Single: → ← ↔
- caUTF8Double: ⇒ ⇐ ⇔
- caUTF8Half: ⇀ ↽ ⇌
Note that the UTF8 characters may not be available in any font.