6

There are a lot of questions about the fonts used by default in latex. However I didn't manage to find exactly the font I'm looking for. Specifically, I'm looking for the font used by latex when producing something like this:

enter image description here

that is, the characters used in math mode.

In particular, I'm looking not much for the numbers as for the that kind of n. Using italic Latin Modern Math, which, if I understood correctly, is the default math font, I obtain the following:

enter image description here

which is clearly different from what latex reproduces (that is, the first image above).

What is the font that latex is using to produce characters like the n above? And where can I find it?

  • 4
    what YOU get (2nd picture) is not the default. the first may be. please give a minimal example of your code. – touhami Dec 24 '15 at 17:14
  • 1
    I'm not getting these from latex. My question is where to find the fonts used by latex, so that I can reproduce them on other programs. I know that the first is what latex reproduces by default, and that is what I'm trying to replicate on external programs, by finding the right font. – glS Dec 24 '15 at 17:15
  • The second picture shows Latin Modern slanted, not italic. – Bernard Dec 24 '15 at 19:06
11

If you run the test file

\documentclass{article}
\usepackage{lmodern}
\begin{document}
\showoutput
$n=2$
\end{document}

and look in the log file, you'll find

....\mathon
....\OML/lmm/m/it/10 n
....\glue(\thickmuskip) 2.77771 plus 2.77771
....\OT1/lmr/m/n/10 =
....\penalty 500
....\glue(\thickmuskip) 2.77771 plus 2.77771
....\OT1/lmr/m/n/10 2
....\mathoff

You see that actually two different fonts are used: \OML/lmm/m/it/10 and \OT1/lmr/m/n/10. Now the problem is: what physical font is being used?

There are at least two ways for discovering it: one is to do, from the command line,

cat $(kpsewhich omllmm.fd)

that displays

% This file belongs to the Latin Modern package. The work is released
% under the GUST Font License. See the MANIFEST-Latin-Modern.txt and
% README-Latin-Modern.txt files for the details. For the most recent version of
% this license see http://www.gust.org.pl/fonts/licenses/GUST-FONT-LICENSE.txt
% or http://tug.org/fonts/licenses/GUST-FONT-LICENSE.txt

\ProvidesFile{omllmm.fd}[2009/10/30 v1.6 Font defs for Latin Modern]

\DeclareFontFamily{OML}{lmm}{\skewchar\font127 }
\DeclareFontShape{OML}{lmm}{m}{it}%
     {<-5.5>    lmmi5     <5.5-6.5> lmmi6
      <6.5-7.5> lmmi7     <7.5-8.5> lmmi8
      <8.5-9.5> lmmi9     <9.5-11>  lmmi10
      <11->   lmmi12
      }{}
\DeclareFontShape{OML}{lmm}{b}{it}{%
       <-6> lmmib5     
      <6-8> lmmib7     
      <8->  lmmib10
      }{}
\DeclareFontShape{OML}{lmm}{bx}{it}%
     {<->ssub*lmm/b/it}{}
\endinput

Looking for {OML}{m}{it} and the specification for 10pt, we find lmmi10. For the other font, we do

cat $(kpsewhich ot1lmr.fd)

and we see (showing just the relevant part)

\DeclareFontShape{OT1}{lmr}{m}{n}%
     {<-5.5>    rm-lmr5     <5.5-6.5> rm-lmr6
      <6.5-7.5> rm-lmr7     <7.5-8.5> rm-lmr8
      <8.5-9.5> rm-lmr9     <9.5-11>  rm-lmr10
      <11-15>   rm-lmr12
      <15-> rm-lmr17
      }{}

so the font is rm-lmr10.

Second way: modify the test file to be

\documentclass{article}
\usepackage{lmodern}
\begin{document}
\showoutput
$n=2$

\texttt{\fontname\csname OML/lmm/m/it/10\endcsname}

\texttt{\fontname\csname OT1/lmr/m/n/10\endcsname}
\end{document}

and the output will be

enter image description here

However, you may want to use the OpenType fonts. Then modify the test file again to be

\documentclass{article}
\usepackage{unicode-math}
\begin{document}
\showoutput
$n=2$
\end{document}

The log file, after running LuaLaTeX on the file, will show

....\EU2/latinmodern-math.otf(0)/m/n/10 𝑛
....\glue(\thickmuskip) 2.77771 plus 2.77771
....\EU2/latinmodern-math.otf(0)/m/n/10 =
....\penalty 500
....\glue(\thickmuskip) 2.77771 plus 2.77771
....\EU2/latinmodern-math.otf(0)/m/n/10 2
....\mathoff

So modify it again essentially as before:

\documentclass{article}
\usepackage{unicode-math}
\begin{document}
\showoutput
$n=2$

\texttt{\fontname\csname EU2/latinmodern-math.otf(0)/m/n/10\endcsname}

\end{document}

and the output will be

enter image description here

Now you know what font you should load in the external program.

Indeed, if I copy from the log file the 𝑛 glyph and paste in a word processing application I get

enter image description here

  • @glS I think you're better using the OpenType version. – egreg Dec 24 '15 at 18:29
  • thank you very much, I was really hoping for an answer of this kind! However, while I managed to install the lmmi10 font through a .pfm that shipped with MiKTeX, I'm not sure I understand your conclusion. Copy-pasting the gliph works, but the font you name, latinmodern-math, does not produce that font – glS Dec 24 '15 at 18:30
  • but how do I use the OpenType version? Apart from copy-pasting, using the font named latinmodern-math does not produce those gliphs – glS Dec 24 '15 at 18:35
  • @glS You have to install the font with the system fonts. How to do it depends on your operating system. – egreg Dec 24 '15 at 19:08
  • I do know how to install a font. In fact, I have installed the latin modern math font, but this produces the glyphs I showed in the original post in the second image, not the ones produced by latex in math mode – glS Dec 24 '15 at 19:13
0

It seems that the default font used by latex in math mode is not latin modern, which is what I erroneously understood from, for example, this answer, but Computer Modern Serif, in Italic form (EDIT: this is not exactly true, see comments below).

This font can be downloaded on sourceforge, and produces the following output:

enter image description here

as well as all the other correct letters. The number can be instead reproduced with plain Latin Modern Math (downloadable for example here):

enter image description here

For the equal sign there is yet some other font, to me unknown, being used.

  • 2
    this isn't the default either. this is the text italic font. the "original" font for math letter variables is cmmi, or "math italic". but beware, "math italic" is different from \mathit which is really text italic letters used in a math environment to produce words. numerals in math are the same as in roman text (as is all upright punctuation). the equal sign just happens to be in the main latin text font; tex was created when space was at a real premium, so the original tex fonts bear little resemblance to current ones. – barbara beeton Dec 24 '15 at 17:34

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.