# Problems using 'fontspec' and 'unicode-math' packages: "cannot-use-pdftex"

 tastephens Dec 2, 2015 at 3:46 PM Edited Dec 2, 2015 at 3:47 PM I'm trying to use the 'fontspec' and 'unicode-math' packages with: Package : fontspec Package : unicode-math Unfortunately, Madoko produces the following error: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! ! Fatal fontspec error: "cannot-use-pdftex" ! ! The fontspec package requires either XeTeX or LuaTeX to function. ! ! You must change your typesetting engine to, e.g., "xelatex" or "lualatex" ! instead of plain "latex" or "pdflatex". ! ! See the fontspec documentation for further information. ! ! For immediate help type H . !............................................... The error is in the *-math-dvi.log file, so it's being hit when generating the mathematics (static) for the HTML document. If I run 'xetex *-math-dvi.tex' manually, it generates a PDF. I can also generate the PDF document from the main *.tex file Madoko creates, if I run xelatex manually. The problem seems to be that Madoko is running pdflatex instead of xelatex (I get the same error if I run pdflatex manually), but I'm not sure how to fix that. Any suggestions? Thanks! daan Coordinator Dec 2, 2015 at 7:15 PM Edited Dec 2, 2015 at 7:15 PM Hi ! Thanks for enjoying Madoko and providing feedback :-) You are right -- usually for math Madoko is using plain LaTeX because it is much faster to extract images from a dvi. When you use the unicode-math package you really need xelatex or pdflatex though; you can tell Madoko you want to use pdf output instead which will cause it to use xelatex or pdflatex (determined by the math pdf latex key. Put this in the metadata: .math-inline, .math-display { math-needpdf: true; } and it will work. However, the extraction of images from the pdf files is slower. So in general I would recommend against using the unicode-math package. In particular, with Madoko's replacement rules you can get a long way without using Unicode. For example, for my kind of papers (with type rules), I usually need a lot \alpha, \beta and tau characters. For this I define a replacement rule like: .math-inline, .math-display { replace: "//\ba\b/\alpha//\bb\b/\beta//\bt\b/\tau//g"; } Now, I can write $t, t_1, a$ to get the same as $\tau, \tau_1, \alpha$. For the replacement, I use \b for a word boundary, and // for a replacement "mapping" . Hope this helps, let me know how it goes, Best, -- Daan daan Coordinator Dec 29, 2015 at 11:22 PM As a follow up -- the latest release (1.0.0.rc) has SVG support and now uses xelatex by default for all mathematics which means that Unicode-math should work out of the box and that you can use commands like setmathfont{Cambria Math} in a Tex Header:. Let me know how it works for you :-)