5

The Alegreya fonts are (i'm translating from German) "black" "very bold" "bold" "medium" and "standard". I have read about redefining semibold in bold, but I cannot find anything to make different versions of bold. How do I define 4 different bold versions. All of these have their italic counterparts. What has to be done for those?

  • which engine do you use? – Ulrike Fischer Dec 4 '20 at 11:20
  • pdflatex as always – bkleine Dec 4 '20 at 12:16
7

Just list all the fonts.

\documentclass{article}
\usepackage{fontspec}

\setmainfont{Alegreya}[
  Extension=.otf,
  UprightFont=*-Regular,
  UprightFeatures={SmallCapsFont=*SC-Regular},
  ItalicFont=*-Italic,
  ItalicFeatures={SmallCapsFont=*SC-Italic},
  BoldFont=*-Bold,
  BoldFeatures={SmallCapsFont=*SC-Bold},
  BoldItalicFont=*-BoldItalic,
  BoldItalicFeatures={SmallCapsFont=*SC-BoldItalic},
  FontFace={sb}{n}{*-Medium},
  FontFace={sb}{it}{*-MediumItalic},
  FontFace={sb}{sc}{*SC-Medium},
  FontFace={sb}{scit}{*SC-MediumItalic},
  FontFace={ub}{n}{*-ExtraBold},
  FontFace={ub}{it}{*-ExtraBoldItalic},
  FontFace={ub}{sc}{*SC-ExtraBold},
  FontFace={ub}{scit}{*SC-ExtraBoldItalic},
  FontFace={k}{n}{*-Black},
  FontFace={k}{it}{*-BlackItalic},
  FontFace={k}{sc}{*SC-Black},
  FontFace={k}{scit}{*SC-BlackItalic},
]
\DeclareTextFontCommand{\textsemibold}{\fontseries{sb}\selectfont}
\DeclareTextFontCommand{\textblack}{\fontseries{k}\selectfont}
\DeclareTextFontCommand{\textextrabold}{\fontseries{ub}\selectfont}

\begin{document}

Normal \textit{Italic} \textbf{Bold} \textbf{\textit{Bold Italic}}

\textsc{Small Caps} \textbf{\textsc{Bold SC}} \textit{\textsc{Italic SC}} \textbf{\textit{\textsc{Bold Italic SC}}}

\textsemibold{Medium} \textsemibold{\textit{Medium Italic}}

\textsemibold{\textsc{Medium SC}} \textsemibold{\textit{\textsc{Medium Italic SC}}}

\textextrabold{Extra Bold} \textextrabold{\textit{Extra Bold Italic}}

\textextrabold{\textsc{Extra Bold SC}} \textextrabold{\textit{\textsc{Extra Bold Italic SC}}}

\textblack{Black} \textblack{\textit{Black Italic}}

\textblack{\textsc{Black SC}} \textblack{\textit{\textsc{Black Italic SC}}}

\end{document}

Change the command names, if you prefer.

enter image description here

A table for better comparison.

enter image description here

pdflatex

\documentclass{article}
\usepackage{Alegreya}
\usepackage{booktabs,array}

\DeclareTextFontCommand{\textsemibold}{\AlegreyaMedium}
\DeclareTextFontCommand{\textblack}{\AlegreyaBlack}
\DeclareTextFontCommand{\textextrabold}{\AlegreyaExtraBold}

\begin{document}

\begin{tabular}{@{}>{\sffamily}lll@{}}
\toprule
\sffamily Weight & \multicolumn{2}{c@{}}{\sffamily Shape} \\
\cmidrule(l){2-3}
& \multicolumn{1}{c}{\sffamily Upright} & \multicolumn{1}{c@{}}{\sffamily Italic} \\
\midrule
Normal & Normal & \textit{Italic} \\
Normal SC & \textsc{Small Caps} & \textit{\textsc{Italic SC}} \\
Medium & \textsemibold{Medium} & \textsemibold{\textit{Medium Italic}} \\
Medium SC & \textsemibold{\textsc{Medium SC}} & \textsemibold{\textit{\textsc{Medium Italic SC}}} \\
Bold & \textbf{Bold} & \textbf{\textit{Bold Italic}} \\
Bold SC & \textbf{\textsc{Bold SC}} & \textbf{\textit{\textsc{Bold Italic SC}}} \\
Extra Bold & \textextrabold{Extra Bold} & \textextrabold{\textit{Extra Bold Italic}} \\
Extra Bold SC & \textextrabold{\textsc{Extra Bold SC}} & \textextrabold{\textit{\textsc{Extra Bold Italic SC}}} \\
Black & \textblack{Black} & \textblack{\textit{Black Italic}} \\
Black SC & \textblack{\textsc{Black SC}} & \textblack{\textit{\textsc{Black Italic SC}}} \\
\bottomrule
\end{tabular}

\end{document}

The table will be the same as the above one.

  • Does this also work with pdflatex? I never used xelatex or lualatex befor. – bkleine Dec 4 '20 at 12:18
  • @bkleine It's even easier! See update – egreg Dec 4 '20 at 12:47
  • Thanks a lot! Really smart! – bkleine Dec 4 '20 at 13:25
  • I have problems with the following, when I use scrbook, but not when using article as class. \documentclass[paper=A5]{scrbook} \usepackage{Alegreya} \usepackage{booktabs,array} \newcommand{\ScN}[1]{\textsemibold{\textit{#1}}}%Scientific Names \DeclareTextFontCommand{\textsemibold}{\AlegreyaMedium} \begin{document} \textbf{\textit{Systema Naturae}} \begin{description} \item [\ScN{Polyommatus daphnis}(Zahnflügelbläuling)] Dieser \end{description} \end{document} – bkleine Dec 5 '20 at 14:07
  • @bkleine As far as I can see you just get a spurious warning. – egreg Dec 5 '20 at 14:25

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.