dvipng
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dvipng] dvipng and chemfig


From: someon
Subject: [Dvipng] dvipng and chemfig
Date: Tue, 17 Mar 2015 21:25:00 +0200
User-agent: Roundcube Webmail/1.0.5

dvipng does not produce correct output. The default LaTeX
template in Anki looks like this (I have added the chemfig bits):

```latex
\documentclass[12pt]{article}
\special{papersize=3in,5in}
\usepackage[utf8]{inputenc}
\usepackage{amssymb,amsmath}
\pagestyle{empty}
\setlength{\parindent}{0in}
\usepackage{chemfig}
\begin{document}
\chemfig{A-B}
\end{document}
```

and to use that Anki runs

latex tmp.tex
dvipng -D 200 -T tight tmp.dvi -o tmp.png

which produces broken output:

http://imgur.com/EHkPSwM

which is similar to what you get if you just open the .dvi in
evince. This is unfortunate considering many (well, at least
Anki) treat dvipng as a complete solution.

For the record, here's a workaround: If you don't want to let go
of latex, then convert to postscript and then to pdf

latex tmp.tex
dvips tmp.dvi
ps2pdf tmp.ps

or just embrace modernity and simplicity and run pdflatex

pdflatex tmp.tex

then convert crop the pdf and convert to png

pdfcrop tmp.pdf tmp-cropped.pdf
pdftoppm -png -r 200 tmp-cropped.pdf tmp

and the final file is tmp-1.png:

http://imgur.com/yxYGdpZ

Is there any chance dvipng will be patched or is this a feature?
Also, do you have better workaround? dvipng's -T tight option is
very handy.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]