use chemfig
Brought to you by:
baudinr
I was trying to use chemfig with texmaths. It doesn't give an error, but it doesn't draw the bonds. I tried the various display and LaTeX environment options, but didn't get it to work. I was wondering if there is a simple fix. It would allow me to put chemistry figures into lo documents and would be a fabulous addition.
\usepackage{chemfig} in preamble
\chemfig{H-O-H} in equation box
It works in my LaTeX editor.
The problem is in the workflow adopted by Texmaths. As an intermediate, it creates the right DVI file, with correct chemical formulas. But DVI is a complex file format. Texmath converts it incorrectly using either dvisvgm and dvipng. In addition to these two, Okular and Evince, also based in Xdvi, will show malformed chemical formulas in DVIs. The temporary DVI created by Texamaths converts correctly with equation dvips and dvipdf. I ended up making DVIs, converting them into PS, and converting the latter with Inkscape to SVG. I wish Texmaths would do that, but now I am using a bash script :(
I use TexMaths+chemfig, it working but with svg format.
OB.
Are there directions somewhere for using svg format? My TexMaths only offers the png option. Do I need to change things in my LaTeX setup?
I got dvisvgm installed, and selected that TexMaths use svg, but I'm still getting the same problem. So I continue to use a workaround.
As Luci said in the first message, the issue is that the dvipng program used by Texmaths to convert DVI to PNG does not work with chemfig commands (note that dvipng is required not only to convert PNG images but also to get information about them). As a consequence, you cannot get equations in PNG format using chemfig commands under Texmaths.
However, chemfig commands work well with the SVG format (which is the prefered one). I've tested this with Texmaths 0.39, dvisvgm 1.2.2 and LibreOffice 4.1.3.2 under Ubuntu 13.10.
Unfortunaltely, I also tested this under Windows 7, with Miktex 2.9, dvisvgm 1.2.2 and Texmaths 0.39, but it didn't work and I don't know why.
I hope to have time to investigate further this issue.
RB
It works under Windows 8.1 with pdfTeX 3.14159265-2.6-1.40.15 (TeX Live 2014/Cygwin), dvisvgm (TeX Live) 1.6 and TexMaths 0.41.
Got same problem using libreOffice 6.0.7.3 on my mac (OXS mojave) : texmaths 0.46 and dvisvgm 2.3.5
Cant see any bonds.
Any ideas?
This works in Ubuntu 18.04, with LaTeX engine (pdftex 3.14159265-2.6-1.40.18), dvisvgm 2.1.3 and texmaths 0.46.1. Doesn't work with the XeLaTeX engine.
Note that the dvi file produced by pdftex is malformed, but the SVG equation is OK, that's weird!
Now chemfig equations work well in recent TexMaths and LibreOffice (tested with versions 0.51.1 and 7.5.3.2 in all platforms).