0

I'm using fourier-otf and XeLaTeX and noticed something weird. This is my MWE.

\documentclass{article}

\usepackage{fourier-otf}

\let\eps\varepsilon \def\epsd{\varepsilon}

\begin{document} $ \varepsilon $ %

$ \eps $        % \let

$ \epsd $       % \def'ined

\end{document}

And the result is the following.

When I use \let to define the new command, the document font is ignored and the epsilon is typeset in default Computer Modern. With \def it works fine.

I've always used \let when I wanted to define an alias, because I think that \let\eps\varepsilon "copies" the definition of \varepsilon into \eps. And it seems to be true, as both \show the same definition: \mathchar"122.

What I can't understand is why these two...

\eps=\mathchar"122
\varepsilon=\mathchar"122

... behaves differently, while \epsd=\varepsilon works.


I tested it with some other -otf fonts (libertinus-otf and dejavu-otf) and it shows the same behaviour. However, fourier (probably a ttf version) works.

Ulrich Diez
  • 28,770

1 Answers1

4

Why would \let and \def give different results? It's because the meaning of \varepsilon changes between the time that you did \let\eps\varepsilon and when you actually used \eps.

You can see the change of meaning by adding \typeout{\meaning\varepsilon} before and after \begin{document} where you will see the initial meaning:

\mathchar"122

and the meaning once you're in the document:

macro:->\mitvarepsilon 

So when you did the \let you told LaTeX you wanted \eps to have the meaning at the time of the \let which was \mathchar"122. When you did the \def you told it to use the meaning of \varepsilon at the time that you used the new command.

As for how/why this happens, it's because the unicode-math package, which is used by fournier-otf, pushes the definition of various symbols to occur during \begin{document} to avoid being stomped on by other packages which might be loaded by the user. fournier, which doesn't use unicode-math, doesn't have this protection.

All that said, the preferred way to create your command would be with

\NewDocumentCommand{\eps}{\varepsilon}

rather than \let. The primary use of \let is to grab the meaning of a command at that moment and regardless of what is happening with package loading and the timing of command declarations, that is not what you actually want.

Don Hosek
  • 14,078