Best way of using the full range of full fonts/styles/faces for Latin Modern Roman?
As fas I know, there are not any good solution for this.
One approach to solve this could be change the Latin Modern by another font with enough glyphs (I do not know a free font with enough glyphs, but probably a professional font could cover all your desired styles).
Other is botch with one has available: Using pdflatex
you can simulate "Italics smallcaps" with "Slanted smallcaps" using slantsc
packages, at least with pdflatex (not tested with lualatex, sorry) and the simulate the bold variant overlaping text. The macros \textbfsl
and \textbfslsc
are for now very naive approaches to do this, unbreakable text, but I hope that enough to check is it could look like true bold fonts (sorry again, but now I do not have time to test a more handy approach to overlap text, maybe later):
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{slantsc}
\def\textbfsl#1{\makebox[.3pt][l]{%
\makebox[.29pt][l]{\textsc{#1}}%
\makebox{\textsc{#1}}}}
\def\textbfslsc#1{%
\makebox[.29pt][l]{\textsl{\textsc{#1}}}%
\makebox{\textsl{\textsc{#1}}}}
\begin{document}
\begin{tabular}{ll}
Plain roman & Hello, world.\\
Bold roman & \textbf{Hello, world.}\\
Italics & \textit{Hello, world.}\\
Bold italics & \textit{\textbf{Hello, world.}}\\
Plain smallcaps & \textsc{Hello, world.}\\
Bold smallcaps & \textbfsl{Hello, world.}\\
Italics smallcaps & \textsl{\textsc{Hello, world.}}\\
Bold italic small caps & \textbfslsc{Hello, world.}\\
Typewriter & \texttt{Hello, world.}\\
Italic typewriter & \textit{\texttt{Hello, world.}}\\
Bold typewriter & \textbf{\texttt{Hello, world.}}\\
Bold italic typewriter & \textit{\textbf{\texttt{Hello, world.}}}\\
Slanted & \textsl{Hello, world.}\\
Bold slanted & \textbf{\textsl{Hello, world.}}\\
\end{tabular}
\end{document}
If lmodern
is not an absolute must, with tgtermes
and slantsc
you do not need any macro:
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{tgtermes}
\usepackage{slantsc}
\begin{document}
\begin{tabular}{ll}
Plain roman & Hello, world.\\
Bold roman & \textbf{Hello, world.}\\
Italics & \textit{Hello, world.}\\
Bold italics & \textit{\textbf{Hello, world.}}\\
Plain smallcaps & \textsc{Hello, world.}\\
Bold smallcaps & \textbf{\textsc{Hello, world.}}\\
Italics smallcaps & \textit{\textsc{Hello, world.}}\\
Bold italic small caps & \textit{\textbf{\textsc{Hello, world.}}}\\
Typewriter & \texttt{Hello, world.}\\
Italic typewriter & \textit{\texttt{Hello, world.}}\\
Bold typewriter & \textbf{\texttt{Hello, world.}}\\
Bold italic typewriter & \textit{\textbf{\texttt{Hello, world.}}}\\
Slanted & \textsl{Hello, world.}\\
Bold slanted & \textbf{\textsl{Hello, world.}}\\
\end{tabular}
\end{document}
CM Serif BoldItalic has no small caps, but you can fake them.
\documentclass{article}
\usepackage{fontspec}
\defaultfontfeatures{
Renderer=Full,
%Ligatures=TeX,
Numbers=OldStyle,
Scale=MatchLowercase,
}
\setmainfont{Latin Modern Roman}[
SlantedFont = {* Slanted},
UprightFeatures = {
SmallCapsFont = {* Caps},
},
ItalicFeatures = {
SmallCapsFont = LMRomanCaps10-Oblique,
},
BoldFeatures = {
SmallCapsFont = CMUSerif-Bold,
SmallCapsFeatures={Letters = SmallCaps},
},
% Neither Latin Modern nor CM Unicode have bold italic small caps
BoldItalicFeatures = {
SmallCapsFont = CMUSerif-Bold,
SmallCapsFeatures={FakeSlant=0.25,Letters=SmallCaps},
},
]
\begin{document}
\begin{tabular}{ll}
Plain roman & Hello, world.\\
Bold roman & \textbf{Hello, world.}\\
Italics & \textit{Hello, world.}\\
Bold italics & \textit{\textbf{Hello, world.}}\\
Plain smallcaps & \textsc{Hello, world.}\\
Bold smallcaps & \textbf{\textsc{Hello, world.}}\\
Italics smallcaps & \textit{\textsc{Hello, world.}}\\
Bold italic small caps & \textit{\textbf{\textsc{Hello, world.}}}\\
Typewriter & \texttt{Hello, world.}\\
Italic typewriter & \textit{\texttt{Hello, world.}}\\
Bold typewriter & \textbf{\texttt{Hello, world.}}\\
Bold italic typewriter & \textit{\textbf{\texttt{Hello, world.}}}\\
Slanted & \textsl{Hello, world.}\\
Bold slanted & \textbf{\textsl{Hello, world.}}\\
\end{tabular}
\end{document}
You’re off to a good start, but that doesn’t even scratch the surface of all the typefaces in the Computer Modern family. If you see Appendix A of “The LaTeX Font Installation Guide”, which expands on a scheme in The LaTeX Companion, there are official, standardized names for many more widths, weights and shapes. Several are present in Latin Modern, Computer Modern Unicode, or both.
For reference, here are the full lists of fonts in the Latin Modern collection and in the Computer Modern Unicode collection. There is also, of course, Latin Modern Math to replace the math and math symbol fonts. The program otfinfo
(which works on the .ttf
fonts from CMU as well) is useful to see which CMU fonts contain small-caps.
Of the extra faces in Latin Modern, I treat Demi as an additional weight, which I call sb
(because sb
is the only weight between m
and b
in the second edition of The LaTeX Companion.), and Unslanted as an additional shape, ui
. I add the commands \sbseries
and \textsb
corresponding to \bfseries
and \texbf
, and \uishape
and \textui
corresponding to \itshape
and \textit
. You can use these as templates to add any other series or shape.
If you want to be able to set the font weight and extent separately, so that you can select bold in the middle of a block of Latin Modern Sans Cond, you might want to check out the package nfssext-cfr
for inspiration.
Both Latin Modern and the Computer Modern Unicode fonts include several other families. Of these, CMU Concrete is a conversion of a completely different font originally commissioned for DEK’s book, Concrete Mathematics. I also treat Latin Modern Roman Dunhill and CMU Classical Serif as different families. It might, however, make sense to treat CMU Bright as a lighter weight of the sans-serif font.
CMU contains one series not present in Latin Modern: bold non-extended. For these purposes, I’ll give it the series bc
, for bold condensed. It does not come with either italic, slanted or small caps. Other than that, I use some of its bold small-caps.
Here’s a sample for just the Latin Modern Roman family.
\documentclass[varwidth]{standalone}
\usepackage{amsmath}
\usepackage{unicode-math}
\usepackage{microtype}
\defaultfontfeatures{ Scale = MatchUppercase }
\setmainfont{Latin Modern Roman}[
Scale = 1.0 ,
Ligatures = {Common, Rare, TeX} ,
UprightFont = {Latin Modern Roman} ,
UprightFeatures = {
Ligatures = Discretionary ,
SmallCapsFeatures = { Ligatures = ResetAll } ,
SmallCapsFont = {lmromancaps10-regular.otf}
} ,
BoldFeatures = {
Ligatures = Discretionary ,
SmallCapsFeatures = {Letters = SmallCaps } ,
SmallCapsFont = {CMU Serif Bold}
} ,
ItalicFeatures = {
Ligatures = Discretionary ,
SmallCapsFeatures = { Ligatures = ResetAll } ,
SmallCapsFont = lmromancaps10-oblique.otf
} ,
BoldItalicFeatures = {
Ligatures = Discretionary ,
SmallCapsFeatures = { % Ligatures = ResetAll ,
Letters = SmallCaps } ,
SmallCapsFont = cmunbl.ttf
} ,
SlantedFont = {Latin Modern Roman Slanted} ,
SlantedFeatures = {
Ligatures = Discretionary ,
SmallCapsFeatures = { Ligatures = ResetAll } ,
SmallCapsFont = lmromancaps10-oblique.otf
} ,
BoldSlantedFont = lmromanslant10-bold.otf ,
BoldSlantedFeatures = {
Ligatures = Discretionary ,
SmallCapsFeatures = { % Ligatures = ResetAll ,
Letters = SmallCaps } ,
SmallCapsFont = cmunbl.ttf
} ,
FontFace = {sb}{n}{
Font = {Latin Modern Roman Demi} ,
Ligatures = Discretionary } ,
FontFace = {sb}{sl}{
Font = lmromandemi10-oblique.otf ,
Ligatures = Discretionary } ,
FontFace = {sb}{it}{
Font = lmromandemi10-oblique.otf ,
Ligatures = Discretionary } ,
FontFace = {bc}{n}{CMU Serif Bold Non-Extended} ,
FontFace = {m}{ui}{Latin Modern Roman Unslanted}
]
\setmathfont{Latin Modern Math}
\setmathfont[range=up]{Latin Modern Roman Unslanted}
\DeclareRobustCommand\sbseries{\fontseries{sb}\selectfont}
\DeclareTextFontCommand{\textsb}{\sbseries}
\DeclareRobustCommand\uishape{\fontshape{ui}\selectfont}
\DeclareTextFontCommand{\textui}{\uishape}
\begin{document}
\begin{minipage}{10cm}
\textrm{
Latin Modern Roman \textit{Italic} \textsl{Slanted} \textui{Upright-Italic}
\textsb{Demibold \textit{Oblique}}
\textbf{Bold \textit{Italic} \textsl{Slanted}} {\fontseries{bc}\selectfont Non-extended}
\textsc{Small Caps \textit{Italic} \textsl{Slanted} \textbf{Bold \textit{Italic} \textsl{Slanted}}}
}
\[ \symup{e}^{\symup{i}x} = \cos x + \symup{i} \sin x \implies \symup{e}^{\symup{i}\muppi} + 1 = 0 \]
\end{minipage}
\end{document}
I threw in an example of how the Upright Italic style is useful: it’s great for setting mathematical constants such as e, π and i upright, in ISO style. Compare the imaginary unit i in i sin x
with the i in sin
and the italic variable name x. You can also take that as an example of how to use any other font face in math mode.
You could eliminate some of the warnings by removing the Ligatures
commands. For whatever reason, possibly a bug in fontspec
, SmallCapsFeatures = {Ligatures = ResetAll}
does nothing and Ligatures = NoDiscretionary
only produces a second error message saying that the font does not support dlig
. However, the warning is harmless.
If you want more kinds of small caps, you might apply the FakeBold
feature to a different weight, or you might find this code useful.