Font sizes, families, and styles
Introduction
LaTeX normally chooses the appropriate font and font size based on the logical structure of the document (e.g. sections). In some cases, you may want to set fonts and sizes by hand.
The following example shows how to use the smallest available font size in LaTeX (\tiny
) and the small caps (\textsc{...}
) font style:
This is a simple example, {\tiny this will show different font sizes} and also \textsc{different font styles}.
The following image shows the output produced by the example above:
Font sizes
Font sizes are identified by special names, the actual size is not absolute but relative to the font size declared in the \documentclass
statement (see Creating a document in LaTeX).
In the following example, {\huge huge font size}
declares that the text inside the braces must be formatted in a huge font size. For a complete list of available font sizes see the reference guide.
In this example the {\huge huge font size} is set and
the {\footnotesize Foot note size also}. There's a fairly
large set of font sizes.
The following image shows the output produced by the example above:
Font families
By default, in standard LaTeX classes the default style for text is usually a Roman (upright) serif font. To use other styles (families) such as sans serif, typewriter (monospace) etc. you need to use some specific LaTeX commands, as shown in the example below:
In this example, a command and a switch are used.
\texttt{A command is used to change the style
of a sentence}.
\sffamily
A switch changes the style from this point to
the end of the document unless another switch is used.
The following image shows the output produced by the example above:
You can set up the use of sans font as a default in a LaTeX document by using the command:
\renewcommand{\familydefault}{\sfdefault}
Similarly, for using roman font as a default:
\renewcommand{\familydefault}{\rmdefault}
Font styles
The most common font styles in LaTeX are bold, italics and underlined, but there are a few more.
In the following example the \textsl
command sets the text in a slanted style which makes the text look a bit like italics, but not quite. See the reference guide for a complete list of font styles.
Part of this text is written \textsl{in a different
font style} to highlight it.
The following image shows the output produced by the example above:
If you want to go back to "normal" font style (default for the LaTeX class you are using), this can be done by using the \textnormal{...}
command or the \normalfont
switch command.
Putting it all together
The following example combines together the various LaTeX code fragments used in this article.
\documentclass{article}
\begin{document}
%Example of different font sizes and types
This is a simple example, {\tiny this will show different font sizes} and also \textsc{different font styles}.
\vspace{1cm}
%Example of different font sizes and types
In this example the {\huge huge font size} is set and the {\footnotesize Foot note size also}. There's a fairly large set of font sizes.
\vspace{1cm}
%Example of different font sizes and types
In this example, a command and a switch are used. \texttt{A command is used to change the style of a sentence}.
\sffamily
A switch changes the style from this point to the end of the document unless another switch is used.
\rmfamily
\vspace{1cm}
%Example of different font sizes and types
Part of this text is written \textsl{in different font style} to highlight it.
\end{document}
Reference guide
Font sizes
Command | Output |
---|---|
\tiny | |
\scriptsize | |
\footnotesize | |
\small | |
\normalsize | |
\large | |
\Large | |
\LARGE | |
\huge | |
\Huge |
Default font families
typeface = family | command | switch command | output |
---|---|---|---|
serif (roman) | \textrm{Sample Text 0123} |
\rmfamily |
|
sans serif | \textsf{Sample Text 0123} |
\sffamily |
|
typewriter (monospace) | \texttt{Sample Text 0123} |
\ttfamily |
Font styles
style | command | switch command | output |
---|---|---|---|
medium | \textmd{Sample Text 0123} |
\mdseries |
|
bold | \textbf{Sample Text 0123} |
\bfseries |
|
upright | \textup{Sample Text 0123} |
\upshape |
|
italic | \textit{Sample Text 0123} |
\itshape |
|
slanted | \textsl{Sample Text 0123} |
\slshape |
|
small caps | \textsc{Sample Text 0123} |
\scshape |
Further reading
For more information see:
Overleaf guides
- Creating a document in Overleaf
- Uploading a project
- Copying a project
- Creating a project from a template
- Using the Overleaf project menu
- Including images in Overleaf
- Exporting your work from Overleaf
- Working offline in Overleaf
- Using Track Changes in Overleaf
- Using bibliographies in Overleaf
- Sharing your work with others
- Using the History feature
- Debugging Compilation timeout errors
- How-to guides
- Guide to Overleaf’s premium features
LaTeX Basics
- Creating your first LaTeX document
- Choosing a LaTeX Compiler
- Paragraphs and new lines
- Bold, italics and underlining
- Lists
- Errors
Mathematics
- Mathematical expressions
- Subscripts and superscripts
- Brackets and Parentheses
- Matrices
- Fractions and Binomials
- Aligning equations
- Operators
- Spacing in math mode
- Integrals, sums and limits
- Display style in math mode
- List of Greek letters and math symbols
- Mathematical fonts
- Using the Symbol Palette in Overleaf
Figures and tables
- Inserting Images
- Tables
- Positioning Images and Tables
- Lists of Tables and Figures
- Drawing Diagrams Directly in LaTeX
- TikZ package
References and Citations
- Bibliography management with bibtex
- Bibliography management with natbib
- Bibliography management with biblatex
- Bibtex bibliography styles
- Natbib bibliography styles
- Natbib citation styles
- Biblatex bibliography styles
- Biblatex citation styles
Languages
- Multilingual typesetting on Overleaf using polyglossia and fontspec
- Multilingual typesetting on Overleaf using babel and fontspec
- International language support
- Quotations and quotation marks
- Arabic
- Chinese
- French
- German
- Greek
- Italian
- Japanese
- Korean
- Portuguese
- Russian
- Spanish
Document structure
- Sections and chapters
- Table of contents
- Cross referencing sections, equations and floats
- Indices
- Glossaries
- Nomenclatures
- Management in a large project
- Multi-file LaTeX projects
- Hyperlinks
Formatting
- Lengths in LaTeX
- Headers and footers
- Page numbering
- Paragraph formatting
- Line breaks and blank spaces
- Text alignment
- Page size and margins
- Single sided and double sided documents
- Multiple columns
- Counters
- Code listing
- Code Highlighting with minted
- Using colours in LaTeX
- Footnotes
- Margin notes
Fonts
Presentations
Commands
Field specific
- Theorems and proofs
- Chemistry formulae
- Feynman diagrams
- Molecular orbital diagrams
- Chess notation
- Knitting patterns
- CircuiTikz package
- Pgfplots package
- Typesetting exams in LaTeX
- Knitr
- Attribute Value Matrices
Class files
- Understanding packages and class files
- List of packages and class files
- Writing your own package
- Writing your own class