Use this file to discover all available pages before exploring further.
If you want to change the font in LaTeX, the right method depends on your compiler. Use font packages such as lmodern or newtxtext with pdfLaTeX, and use fontspec with XeLaTeX or LuaLaTeX when you want system fonts such as Times New Roman, Arial, or EB Garamond.
Quick answer: use pdfLaTeX with font packages for traditional LaTeX workflows, and use XeLaTeX or LuaLaTeX with fontspec when you need system fonts or modern OpenType features.Related topics: Text formatting | Document classes | Choosing a compiler
\documentclass{article}\begin{document}% Family (shape of letters)\textrm{Roman family (serif)}\textsf{Sans serif family}\texttt{Typewriter family (monospace)}% Series (weight/width)\textmd{Medium series (normal)}\textbf{Bold series}% Shape (slant/style)\textup{Upright shape}\textit{Italic shape}\textsl{Slanted shape}\textsc{Small Caps Shape}\end{document}
% All combinations work\textsf{\textbf{Sans serif bold}}\texttt{\textit{Typewriter italic}}\textrm{\textbf{\textit{Roman bold italic}}}\textsc{\textbf{Bold Small Caps}}% Using declarations{\sffamily\bfseries\itshape Sans serif bold italic}
\documentclass{article}% Times-like fonts\usepackage{mathptmx} % Times with math support% or\usepackage{newtxtext,newtxmath} % New TX fonts% Palatino-like fonts\usepackage{mathpazo} % Palatino with math% or\usepackage{newpxtext,newpxmath} % New PX fonts% Computer Modern variants\usepackage{lmodern} % Latin Modern\usepackage{cm-super} % CM Super% Sans serif as default\usepackage{helvet}\renewcommand{\familydefault}{\sfdefault}% Other popular choices\usepackage{fourier} % Utopia\usepackage{libertine} % Linux Libertine\usepackage{kpfonts} % KP Fonts\begin{document}Your text here...\end{document}
Times-like
A traditional serif look for papers and reports.
Palatino-like
A wider, more bookish serif with generous proportions.
\documentclass{article}\usepackage{fontspec}% Define custom font commands\newfontfamily\headingfont{Helvetica Neue}\newfontfamily\specialfont{Zapfino}\newfontfamily\codefont{Source Code Pro}\begin{document}{\headingfont\Large This is a heading in Helvetica Neue}Regular text in the main font.{\specialfont Special decorative text}{\codefont\small Code examples in Source Code Pro}\end{document}
\documentclass{article}\usepackage{microtype}% Full features (pdfLaTeX)\usepackage[ protrusion=true, expansion=true, tracking=true, kerning=true, spacing=true]{microtype}% Fine-tuning\microtypesetup{ protrusion={true,alltext}, expansion={true,alltext,compat}}\begin{document}Microtype improves typography through:\begin{itemize}\item Character protrusion (margin kerning)\item Font expansion (better justification)\item Tracking (letter spacing)\item Additional kerning\end{itemize}The improvements are subtle but create more professional results.\end{document}
Microtype improves typography through character protrusion, font expansion, tracking, and better justification. The effect is subtle in code, but it makes the final paragraph color look smoother and more even.
\documentclass[12pt]{article} % Base size: 10pt, 11pt, or 12pt% Exact sizes\fontsize{14}{17}\selectfont % 14pt font, 17pt baselineThis text is exactly 14 points.% Relative sizes{\tiny Tiny text (5pt at 10pt base)}{\small Small text (9pt at 10pt base)}{\large Large text (12pt at 10pt base)}{\Huge Huge text (25pt at 10pt base)}% Custom size commands\newcommand{\customsize}{\fontsize{13}{16}\selectfont}{\customsize Custom 13pt text}
\documentclass{article}\usepackage{lettrine}\begin{document}\lettrine[lines=3]{O}{nce upon a time}, in a land far away, there lived a typographer who loved beautiful drop caps. This elegant initial letter adds a classic touch to the beginning of chapters or sections.\lettrine[lines=2,loversize=0.1]{T}{his} is a smaller drop cap.\end{document}
Once upon a time, in a land far away, there lived a typographer who loved beautiful drop caps. This elegant initial letter adds a classic touch to the beginning of chapters or sections.
\documentclass{article}\usepackage{fontspec} % XeLaTeX/LuaLaTeX% Define special purpose fonts\newfontfamily\chapterfont{Bebas Neue}\newfontfamily\quotefont{Crimson Text}[Scale=1.1]\newfontfamily\emojifont{Apple Color Emoji} % or Noto Color Emoji\begin{document}{\chapterfont\Huge Chapter One}{\quotefont\itshape "Beautiful typography is invisible, yet it shapes how we perceive the written word."}{\emojifont π π β¨} % Emoji support!\end{document}
Chapter One
βBeautiful typography is invisible, yet it shapes how we perceive the written word.β