1

I am trying to generate an image from a formula using LuaLaTeX and dvipng. Some of the formulas contain non-ascii characters like umlauts. When executing dvipng, I get errors like this:

This is dvipng 1.14 Copyright 2002-2010 Jan-Ake Larsson
kpathsea:make_tex: Invalid fontname `file:lmroman12-regular:script=latn;+trep;+tlig;', contains ':'
[1dvipng warning: font file:lmroman12-regular:script=latn;+trep;+tlig; at 400 dpi not found, characters will be left blank dvipng warning: unable to draw glyph 72, skipping dvipng warning: unable to draw glyph 65, skipping dvipng warning: unable to draw glyph 65, skipping dvipng warning: unable to draw glyph 65, skipping dvipng warning: unable to draw glyph 65, skipping dvipng warning: unable to draw glyph 76, skipping dvipng warning: unable to draw glyph 76, skipping dvipng warning: unable to draw glyph 76, skipping dvipng warning: unable to draw glyph 79, skipping dvipng warning: unable to draw glyph 79, skipping dvipng warning: unable to draw glyph 79, skipping dvipng warning: unable to draw glyph 79, skipping dvipng warning: unable to draw glyph 33, skipping kpathsea:make_tex: Invalid fontname `file:lmroman12-regular:script=latn;+trep;+tlig;', contains ':'
dvipng warning: font file:lmroman12-regular:script=latn;+trep;+tlig; at 400 dpi not found, characters will be left blank dvipng warning: unable to draw glyph 72, skipping dvipng warning: unable to draw glyph 65, skipping dvipng warning: unable to draw glyph 65, skipping dvipng warning: unable to draw glyph 65, skipping dvipng warning: unable to draw glyph 65, skipping dvipng warning: unable to draw glyph 76, skipping dvipng warning: unable to draw glyph 76, skipping dvipng warning: unable to draw glyph 76, skipping dvipng warning: unable to draw glyph 79, skipping dvipng warning: unable to draw glyph 79, skipping dvipng warning: unable to draw glyph 79, skipping dvipng warning: unable to draw glyph 79, skipping dvipng warning: unable to draw glyph 33, skipping ]

It complains about a missing font, but it definitely exists under ./share/texmf/fonts/opentype/public/lm/lmroman12-regular.otf.

The error occurs with the following MWE, compiled using lualatex --output-format=dvi test.tex:

\documentclass{article}
\usepackage{amsmath}
\usepackage{fontspec} % if commented out, it works
\usepackage[active,textmath,displaymath]{preview}
\begin{document}
$\text{ä} < \text{ö}; ø\neq æ$
\end{document}

I'm using texlive-full (2016) on Debian testing. I would appreciate any pointers or explanations, I am stuck at this point, while researching the web for answers.

  • It looks that dvipng does not support the extended font features of LuaTeX. – Heiko Oberdiek Sep 21 '16 at 16:23
  • 2
    why go via dvi? there are plenty of convertors from pdf to png, imagemagic convert for example – David Carlisle Sep 21 '16 at 16:28
  • Where is ./ ? – cfr Sep 21 '16 at 22:19
  • Well, dvipng reports the baseline of an image --depth), useful for embedding it within a HTML document. If you're able to show me how to do the same with imagemagick, I'd be more than happy to drop dvipng. ./ was a copy-paste error, it is actually /usr/*. – Humenda Sep 22 '16 at 5:34
1

As Heiko and David pointed out, using dvipng with LuaLaTeX is impossible. For my application, I have to use dvipng, because as far as I know, it is the only utility, which also outputs the baseline to position the image within a HTML document. I ended up writing a few "conversion" functions, which just replace all non-ascii characters with their corresponding LaTeX sequence. There's a pretty extensive unicode-to-latex table at https://raw.githubusercontent.com/w3c/xml-entities/gh-pages/unicode.xml. Thanks to David Carlisle for maintaining it!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.