7

I am trying to create a minimal lualatex distribution, and hence try to eliminate as much non OTF fonts as possible (I try to get rid of the .afm, .pfb, .map, etc files to save space).

Everything is (almost) working for text, but I am hitting a bummer with maths and the Kurier font (and probably others I haven't tested yet).

The following MWE works perfectly with kurier.sty and the Type 1 fonts:

% !TEX program = lualatex
\documentclass{minimal}
\usepackage[light,math]{kurier}
\begin{document}
\[ e=\lim_{n \to \infty} \left(1+\frac{1}{n}\right)^n \]
\end{document}

MWE with <code>kurier</code> and T1 fonts

but the following with OTF fonts through unicode-math doesn't:

% !TEX program = lualatex
\documentclass{minimal}
\usepackage{unicode-math}
\setmathfont{Kurier Light Regular}
\setmathfont[range=\mathit,\mathsfit]{Kurier Light Italic}
\setmathfont[range=\mathbfup,\mathbfsfup]{Kurier Bold}
\setmathfont[range=\mathbfit,\mathbfsfit]{Kurier Bold Italic}
\begin{document}
\[ e=\lim_{n \to \infty} \left(1+\frac{1}{n}\right)^n \]
\end{document}

MWE with <code>unicode-math</code> and OTF fonts

The parenthesis are correctly printed in Kurier Light, but not scaling with \left and \right.

So here are my 2 questions:

  1. Is it possible to get them to scale with OTF fonts, or can this only be done with the Type1? How?
  2. What things might I have forgotten to take care of, other than brace scaling?
15
  • 2
    Kurier Light is not a math font.
    – egreg
    Commented Apr 16, 2012 at 23:24
  • 1
    As @egreg said, you need an OpenType Math font with unicode-math, but Kurier isn't. Commented Apr 17, 2012 at 3:13
  • 2
    @Xavier \left and \right work with an OpenType font, but only if it has specific math tables and glyphs, which Kurier doesn't have.
    – egreg
    Commented Apr 17, 2012 at 15:30
  • 2
    @Xavier pdflatex doesn't use OT fonts. Never. The switch to different encodings are exactly the choices of the special math fonts. And the do show up in the .log as kurierl.pfb and kurierli.pfb. They are Type1 fonts that contain also the math fonts and are reencoded using ex-kurier.enc, sy-kurier.enc and rm-kurier.enc. TeX is able to use the information provided in the proper .tfm files (which unicode-math can't use, of course).
    – egreg
    Commented Apr 17, 2012 at 17:25
  • 2
    @Xavier If you don't load fontspec, LuaLaTeX behaves exactly like pdflatex.
    – egreg
    Commented Apr 17, 2012 at 19:34

3 Answers 3

9

LuaTeX (and XeTeX) support two types of math fonts: the traditional TeX math fonts using TFM files and new OpenType math fonts.

With TFM fonts, all the parameters and other special properties that TeX needs for proper math typesetting are stored in the TFM files, and this is what is loaded by the kurier package so you get correct output with that.

OpenType math is a new extension to OpenType that stores all math parameters and properties in the OpenType fonts themselves, and that what you want to use with unicode-math package. OpenType version of Kurier does not provide an OpenType math font, only regular text fonts.

1
  • Thanks for the answer! I just emailed the author of the Kurier font family to ask how much work it would be to include the math glyphes (I guess it's actually more about properties / font features, as the T1 glyphes can be embedded in OT theoretically) in the OT version. I'll keep you posted!
    – Xavier
    Commented Apr 17, 2012 at 20:53
4

If you don't load fontspec, the font management in LuaLaTeX is exactly the same as with pdflatex. The terminal output of the first run example with lualatex is

This is LuaTeX, Version beta-0.70.1-2011062107 (rev 4277) 
 restricted \write18 enabled.
(./xavier.tex
LaTeX2e <2011/06/27>
LuaTeX adaptation of babel <v3.8l-luatex-1.5> and hyphenation patterns for engl
ish, dumylang, nohyphenation, loaded.
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/minimal.cls
Document Class: minimal 2001/05/25 Standard LaTeX minimal class
) (/usr/local/texlive/2011/texmf-dist/tex/latex/kurier/kurier.sty)
(./xavier.aux)
(/usr/local/texlive/2011/texmf-dist/tex/latex/kurier/ot1kurierl.fd)
(/usr/local/texlive/2011/texmf-dist/tex/latex/kurier/ot1kurierlm.fd)
(/usr/local/texlive/2011/texmf-dist/tex/latex/kurier/omlkurierl.fd)
(/usr/local/texlive/2011/texmf-dist/tex/latex/kurier/omskurierl.fd)
(/usr/local/texlive/2011/texmf-dist/tex/latex/kurier/omxkurierl.fd) [1{/usr/loc
al/texlive/2011/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./xavier.aux) )

 237 words of node memory still in use:
   2 hlist, 1 vlist, 1 rule, 2 glue, 33 glue_spec, 1 write nodes
   avail lists: 2:13,3:21,4:33,5:5,6:22,7:2,9:22
{/usr/local/texlive/2011/texmf-dist/fonts/enc/dvips/kurier/ex-kurier.enc}{/usr/
local/texlive/2011/texmf-dist/fonts/enc/dvips/kurier/sy-kurier.enc}{/usr/local/
texlive/2011/texmf-dist/fonts/enc/dvips/kurier/rm-kurier.enc}{/usr/local/texliv
e/2011/texmf-dist/fonts/enc/dvips/kurier/mi-kurier.enc}</usr/local/texlive/2011
/texmf-dist/fonts/type1/nowacki/kurier/kurierl.pfb></usr/local/texlive/2011/tex
mf-dist/fonts/type1/nowacki/kurier/kurierli.pfb>
Output written on xavier.pdf (1 page, 35690 bytes).
Transcript written on xavier.log.

while with pdflatex is

This is pdfTeX, Version 3.1415926-2.3-1.40.12 (TeX Live 2011)
 restricted \write18 enabled.
entering extended mode
(./xavier.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, ge
rman-x-2011-07-01, ngerman-x-2011-07-01, afrikaans, ancientgreek, ibycus, arabi
c, armenian, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danis
h, dutch, ukenglish, usenglishmax, esperanto, estonian, ethiopic, farsi, finnis
h, french, friulan, galician, german, ngerman, swissgerman, monogreek, greek, h
ungarian, icelandic, assamese, bengali, gujarati, hindi, kannada, malayalam, ma
rathi, oriya, panjabi, tamil, telugu, indonesian, interlingua, irish, italian, 
kurmanji, lao, latin, latvian, lithuanian, mongolian, mongolianlmc, bokmal, nyn
orsk, polish, portuguese, romanian, romansh, russian, sanskrit, serbian, serbia
nc, slovak, slovenian, spanish, swedish, turkish, turkmen, ukrainian, uppersorb
ian, welsh, loaded.
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/minimal.cls
Document Class: minimal 2001/05/25 Standard LaTeX minimal class
) (/usr/local/texlive/2011/texmf-dist/tex/latex/kurier/kurier.sty)
(./xavier.aux)
(/usr/local/texlive/2011/texmf-dist/tex/latex/kurier/ot1kurierl.fd)
(/usr/local/texlive/2011/texmf-dist/tex/latex/kurier/ot1kurierlm.fd)
(/usr/local/texlive/2011/texmf-dist/tex/latex/kurier/omlkurierl.fd)
(/usr/local/texlive/2011/texmf-dist/tex/latex/kurier/omskurierl.fd)
(/usr/local/texlive/2011/texmf-dist/tex/latex/kurier/omxkurierl.fd) [1{/usr/loc
al/texlive/2011/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./xavier.aux) )
{/usr/local/texlive/2011/texmf-dist/fonts/enc/dvips/kurier/ex-kurier.enc}{/usr/
local/texlive/2011/texmf-dist/fonts/enc/dvips/kurier/sy-kurier.enc}{/usr/local/
texlive/2011/texmf-dist/fonts/enc/dvips/kurier/rm-kurier.enc}{/usr/local/texliv
e/2011/texmf-dist/fonts/enc/dvips/kurier/mi-kurier.enc}</usr/local/texlive/2011
/texmf-dist/fonts/type1/nowacki/kurier/kurierl.pfb></usr/local/texlive/2011/tex
mf-dist/fonts/type1/nowacki/kurier/kurierli.pfb>
Output written on xavier.pdf (1 page, 35805 bytes).
Transcript written on xavier.log.

and they differ essentially only in the loaded languages.

pdflatex and lualatex (without fontspec) don't use OpenType fonts, but only Type1 fonts, with OMS, OML and OMX encoded fonts for math, relying on .tfm files for information about glyphs and extendable characters like parentheses. In this particular case, the Type1 fonts for OMS, OML, OMX and OT1 reside all in the two .pfb files kurier.pfb and kurierli.pfb and the various glyphs are selected via reencoding, as made clear by the loading of the files

ex-kurier.enc
sy-kurier.enc
rm-kurier.enc
mi-kurier.enc

The OpenType font Kurier Light doesn't have the math glyphs and the math tables that might make it be usable by unicode-math. Until their developer adds the support for Unicode Math, the OpenType Kurier font cannot be used as an argument for \setmathfont in a reliable way.

3
  • I don't think pdflatex has anything to do with the question, as from the start the question was on OT vs T1 using lualatex (with or without fontspec resp.). But to the question, you basically say that the OpenType (OT) version of the font is missing glyphs that the Type 1 (T1) version has. If that is really the case, given the OT format can include T1 outlines, adding those glyphs from the T1 version to the OT version (without any additional typographic feature) should be trivial, no? I'll write to Janusz to check...
    – Xavier
    Commented Apr 17, 2012 at 20:40
  • @Xavier I think that the comparison between the log files shows clearly what it's all about: LuaLaTeX uses the very same mechanism as pdflatex, when not loading fontspec (or, more precisely, the luaotfload mechanism).
    – egreg
    Commented Apr 17, 2012 at 20:44
  • I never questioned how pdflatex and lualatex worked, I know that rather well :) My question is about Kurier OT vs T1. I've emailed Janusz to check if indeed the OT version of the Kurier font is missing some glyphs compared to the T1 version, though I believe if it's missing something, it's rather embedded typographic features as the glyphs should be very easy to include.
    – Xavier
    Commented Apr 17, 2012 at 23:41
1

If you don't mind changing the syntax to that of the scalerel package, you can scale your parens

% !TEX program = lualatex
\documentclass{minimal}
\usepackage{scalerel}
\usepackage{unicode-math}
\setmathfont{Kurier Light Regular}
%\setmathfont[range=\mathit,\mathsfit]{Kurier Light Italic}
%\setmathfont[range=\mathbfup,\mathbfsfup]{Kurier Bold}
%\setmathfont[range=\mathbfit,\mathbfsfit]{Kurier Bold Italic}
\begin{document}
New:
\[ e=\lim_{n \to \infty} {\scaleleftright[0.8ex]{(}{1+\frac{1}{n}}{)}}^n \]

Original:
\[ e=\lim_{n \to \infty} \left(1+\frac{1}{n}\right)^n \]
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .