Using unicode-math with LuaTeX. The font Fira Math is missing some glyphs that I use, notably the symbol for \bot. I know that I can grab it from a different font:

\setmathfont[range={"022A5}]{DejaVu Math TeX Gyre}

but that bloats my PDF with yet another font. Alternatively, I can redefine the command \bot:


but that's exactly the wrong level — a glyph substitution shouldn't require modifying TeX's input syntax. The obvious solution would be to perform the subsitution at the luaotfload level,

    fonts.handlers.otf.addfeature {
      name = "bottoperp",
      type = "substitute",
      data = {
        [0x22A5] = {0x27C2},
  \setmathfont{Fira Math}[RawFeature=+bottoperp]

but that appears to do nothing.

What is the right way to substitute a glyph with LuaTeX and unicode-math?

  • I don't understand what you want. If \perp is the symbol you want, then why don't you use it? – Ulrike Fischer Oct 24 '20 at 22:54
  • \bot is the symbol I want, and it's not in the font. – jch Oct 24 '20 at 22:55
  • \perp works fine for me, – Ulrike Fischer Oct 24 '20 at 22:56
  • I has the wrong spacing, compare $x = \bot$ with $x = \perp$. Redefining \bot to {\perp} works fine, due to the extra set of brackets, not sure if it will cause any other trouble. – jch Oct 24 '20 at 23:02
  • Well U+22A4 (\bot, UP TACK) is defined as a \mathord in unicode-math, U+27C2 (\perp, PERPENDICULAR) is a \mathrel, so yes their spacing is different, but they have also a different unicode code point and meaning, so if you want U+22A5, then you should get it either from another font, or map it with addfeature, so that the to unicode value is right. – Ulrike Fischer Oct 24 '20 at 23:10

Just make active and define it to be \bot, but redefining this one to be {\perp}.


\setmainfont{Fira Sans}
\setmathfont{Fira Math}

% there is no \bot in Fira Sans


$a\bot b$ or $a ⊥ b$

$a\perp b$ or $a ⟂ b$


enter image description here

The picture shows that (U+22A5) is treated as an ordinary symbol and (U+27C2) as a relation symbol.

  • That works around the actual issue, but just like redefining the \bot macro, it's the wrong level — I should be able to substitute a glyph without munging the input syntax. – jch Oct 25 '20 at 17:25
  • @jch I'm not sure I understand. Anyway, I added to my example and your doubts should go away. – egreg Oct 25 '20 at 20:42
  • Greg, anything can be fixed with TeX macros, that's how we got into the mess we're in. LuaTeX holds the promise of fixing things at the font level when they are font issues, rather than building dozens of font-specific hacks at the TeX macro level, which interact in marvellous ways with the other font-specific hacks. – jch Oct 25 '20 at 21:02

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.