EulerVM spacing in Math Mode

eulervm

A well-known trick in LaTeX if one wants to have math definition that is typeset in "math font", but actually appears as a single word, is to surround it with \mathit{}.

For example, compare these two renderings of functional typesetting:

two renderings of functional typesetting

The one on the bottom uses \mathit{}, which has the effect of squishing the characters together. This is particularly noticeable between f and u.

If we now switch to eulervm, we want to achieve the same. Sadly, it does not really work:

enter image description here

We can see that on top, the Euler font is used. On the bottom, it is not, since instead the regular italic text font is used.
Before, we did not notice this, since the CM font for math and italic text is (almost?) the same.

The first proplem is that Euler is an upright font. Thus, we should use \mathrm instead of \mathit.

But this does not improve things, since it still uses the default text font. We can, of course, try to switch the default text font to find one that more closely resembles the Euler characters. But which font should one use for this use case? Is there a way to just directly use the Euler font, but have it kern letters properly?

PS: Since a commentor requested it, here is the code used for both pictures (the difference being one line):

\documentclass{article}
\usepackage{amsmath}
\usepackage{eulervm} % comment this line out for the first picture
\begin{document}

\begin{align*}
&functional\ typesetting\\
&\mathit{functional\ typesetting}\\
&\mathrm{functional\ typesetting} % bonus: using \mathrm, not shown in the pictures
\end{align*}

\end{document}

Best Answer

When D. Knuth created his Computer Modern family, he used his Metafont for rendering the shapes. The sources for this rendering are "functions" (for each letters one function). These functions describe the shapes using Besier curves and metrics values are set too. The functions depend on many global parameters. There are 62 global parameters in Computer Modern family. A minor change of parameter values and rendering via the same functions results to the different font. For example \rm and \bf shapes are rendered with the same source functions but only different global parameters. The optical sizes are created with the same idea: only the global parameters are changed. It means that the different fonts from Computer Modern family (there are 75 fonts in it) were created by tuning the global Metafont parameters, no using only linear transformations.

There is text italic font in Computer Modern family: cmti10 and math italic font cmmi10. They are different fonts (they were rendered with different Metafont parameters) and they are intended for different purposes. The cmmi10 font is used in math mode for denoting variables and other math stuff, the cmti10 font is used for texts in italics. You show the cmmi10 in your first line (we must to read your line as f times u times n times c etc. because they are variables f, u, n, c and if they are one next to other then it means a product of variables in math formula). The cmti10 is shown in your second line (we read it as "functional typesetting"). You can see that not only spaces are different but also the shapes in your first line are slightly wider (due to the different Metafont parameters values).

The Euler font was created only for math formulas, no for text usage. So there is only math font zeurm10 and there isn't an alternative font for text usage. You can try to use it in text, but you must to copy the \fontdimen parameter used in text for spacing from another text font because these parameters are zero in math fonts:

\font\euler=zeurm10
\font\cmr=cmr10

This is normal text {\euler this is Euler without spacing parameters}.

\fontdimen2\euler=\fontdimen2\cmr % basic space
\fontdimen3\euler=\fontdimen3\cmr % stretching value
\fontdimen3\euler=\fontdimen4\cmr % shrinking value
\fontdimen7\euler=\fontdimen7\cmr % extra stretching value

And now: {\euler this is Euler with spacing parameters from cmr10}

\letterspacefont\eulersp\euler -30 % use it in pdfTeX only

\fontdimen2\eulersp=\fontdimen2\cmr % basic space
\fontdimen3\eulersp=\fontdimen3\cmr % stretching value
\fontdimen3\eulersp=\fontdimen4\cmr % shrinking value
\fontdimen7\eulersp=\fontdimen7\cmr % extra stretching value

And font: {\eulersp with smaller spaces between letters} 

\bye

The last example with \eulersp shows how you can set smaller spaces between letters, which is needed in text font. The \letterspacefont pdfTeX primitive was used here. If you are using another TeX engine then you have to use a different method for letter spacing.

Because the Euler font was intended for math typesetting, some important characters needed for text typesetting is missing here, for example comma, dot etc. So, if you want to use Euler fonts in text, you have to use a virtual font which combines the letters from various raw fonts.