15

I received a bug report for ebgaramond-maths. Although the issue is clearly caused by my package in one sense, it is not clear to me whether there is anything which I should do about it beyond expanding on the declaration in the documentation or setting it in \Huge. (\bfseries would, naturally, be ineffective in this context.)

The documentation already states that characters are missing from the OML encoding and notes this as a limitation of the font rather than the package. This is true.

What I did not quite appreciate is the fact that LaTeX does not generate terribly useful warnings about missing characters in this kind of case. Warnings are written to the log file but they are not exactly helpful:

Missing character: There is no ( in font EBGaramond12-Italic--oml-ebgaramond!
Missing character: There is no * in font EBGaramond12-Italic--oml-ebgaramond!

are the warnings generated for the following code:

\documentclass{article}

\usepackage{ebgaramond-maths}

\begin{document}

    $\leftharpoonup \rightharpoonup$

\end{document}

which produces a blank page. In a longer document, it would hardly be obvious which symbols are, in fact, missing. (I'm guessing there is a correspondence in terms of encoding slot places but few users are going to see that or to know how to follow it up, even my guess is right.)

The reason for the blank page is that ebgaramond-maths has to declare an EBGaramond replacement for letters and LaTeX does not fall-back to another font when it fails to find characters in a font, in the way that it does if it fails to find the font itself. (At least, I think that is what is happening.)

So ebgaramond-maths magically makes characters disappear just as a text font which lacks characters can make letters and text symbols disappear: without the package, the symbol would appear; with the package, the symbol vanishes.

I'm not sure what I can or should do about this. The most appropriate workaround will, after all, depend on the rest of the user's font configuration (e.g. if other stuff is being used for maths). Although newtxmath is recommended for integrals and braces, this is ultimately up to the user and it would surely be inappropriate to draw on symbols from other fonts as part of ebgaramond-maths itself.

What is the recommended policy/practice/response to problems of this kind?

11

In an ideal world, it's not supposed to happen. If the font is OML encoded then it should have \leftharpoonup and if it doesn't have \leftharpoonup then it should be in a different encoding.

But the world isn't always ideal, arbitrarily pulling in the characters from somewhere else is a bit, well, arbitrary, and declaring a new encoding OML2 or whatever and declaring all the math to use that is probably a more radical change than you want and is bound to be incompatible with something.

The textcomp package has similar issues as the TS1 encoding isn't widely supported in practice and has package options to declare certain subsets of TS1 encoding (and defines commands not in that subset to be an error).

Depending how many characters you are missing from OML probably I'd just define them to be errors

\def\leftharpoonup{\PackageError{ebgaramond-maths}{No \string\leftharpoonup}{use ...}}

some choices about what ... could be eg you could have package options to pull them in from some other font, or suggest some package that will redefine these without overwriting the rest of the letters slots or ...

EDIT (cfr)

Here is the code I ended up using, at least for now:

% The following symbols are missing and should give errors
\gdef\ebgaramond@maths@help{%
  EBGaramond does not provide this symbol.\MessageBreak
  If you are using the recommended setup with newtxmath\MessageBreak
  you can use \string\re@DeclareMathSymbol{}{}{}{} to take it from another font.\MessageBreak
  For example, to take symbols from Computer Modern:\MessageBreak
  \expandafter\noexpand\string\DeclareSymbolFont{cmletters}{OML}{cmm} {m}{it}\MessageBreak
  Then a specific symbol, such as \string\leftharpoonup, can be defined as follows:\MessageBreak
  \expandafter\noexpand\string\re@DeclareMathSymbol{\string\leftharpoonup}{\mathrel}{cmletters}{"28}}

% Warning based on David Carlisle's answer at http://tex.stackexchange.com/a/214524/
\newcommand*{\ebgaramond@maths@dim}{\leftharpoonup,\leftharpoondown,\rightharpoonup,\rightharpoondown,\triangleright,\triangleleft,\star,\partial,\flat,\natural,\sharp,\smile,\frown,\vec,\t}
\@for \xx:=\ebgaramond@maths@dim \do {%
  \expandafter\edef\xx{\noexpand\PackageError{ebgaramond-maths}{No \expandafter\string\xx}{\ebgaramond@maths@help}}}
  • 1
    Thank you! The only other idea I had was to declare an additional maths font and then declare the symbols which the font does provide in terms of that font rather than letters. That would mean that the existing definitions of symbols would only be overwritten if a symbol was available, but I suspect it would be horribly incompatible with other things. I'm not really sure that I even know how to set things up for a new maths encoding, and I'm not at all certain that I want to find out...? – cfr Nov 29 '14 at 2:21
  • 1
    @cfr: That would be simple and safe with a virtual font: Just get the missing symbols from cm*. – Martin Schröder Nov 30 '14 at 0:05
  • @MartinSchröder I was hoping not to get the missing symbols from anywhere. (So they would be cm* by default but something else if the user has overridden that.) Why a virtual font especially? – cfr Nov 30 '14 at 0:43
  • 1
    @cfr using a virtual font would make it appear as one font to tex so avoid taking up 2 of the 16 available math font slots. (is there not a garamond family font that has the harpoons somewhere) or as Martin said they could come from cm – David Carlisle Nov 30 '14 at 0:46
  • @DavidCarlisle Oh, yes, I see. I think that's a bad idea, though. Somebody is bound to complain about the way I set up the virtual font and I don't have any experience doing them for maths, so they'll probably be right to complain! I was thinking people would just have to give up one of the 16 if they wanted to use the package. I don't know if there is such a family although that might be a reasonable solution. But it has to be in TeX Live. (So the extended version you can get using the getnonfreefonts script is no good.) – cfr Nov 30 '14 at 0:50

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.