The lmodern package
Switches the document to Latin Modern, the vector version of the Computer Modern fonts with the full T1 character set.
Loading the package
\usepackage{lmodern}With \usepackage[T1]{fontenc} alone, pdfLaTeX takes the EC fonts for Computer Modern. Depending on the installation these are vector fonts or bitmaps, and bitmaps look blurred in many PDF viewers. The EC fonts also exist only in fixed sizes: a request for 13.5pt is replaced by 14.4pt with a font warning.
Latin Modern follows the design of Computer Modern, is a vector font on every installation and is available in any size. The package has no commands. It changes the three default families (serif, sans serif, monospaced) and the math fonts.
LuaLaTeX and XeLaTeX use the OpenType version of Latin Modern as their default font, so the package is not needed there.
Main commands
\usepackage{lmodern} | Switches the fonts. In pdfLaTeX documents the line stands next to \usepackage[T1]{fontenc}. |
\usepackage[variablett]{lmodern} | Uses the proportional typewriter font of the family for \texttt. |
\usepackage[lighttt]{lmodern} | Uses the light weight of the typewriter font as its normal weight. |
\usepackage[nomath]{lmodern} | Leaves the math fonts as they are. |
\fontsize{13.5pt}{16pt}\selectfont | Any font size works without a substitution warning. |
Complete example
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\begin{document}
Latin Modern Roman, \textsf{Latin Modern Sans} and \texttt{Latin Modern Mono}.
{\fontsize{13.5pt}{16pt}\selectfont This line is set in 13.5\,pt, a size
that the EC fonts do not have.}
Umlauts are single characters: Größe, Übung, Äpfel.
\end{document}Compiled with pdfLaTeX from TeX Live 2023.
Pitfalls
- The family has no bold small capitals.
\textbf{\textsc{...}}falls back to bold upright with the warning Font shape `OT1/cmr/bx/sc' undefined. - Load the package together with
T1fromfontenc. Without it you get Latin Modern in theOT1encoding, and words with umlauts are still not hyphenated. - Font expansion of
microtypeneeds vector fonts, which is one more reason to loadlmodernin aT1document.
Related pages
- Package
fontenc - Package
microtype - How-to Change the font in LaTeX
- Error Font shape `OT1/cmr/bx/sc' undefined
- How-to Write a CV in LaTeX
- How-to Add a watermark in LaTeX