# Same mathematical fonts with LuaTeX and ConTeXt

I use LuaLaTeX to compile my documents with this in the preamble :

\documentclass[12pt,a4paper]{article}
\usepackage{etex}
\usepackage[no-math]{fontspec}
\usepackage[urw-garamond,uppercase=upright,greeklowercase=upright]{mathdesign}
\usepackage{garamondx}
\usepackage[frenchb]{babel}
\begin{document}
$f(x)=x^2+2x+4$
\end{document}


I try to do the same with ConTeXt, but the result is not quite the same, in particular the letter x :

 \setuppapersize[A4]
\setupbodyfont[garamond]
\starttext
Some random text and \math{f(x)=x^2+2x+4}
\stoptext


The compilation gives me this :

   system          > 'cont-new.mkiv' loaded
(/home/fab/texlive/2013/texmf-dist/tex/context/base/cont-new.mkiv)
system          > files > jobname 'demo1', input './demo1', result 'demo1'
fonts           > latin modern fonts are not preloaded
languages       > language 'en' is active
(/home/fab/demo1.tex (/home/fab/texlive/2013/texmf-dist/tex/context /base/type-imp-mathdesign.mkiv)
fonts           > typescripts > unknown library 'loc'
fonts           > typescripts > unknown library 'garamond'
{/home/fab/texlive/2013/texmf-dist/fonts/map/dvips/lm/lm-math.map}{/home  /fab/texlive/2013/texmf-dist/fonts/map/dvips/lm/lm-rm.map}{/home/fab/texlive /2013/texmf-dist/fonts/map/pdftex/context/mkiv-base.map}
fonts           > 'fallback modern rm 12pt' is loaded

• You are only setting the text font, not the math font. – Aditya Dec 30 '13 at 15:51
• What do you expect? You are using two entirely different fonts: URW Garamond in what appears to be Type1 format, and EB Garamond as OpenType. I couldn’t test your Latex code since texlive lacks the garamondx package. But these fonts are unlikely to be metrically compatible, let alone visually identical. Also, EB Garamond is not a math font. Lastly, I suggest getting rid of the \enableregime directive since it is anachronistic in 2013. – Philipp Gesang Dec 30 '13 at 20:30
• I modified my code using \loadtypescriptfile[mathdesign]\loadtypescriptfile[garamond]\setupbodyfont[Mathdesign Garamond] but typescripts > unknown library 'garamond'typescripts > unknown library 'Mathdesign Garamond' – Fabrice Dec 31 '13 at 12:56
• You need an up to date ConTeXt. The ConTeXt that ships with texlive does not have the required typescripts. With ConTeXt minimals, try: \loadtypescriptfile[mathdesign] \setupbodyfont[garamond]. – Aditya Dec 31 '13 at 18:20
• My guess is that you are using an old version of ConTeXt that does not include a typescript for garamond. You need to copy the appropriate lines from the current type-imp-mathdesign.mkiv file. This file relies on a corresponding font goodies file, but that needs a newer version of Context. – Aditya Jan 1 '14 at 0:16

My setup: I use the latest ConTeXt minimals beta, and a full installation of texlive package on ArchLinux. I add /usr/share/texmf-dist/fonts to the ConTeXt minimals TEXMF tree that allows me to use Texlive fonts with ConTeXt minimals.

For some reason (which I think has to do with the fact that mdugm fonts are in the non-free directory on CTAN), mathdesign garamond is not available on Arch Linux. So, the following example shows how to use Mathdesign charter:

\loadtypescriptfile[mathdesign]
\setupbodyfont[charter]

\starttext

Some random text and \math{f(x)=x^2+2x+4}

\stoptext


which gives:

In principle, the same method should work if you replace charter with garamond, but I haven't been able to test that since I do not have the fonts.