13

In the allrunes.sty documentation (which uses Metafont), I’ve recently seen the \textlf macro for the first time. It selects a light font and therefore accompanies the frequent command \textbf and its sibling \textmd for default ‘medium’.

Searching for ‘textlf’ on SX showed that this string is also a package option for Minion Pro, but there it switches on lining figures and it seems some other packages have a command \textlf that does the same.

  • So I wonder, how commonly supported is \textlf and is there an established alternative without conflicts?
  • More generally, if I’m using a typeface with fonts for many weights available (e.g. thin, light, semi-bold, bold, heavy, black …), how are they best accessed in Xe-/LuaTeX?

The second question is relevant, for instance, if I was to write a supporting package for an Open Type typeface that provided predefined \text… macros, which wrap fontspec’s \newfontfamily or rather the less known \newfontface within \DeclareTextFontCommand.

2

3 Answers 3

9

in a texlive 2014, updated this morning I get the following from grep (with my annotation in comment at the end of each line):

$ grep "[^a-z]textlf[^a-z]" */*
allrunes/allrunes.sty:\DeclareTextFontCommand{\textlf}{\lfseries}
baskervaldx/Baskervaldx.sty:\DeclareRobustCommand{\textlf}[1]{%    lining figures
fbb/fbb.sty:\DeclareRobustCommand{\textlf}[1]{%    lining figures
heuristica/heuristica.sty:\DeclareRobustCommand{\textlf}[1]{%    lining figures
typeface/typeface.sty:      \PassOptionsToPackage{textlf}{MinionPro}%    lining figures
xcharter/XCharter.sty:\def\textlf#1{{\lfstyle #1}}%    lining figures


$ pwd
/usr/local/texlive/2014/texmf-dist/tex/latex

So it seems that the convention is that \textlf where used in all other packages denotes lining figures.

1
  • 1
    Searching installed packages, why didn’t I think of that? (OTOH, I’m using BasicTeX, so several matches wouldn’t have shown up.)
    – Crissov
    Commented Jul 10, 2014 at 6:39
17

An example for HelveticaNeue-Light

\documentclass{article}
\usepackage{fontspec}
\setmainfont[
   ItalicFont     = HelveticaNeue-Italic,
   BoldFont       = HelveticaNeue-Bold,
   BoldItalicFont = HelveticaNeue-BoldItalic]{HelveticaNeue}
\newfontfamily\NHLight[
   ItalicFont     = HelveticaNeue-LightItalic,
   BoldFont       = HelveticaNeue-UltraLight,
   BoldItalicFont = HelveticaNeue-UltraLightItalic]{HelveticaNeue-Light}

\newcommand\textrmlf[1]{{\NHLight#1}}
\newcommand\textitlf[1]{{\NHLight\itshape#1}}
\let\textbflf\textrm
\newcommand\textulf[1]{{\NHLight\bfseries#1}}
\newcommand\textuitlf[1]{{\NHLight\bfseries\itshape#1}}

\begin{document}

\textrm{foo} \textbf{bar} \textit{baz} \textbf{\textit{foobar}} \par
\textrmlf{foo} \textbflf{bar} \textulf{bar} \textitlf{baz} \textuitlf{foobar}

\end{document}

enter image description here

2
  • 1
    Next time I will ask separate questions. You answer the second one, David Carlisle answered the first one. I’m accepting his one only because it gives an objective answer, i.e. \textlf isn’t commonly used for light fonts, whereas you show but one good practice. Thanks nevertheless.
    – Crissov
    Commented Jul 10, 2014 at 6:44
  • It seems that the effect of \textrm and \textbflf is the same, which would make sense: bold x light = medium. A kind of font series arithmetic. :) Commented Sep 19, 2019 at 10:14
1

The standard LaTeX command for this is \fontseries{l}\selectfont, assuming that your legacy font is installed with the official schema (or you’ve set your OpenType font family up that way with fontspec).

At least one other package uses a different command to select the Light weight: nfssext-cfr declares it as \lgweight and \textlg{} when the light font is provided as a weight. Note that this has different behavior because it allows selecting weight and width separately. So, for example, if you’ve currently selected Regular Condensed, \lgweight would select Light Condensed, but \fontseries{l} will select Light, because LaTeX merges Light and Condensed into the {lc} series.

You must log in to answer this question.

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