# Math parts with OpenDyslexic font

Invoking lualatex, I managed to make all plain text displayed with the Open Dyslexic font (latest release 0.910.12-rc2 installed) by following the steps described here. After reading this thread, I have the following MWE:

\documentclass{article}

\usepackage{fontspec}
\usepackage{unicode-math} %% Why is this package needed?
\defaultfontfeatures{Ligatures=TeX}

\setmainfont{OpenDyslexic}
\setmathfont{OpenDyslexic} %% Unfortunately not enough

\begin{document}

Any dyslexia math fonts out there?

Given $\Delta = b^2 - 4 ac$, we have
$r_{\pm} = \frac{- b \pm \sqrt{\Delta}}{2a}.$

\end{document}


However, all mathematical parts are still displayed with the usual TeX math fonts. Indeed, I have the following warnings:

Package fontspec Warning: Font "OpenDyslexic" does not contain requested
(fontspec)                Script "Math".
Package fontspec Warning: OpenType feature 'Style=MathScript' (ssty) not
(fontspec)                available for font 'OpenDyslexic' with script
(fontspec)                'CustomDefault' and language 'Default'.
Package fontspec Warning: OpenType feature 'Style=MathScriptScript' (ssty) not
(fontspec)                available for font 'OpenDyslexic' with script
(fontspec)


Before a direct support for math or at least a Math variant is available, how can I make use of the existing letters in math mode?

• that is a text font, not a math font, it misses an important table. so you can't use it generally for math. You could use a math font as starter and replace some letters with your font. Nov 27, 2021 at 11:29
• I know I need a workaround for now. And how could I replace/display just the letters in math mode with the ones from this font? Nov 27, 2021 at 11:32
• By the way, you need unicode-math for the \setmathfont command. Nov 27, 2021 at 18:20

You want to override only the letters of your math font, with range=. OpenDyslexic doesn’t have math symbols or an OpenType math table, so you have to load a math font first, and then override only the letters and numerals with OpenDyslexic. You might try something like this. (Warning: I don’t have the font, so this is untested.)

\documentclass{article}
\tracinglostchars=3 % Report an error if a font does not have a symbol.

\usepackage{fontspec}
\usepackage{unicode-math}
\defaultfontfeatures{ Ligatures=TeX,
Scale=MatchUppercase }

\setmainfont{OpenDyslexic}[Scale=1.0]
\setmathfont{Fira Math} % Or maybe try KPMath-Sans?
\setmathfont{OpenDyslexic Italic}[range=it/{Latin,latin}]
\setmathfont{OpenDyslexic}[range=up/{Latin,latin,num}]

\begin{document}

Any dyslexia math fonts out there?

Given $\Delta = b^2 - 4 ac$, we have
$r_{\pm} = \frac{- b \pm \sqrt{\Delta}}{2a}.$

\end{document}


If OpenDylexic contains Greek letters, you could remove the /{Latin,latin,num} restrictions. If you also want to use its basic symbols, like plus and times signs, you could try changing range=up/{Latin,latin,num} to range={"01-"FF,up/{Latin,latin,num}}

If you don’t want slanted letters in math mode, load unicode-math with the option

\usepackage[math-style=upright]{unicode-math}


#### P.S.

The above sample will only load letters and digits from OpenDyslexic. To load other symbols, you would add them to the range= option. For example, this demonstrates several ways to use the OpenDyslexic version of math operators:

\setmathfont{OpenDyslexic}[range={up/{Latin,latin,num},"2B,"2D,\cdot,×}]


Any symbols without an override like that are loaded from Fira Math. There are, however, some symbols Fira Math does not have, such as, I believe, ⬜ (U+2B1C, \lgwhtsquare). You can load these from some other font instead, for example:

\setmathfont{TeX Gyre DejaVu Math}[range=\lgwhtsquare]

• Thank you! I'll check KPMath-Sans but anyway I'm not sure of what exactly I should set :( The Wikipedia page links to studies that are not conclusive on the effects of these fonts. The best I can do is trying to reuse most of the existing OpenDyslexic symbols in math mode, starting with the letters (italic) and the numbers . BTW, I have many warnings. Nov 27, 2021 at 20:44
• I settled on \setmathfont{OpenDyslexic}[range={"01-"FF,up}] for the last part. Nov 27, 2021 at 21:06
• Can I see this fonts OpenDyslexic, please? I am curious :-) Best regards. Nov 27, 2021 at 21:58
• @greendiod Sounds good. Upright Greek letters might possibly not work. Nov 27, 2021 at 23:34
• @greendiod Oh, that might be a problem. You could look up any symbols you want to replace up on a Unicode table, and select them more carefully, like range={"21,"2A-"2E,"3A-3F,"B1,"B7,"D7,"F7,up}. You can use, e.g. \cdot for "B7 and \times for "D7, or backtick-÷ for "F7, but you have to use hex notation for the minus sign. Or you can just go with up` and use regular sans-serif math operators. Dec 1, 2021 at 21:07