我正在尝试使用 LuaLaTeX 和 dvipng 从公式生成图像。一些公式包含非 ASCII 字符,如变音符号。执行 dvipng 时,我收到如下错误:
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 ]
它抱怨缺少字体,但它肯定存在于 ./share/texmf/fonts/opentype/public/lm/lmroman12-regular.otf 下。
使用以下 MWE 进行编译时发生错误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}
我在 Debian 测试中使用 texlive-full (2016)。如果能提供任何指点或解释,我将不胜感激,我现在卡在了这一步,正在网上搜索答案。
答案1
正如 Heiko 和 David 指出的那样,将 dvipng 与 LuaLaTeX 结合使用是不可能的。对于我的应用程序,我必须使用 dvipng,因为据我所知,它是唯一一款同时输出基线以在 HTML 文档中定位图像的实用程序。我最终编写了一些“转换”函数,这些函数只是将所有非 ASCII 字符替换为其相应的 LaTeX 序列。有一个相当广泛的 unicode-to-latex 表,网址为 https://raw.githubusercontent.com/w3c/xml-entities/gh-pages/unicode.xml。感谢 David Carlisle 的维护!