Chemfig
{{short description|LaTeX package for drawing chemical structures}}
{{Infobox software
| name = Chemfig
| developer = Christian Tellechea
| latest_release_version =
| programming_language = TeX
| operating_system = Cross-platform
| platform = LaTeX
| genre = Chemical structure drawing
| license = LaTeX Project Public License
| website = {{URL|https://www.ctan.org/pkg/chemfig}}
}}
Chemfig is a LaTeX package used for creating graphical representations of chemical structures, molecules, reaction schemes, and structural formulas. It provides a simple and flexible syntax to define atoms, bonds, angles, rings.{{Cite web|url=https://www.overleaf.com/learn/latex/Chemistry_formulae#Using_chemfig_to_draw_molecules_(structural_formulae)|title=Chemistry formulae|website=www.overleaf.com}} It allows for the construction of both organic and inorganic molecules using LaTeX markup.{{Cite web |title=chemfig |url=https://tug.ctan.org/macros/generic/chemfig/chemfig-en.pdf |website=tug.ctan.org}}{{Cite web|url=https://www.texdev.net/2012/08/25/exploring-chemfig-basics/|title=Exploring ChemFig: Basics|first=Joseph|last=Wright|date=August 25, 2012|website=Some TeX Developments}}
Features
- Customizable bond angles and lengths
- Support for single, double, triple, and aromatic bonds
- Cyclic compounds and ring structures
- Reaction arrows and mechanisms
- Integration with TikZ for advanced diagramming and mhchem for typesetting chemical equations
- Support for submolecules and nested chemical environments{{Cite journal|title=mol2chemfig, a tool for rendering chemical structures from molfile or SMILES format to LATE X code|first1=Eric K.|last1=Brefo-Mensah|first2=Michael|last2=Palmer|date=October 2, 2012|journal=Journal of Cheminformatics|volume=4|issue=1|pages=24|doi=10.1186/1758-2946-4-24|doi-access=free |pmid=23031664|pmc=3551648}}
Syntax
Package preamble:
\input chemfig.tex
\usepackage{chemfig}
Chemfig uses a simple syntax based on TeX commands. For example:
\chemfig{H-C(-[2]H)(-[6]H)-C(=O)-OH}
Produces a structural formula for acetic acid and a structure would render as:
File:Essigsäure - Acetic acid.svg]]
There are 9 different bond types:
\chemfig{A-B}\\
\chemfig{A=B}\\
\chemfig{A~B}\\
\chemfig{A>B}\\
\chemfig{A
\chemfig{A>:B}\\
\chemfig{A<:B}\\
\chemfig{A>{{!}}B}\\
\chemfig{A<{{!}}B}\\
File:Methane chemfig.png molecule]]
Molecular angles of a methane molecule:
\chemfig{C(-[:0]H)(-[:90]H)(-[:180]H)(-[:270]H)}
See also
{{Portal|Chemistry|Free and open-source software}}
- Comparison of TeX editors
- Computational chemistry
- Jmol - molecular modelling of chemical structures in 3 dimensions
- List of TeX extensions
- mhchem
- Molecular geometry
- Molecular graphics
- Overleaf - web app that does chemfig package chemical structures
- TikZ
- XyMTeX - another LaTeX structural formula package
References
{{reflist}}
External links
- [https://www.ctan.org/pkg/chemfig Chemfig on CTAN]
- [https://en.wikibooks.org/wiki/LaTeX/Chemical%20Graphics Wikibooks on chemfig and chemical graphics]
- [https://ctan.org/pkg/chemfig?lang=en chemfig software package]