5

I would like to use the medium weight Fira font in Latex but textmd doesn't seem to do anything. What am I doing wrong?

\usepackage[defaultsans]{FiraSans}

Hello \textmd{World}.

Hello \textbf{World}.

Here is what it looks like. As you can see, the first "World" is not any bolder than the regular text.

enter image description here

  • 1
    Please provide a minimal working example (MWE) that illustrates your problem. Recent versions of FiraSans don't recognize the option defaultsans and expect sfdefault instead. – DG' Nov 3 '18 at 18:42
  • It appears that the medium weight is already the default font, so setting it explicitly does nothing... – DG' Nov 3 '18 at 18:58
11

The FiraSans package uses mdweight to set regular text, so calling \textmd explicitly has no effect whatsoever. If you want to use a specific weight explicitly, you can use one of the commands defined in FiraSans.sty:

  • \firathin
  • \firaultralight
  • \firaextralight
  • \firalight
  • \firabook
  • \firamedium
  • \firasemibold
  • \firaextrabold
  • \firaheavy

Example:

\documentclass{article}
\usepackage[sfdefault]{FiraSans}

\begin{document}

Hello {\firathin World}.

Hello {\firaultralight World}.

Hello {\firaextralight World}.

Hello {\firalight World}.

Hello {\firabook World}.

Hello {\firamedium World}.

Hello {\firasemibold World}.

Hello {\firaextrabold World}.

Hello {\firaheavy World}.

\end{document}

enter image description here

  • +1. The visual clarity of the screenshot might be improved if you listed the fonts in order of weight. E.g., consider placing "light' after, rather than before, both "ultralight" and "extralight". Similarly, consider placing 'medium' after, rather than before, 'book'. – Mico Nov 3 '18 at 20:22
  • You might be right. I, lazily, yanked the entries out of FiraSans.sty without further editing... – DG' Nov 3 '18 at 20:25
7

If you can switch to either XeLaTeX or LuaLaTeX to compile your document, you could download the OpenType version of the FiraSans font family, which features 16 [!!] separate font weights. In comparison, the FiraSans package (which works with pdfLaTeX) offers only 9 font weights.

As may be seen from the following screenshot, the weight difference between "Medium" and "SemiBold" is rather subtle. To avoid any uncertainty among your readers as to what constitutes "bold", it's a good idea to emply a weight that's 2 or even 3 steps heavier than the chosen default font weight. E.g., if "Fira Sans Book" were chosen as the base font weight, then either "Fira Sans Medium" or "Fira Sans SemiBold" would be suitable candidates for the 'bold' font variant. (What's selected as the "regular" font weight for a document does not have to be the same as the weight that's labelled "Regular" by the font designer.)

Thus, one might write

\setsansfont{Fira Sans Book}[%
     ItalicFont     = {Fira Sans Book Italic},
     BoldFont       = {Fira Sans SemiBold},
     BoldItalicFont = {Fira Sans SemiBold Italic}]

to choose font weights "9" and "12" from the following list as the 'regular' and 'bold' font weights of one's document.

enter image description here

\documentclass{article}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures={TeX,Common,Rare}}
\setmainfont{Fira Sans Regular}  % set as default

\newfontfamily{\FSTwo}{Fira Sans Two}         % 1
\newfontfamily{\FSFour}{Fira Sans Four}       % 2
\newfontfamily{\FSEight}{Fira Sans Eight}     % 3
\newfontfamily{\FSHair}{Fira Sans Hair}       % 4
\newfontfamily{\FSThin}{Fira Sans Thin}       % 5
\newfontfamily{\FSUltraLight}{Fira Sans UltraLight} % 6
\newfontfamily{\FSExtraLight}{Fira Sans ExtraLight} % 7
\newfontfamily{\FSLight}{Fira Sans Light}     % 8
\newfontfamily{\FSBook}{Fira Sans Book}       % 9
\newfontfamily{\FSRegular}{Fira Sans Regular} % 10
\newfontfamily{\FSMedium}{Fira Sans Medium}   % 11
\newfontfamily{\FSSemiBold}{Fira Sans SemiBold}   % 12
\newfontfamily{\FSBold}{Fira Sans Bold}           % 13
\newfontfamily{\FSExtraBold}{Fira Sans ExtraBold} % 14
\newfontfamily{\FSHeavy}{Fira Sans Heavy}     % 15
\newfontfamily{\FSUltra}{Fira Sans Ultra}     % 16

\begin{document}
\obeylines  % just for this example
{\FSTwo Hello World --- Two 1}
{\FSFour Hello World --- Four 2}
{\FSEight Hello World --- Eight 3}
{\FSHair Hello World  --- Hair 4}
{\FSThin Hello World --- Thin 5}
{\FSUltraLight Hello World --- UltraLight 6}
{\FSExtraLight Hello World --- ExtraLight 7}
{\FSLight Hello World --- Light 8}
{\FSBook Hello World  --- Book 9}
{\FSRegular Hello World --- Regular 10}
{\FSMedium Hello World --- Medium 11}
{\FSSemiBold Hello World --- SemiBold 12}
{\FSBold Hello World --- Bold 13}
{\FSExtraBold Hello World --- ExtraBold 14}
{\FSHeavy Hello World --- Heavy 15}
{\FSUltra Hello World --- Ultra 16}
\end{document}
1

Here is another alternative that might be useful if you either want to support a font family with no LaTeX package, or use the same extended font weight across different font families.

\documentclass[varwidth]{standalone}
\usepackage{fontspec}

\setmainfont{FiraSans}[
  Scale = 1.0 ,
  Ligatures = {Common, Discretionary, TeX} ,
  Numbers = OldStyle ,
  UprightFont = *-Regular ,
  BoldFont = *-Bold ,
  ItalicFont = *-RegularItalic ,
  BoldItalicFont = *-BoldItalic ,
  FontFace = {mb}{n}{*-Medium} ,
  FontFace = {mb}{it}{*-MediumItalic} ,
  FontFace = {sb}{n}{*-SemiBold} ,
  FontFace = {sb}{it}{*-SemiBoldItalic} ,
  Extension = .otf
]

\DeclareRobustCommand\mbseries{\fontseries{mb}\selectfont}
\DeclareTextFontCommand\textmb{\mbseries}

\DeclareRobustCommand\sbseries{\fontseries{sb}\selectfont}
\DeclareTextFontCommand\textsb{\sbseries}

\begin{document}
\textmd{Fira Sans} \textmb{Medium} \textsb{Semibold} \textbf{Bold} \\
{\itshape\mdseries Fira Sans Italic \mbseries Medium \sbseries Semibold \bfseries Bold}
\end{document}

Fira Sans sample

This defines two new font weights, mb and sb, with commands analogous to textbf and \bfseries. Although the fontspec package lets you give a new series or shape an arbitrary name, those are the conventional series names from the LaTeX documentation, and a number of packages define commands such as \textsb.

Here, I went with \mdseries, but a number of existing packages use \mdweight instead. In theory, a series should set both the font weight and its width (such as Condensed or Expanded). So, if you implement a command to set the font weight, and also support more than one width, authors will expect to be able to change the width independently.

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.