13

I am using the package EBGaramond-Maths.

This font is missing the symbols for these commands (from documentation):

\leftharpoonup \triangleright \flat \smile
\leftharpoondown \triangleleft \natural \frown
\rightharpoonup \star \sharp \vec
\rightharpoondown \partial \t

The default way of loading this package (as per the documentation) is

 \usepackage[cmintegrals,cmbraces]{newtxmath}
 \usepackage{ebgaramond-maths}

When the above-mentioned missing symbols are used, the package prints nothing out at the command, which is to be expected. However, if we use only newtxmath without the ebgaramond-maths package, the symbols are correctly produced. Thus, we can surmise that newtxmath has those symbols, but ebgaramond-maths does not.

However, this would suggest that when ebgaramond-maths is loaded, the compiler essentially "blanks out" the positions in the character map that the ebgaramond-maths lacks, rather than falling back on a previously loaded symbol. For example, although the \partial symbol is loaded by the newtxmath package and displays correctly when it is used without ebgaramond-maths, after loading ebgaramond-maths thereafter, the command does nothing.

1) Why does this happen?

2) If ebgaramond-maths just cancels whatever newtxmath does, then what is the point of loading newtxmath before?

  • See edited answer for an example of how to redefine missing symbols using one of the options newtxmaths offers for the letters font. (I can't ping you from my answer as you deleted your comment there.) – cfr Dec 4 '14 at 23:13
14

Welcome to TeX SE!

The key issue is that ebgaramond-maths issues the following

\DeclareSymbolFont{letters}   {OML}   {EBGaramond-Maths} {m} {it}

This overwrites the existing letters font. This enables all of the characters which the font does provide and which are used in the OML encoding. However, it does this by telling LaTeX that whenever a maths symbol uses the letters font, it should use OML/EBGaramond-Maths/m/it. So LaTeX does this whether the symbol exists in the font or not. It cannot tell, essentially, one way or another.

To make this a bit clearer, it is helpful to look at the definition of \partial from fontmath.ltx:

\DeclareMathSymbol{\partial}{\mathord}{letters}{"40}

This tells LaTeX that \partial corresponds to the character in the relevant slot in the letters font. So before ebgaramond-maths is loaded, this symbol will be taken from whichever font is currently configured to provide letters (Computer Modern by default or whatever newtxmath is configured to use). After ebgaramond-maths is loaded, the symbol will be taken from whichever font is currently configured to provide letters. But now that font is EBGaramond-Maths which, as we know does not provide the symbol. What it provides is an empty slot - a blank.

The point of loading newtxmath is for the symbols it provides in other encodings (i.e. not OML) because these complement EBGaramond better than the defaults. Hence, ebgaramond-maths does not 'cancel out' what newtxmath does. Rather, it overrides one part of what newtxmath does.

In fact, ebgaramond-maths knocks out symbols from the default fonts, too. (You can still reproduce the problem if you comment out the line loading newtxmath.)

So the sequence is as follows:

  1. Default maths fonts are set up by LaTeX. (In particular, letters is defined.)
  2. newtxmath is loaded and overwrites large parts of the default configuration for maths fonts. (In particular, letters is redefined.)
  3. ebgaramond-maths is loaded and overwrites a part of the previous configuration for maths fonts. (In particular, letters is redefined.)

There are alternative approaches but I think that this is the most practical and least incompatible one. Please see the question I asked about this and David Carlisle's response for the background to my decision.

[I am the package author.]

Redefining missing symbols

Note that you must do this in the PREAMBLE but AFTER loading ebgaramond-maths!

If you try to use one of the missing symbols, the package now issues an error. If you ask for help, it tells you how to define the missing symbols using the \re@DeclareMathSymbol command from newtxmath.

Here is an example of how to do this using one of the options for letters from newtxmath. Here, a new maths font, ntxletters is set up and missing symbols are defined using it. \makeatletter...\makeatother is required as the redeclaration command includes the @ symbol.

\makeatletter
  \DeclareSymbolFont{ntxletters}{OML}{ntxmi}{m}{it}
  \SetSymbolFont{ntxletters}{bold}{OML}{ntxmi}{b}{it}
  \re@DeclareMathSymbol{\leftharpoonup}{\mathrel}{ntxletters}{"28}
  \re@DeclareMathSymbol{\leftharpoondown}{\mathrel}{ntxletters}{"29}
  \re@DeclareMathSymbol{\rightharpoonup}{\mathrel}{ntxletters}{"2A}
  \re@DeclareMathSymbol{\rightharpoondown}{\mathrel}{ntxletters}{"2B}
  \re@DeclareMathSymbol{\triangleleft}{\mathbin}{ntxletters}{"2F}
  \re@DeclareMathSymbol{\triangleright}{\mathbin}{ntxletters}{"2E}
  \re@DeclareMathSymbol{\partial}{\mathord}{ntxletters}{"40}
  \re@DeclareMathSymbol{\flat}{\mathord}{ntxletters}{"5B}
  \re@DeclareMathSymbol{\natural}{\mathord}{ntxletters}{"5C}
  \re@DeclareMathSymbol{\star}{\mathbin}{ntxletters}{"3F}
  \re@DeclareMathSymbol{\smile}{\mathrel}{ntxletters}{"5E}
  \re@DeclareMathSymbol{\frown}{\mathrel}{ntxletters}{"5F}
  \re@DeclareMathSymbol{\sharp}{\mathord}{ntxletters}{"5D}
  \re@DeclareMathAccent{\vec}{\mathord}{ntxletters}{"7E}
\makeatother
  • @Anthony You need the other instruction from the error message first i.e. \DeclareSymbolFont{cmletters}{OML}{cmm} {m}{it}. That defines the font which you then use to set the symbol. Yes, you can take the numbers from newtxmaths. But note that you need the \re@DeclareMathSymbol... and that there is a " in the final argument as well. – cfr Dec 4 '14 at 22:54
  • Thanks again, cfr. I seemed to get it to work with the following: \DeclareSymbolFont{txletters}{OML}{ntxmi}{m}{it} \DeclareMathSymbol{\leftharpoonup}{\mathrel}{txletters}{40} \DeclareMathSymbol{\leftharpoondown}{\mathrel}{txletters}{41}, etc.. Why is the \re@ component necessary? (Sorry about the deleted comments that might have been sent to your inbox.) – Bob Dec 6 '14 at 0:08
  • I am using the "slot" numbering given by the newtxmath package. – Bob Dec 6 '14 at 0:08
  • 1
    @Anthony If you use \DeclareMathSymbol, LaTeX will complain that the symbol is already defined. In interactive mode, this stops compilation. If you are using non-stop mode, look at the console output or log file. You can use 40 and 41. Just don't use the " in that case. (These are just using different number bases to refer to the slots.) – cfr Dec 6 '14 at 0:33

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.