# Antykwa Torunska font: How to get correct \hbar in LuaLaTeX

I'm using TeX Live 2014 with lualatex. Using the font Antykwa Torunska (anttor) for math, \hbar is not displayed correctly. The default LaTeX settings do not give good results at all scales:

\documentclass{scrartcl}

\usepackage[math]{anttor}
\usepackage[no-math]{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Antykwa Torunska}
\usepackage{polyglossia}
\setdefaultlanguage{german}

\usepackage{amsmath}

\begin{document}

$h \hbar \frac{1}{\hbar}$

\end{document}


Using the amssymb package, it is possible to get a working \hbar symbol, albeit (of course) in an incorrect font:

\documentclass{scrartcl}

\usepackage[math]{anttor}
\usepackage[no-math]{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Antykwa Torunska}
\usepackage{polyglossia}
\setdefaultlanguage{german}

\usepackage{amsmath}
\usepackage{amssymb}

\begin{document}

$h \hbar \frac{1}{\hbar}$

\end{document}


Antykwa Torunska does include a dedicated \hbar glyph (the documentation shows it), but it is not easily accessible. t2a-anttr and wncy-anttr seem to include it, but I can't get to math fonts from there. How is it possible to use math symbols such as \hbar when the font provides them, but there is no (simple?) LaTeX interface to access them?

EDIT: Changed minimal to scrartcl and added TeX distribution info.

• I get correct output (TeX Live 2014), apart from a spurious warning. As an aside: never use the minimal class; amsmath should go before fontspec. Jan 12 '15 at 7:48
• @egreg I'm using TeX Live 2014 as well. How exactly are you getting the correct result? With or without amssymb? In which order are you loading the packages? I didn't know that the minimal class shouldn't be used; using scrartcl, I get a visually identical output, however. Putting amsmath before fontspec does not change the result, either. Jan 12 '15 at 14:29
• I'm on a different machine, now; so I pasted your first code and compiled with XeLaTeX; this picture shows the output I get. The output is indeed incorrect with LuaLaTeX, though. Sorry if I couldn't get you're using LuaLaTeX. Jan 12 '15 at 14:39

This is clearly a bug in LuaTeX.

If, with your setup, I do

\sbox0{$\mkern9mu$}\showthe\wd0
\scriptspace=0pt
\sbox0{$_{\mkern9mu}$}\showthe\wd0


I get 5.4749pt for the first width and 5.9749pt for the second one.

It's similar if I use newtxmath or fourier for the math fonts or even if no font package (including fontspec) is loaded, when LuaLaTeX should behave like pdflatex.

To the contrary, if I do the same with XeLaTeX, I get 5.4749pt for the first width and 3.99998pt for the second, which accounts for the correct output that's obtained with XeLaTeX. If I omit \scriptspace=0pt, the second width is 4.49998pt.

This means two things:

1. LuaTeX doesn't set correctly the mu units in subscripts
2. LuaTeX ignores the setting to \scriptspace.

There's something about \scriptspace in the LuaTeX manual when \Umathspaceafterscript is described, so the status of point 2 is unclear (but it's still a bug, in my opinion).

By the way, there's also a bug in fontspec, because \hbar is treated as if it were a text symbol, while it isn't.

The hbar you see in the font tables for the T2A encoded version is really a Serbian Cyrillic character (in the Latin transliteration of Serbian it corresponds to ć).

You can access it as \hbar with this kludge:

\documentclass{scrartcl}

\usepackage{amsmath}
\usepackage[T2A]{fontenc}
\usepackage[math]{anttor}
\usepackage[no-math]{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Antykwa Torunska}
\usepackage{polyglossia}
\setdefaultlanguage{german}

\AtBeginDocument{%
\let\hbar\relax
\DeclareRobustCommand{\hbar}{\text{\normalfont\fontencoding{T2A}\fontfamily{antt}\itshape\symbol{163}}}%
}

\begin{document}
$h \hbar \frac{1}{\hbar}$
\end{document}


In a message in the LuaTeX mailing list, Luigi Scarso, a LuaTeX team member, points out thet the problem with mu units has been fixed, so it should be solved with the next release of TeX Live (2015).
• Well, that's surprising. I wouldn't have expected a bug in such basic functionality – incorrect results for mu in subscripts sounds like it would be hard to miss. I suppose I should file a bug report... Thank you for the workaround, as well. It produces the same output you've shown, but there is an error message: "Font \T2A/cmr/m/n/10.95=larm1095 at 10.95pt not loadable: metric data not found or bad. \fontencoding\encodingdefault\selectfont". Is there a way to get around that? Jan 12 '15 at 16:26
• @Socob First compile with pdflatex a file with \documentclass[11pt]{article}\usepackage[T2A]{fontenc} in the preamble and just a in the document body. Follow the discussion about the bug at tug.org/pipermail/luatex/2015-January/thread.html Jan 12 '15 at 16:29