How to change font size latex
How to change font size latex
Font sizes, families, and styles
Contents
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:
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.
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:
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:
Similarly, for using roman font as a default:
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.
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.
Changing the font size in LaTeX
Changing the font size in LaTeX can be done on two levels, either affecting the whole document or parts/elements of it. Using a different font size on a global level will affect all normal-sized text as well as the size of headings, footnotes, etc. By changing the font size locally, however, a single word, a few lines of text, a large table or a heading throughout the document may be modified.
Changing the font size on a document-wide level
The standard classes, article, report and book support 3 different font sizes, 10pt, 11pt, 12pt (by default 10pt ). The font size is set through the optional argument, e.g.:
In most cases, the available font sizes for the standard classes are sufficient.
Other font sizes
The documentclass names are slightly different from the standard classes:
The KOMA-script and memoir class
The KOMA-script and memoir classes are more flexible when it comes to font sizes. Please see the documentation for more details.
Changing the font size locally
LaTeX knows several font size modifier-commands (from biggest to smallest):
A table of the exact font sizes in points can be found on wikibooks.
A good rule of thumb is don’t use too many different sizes and don’t make things too small/big.
There are two possible ways to use these font size modifier commands, inline or as environment:
A few more options
Note: The figure is scaled and therefore does not show the actual font size. It illustrates the difference between the font sizes.
Still not enough?
Here is alternative, more flexible approach. The anyfontsize package scales the next bigger/smaller font size available to whatever size you like.
The two arguments to \fontsize are the actual font size and the size of the baseline-skip. The baseline-skip should be set to roughly 1.2x the font size.
That’s more like it! Again, this only works with a non-standard font type. And again, it does not show the actual font size. Try it with LaTeX!
LaTeX font size
LaTeX font size
Note: Other documentclasses have other default font sizes!
For example documentclass memoir has 12 font sizes:
9pt, 10pt, 11pt, 12pt, 14pt, 17pt, 20pt, 25pt, 30pt, 36pt, 48pt and 60pt
Or the beamer class for presentation has 8 font sizes:
8pt, 9pt, 10pt, 11pt, 12pt, 14pt, 17pt and 20pt.
1.1 change font size
The font size of single words, paragraphs or the whole text can be changed. By the following ten commands:
\tiny | \large |
\scriptsize | \Large |
\footnotesize | \LARGE |
\small | \huge |
\normalsize | \Huge |
How to change the size of a word:
How to change the size of an area: example
output:
This part should be smaller then the rest of the document.
the commands could be used as a switcher:
example
text before \huge after |
output: text before after
The effect of these commands is as long as is until the next command or the document is finished. For example, to switch back to the normal font size, then you have to add a \normalsize.
The following table shows the changes in font size depending on the selected standard font size (article, report, book und letter):
standard font size | |||
command | 10pt | 11pt | 12pt |
\tiny | 5pt | 6pt | 6pt |
\scriptsize | 7pt | 8pt | 8pt |
\footnotesize | 8pt | 9pt | 10pt |
\small | 9pt | 10pt | 11pt |
\normalsize | 10pt | 11pt | 12pt |
\large | 12pt | 12pt | 14pt |
\Large | 14pt | 14pt | 17pt |
\LARGE | 17pt | 17pt | 20pt |
\huge | 20pt | 20pt | 25pt |
\Huge | 25pt | 25pt | 25pt |
Advertisement
The documentclass memoir has two additional size commands:\miniscule which is smaller then \tiny and \HUGE which is bigger then \Huge.
standard font size | ||||||||||||
command | 9pt | 10pt | 11pt | 12pt | 14pt | 17pt | 20pt | 25pt | 30pt | 36pt | 48pt | 60pt |
\miniscule | 4pt | 5pt | 6pt | 7pt | 8pt | 9pt | 10pt | 11pt | 12pt | 14pt | 17pt | 20pt |
\tiny | 5pt | 6pt | 7pt | 8pt | 9pt | 10pt | 11pt | 12pt | 14pt | 17pt | 20pt | 25pt |
\scriptsize | 6pt | 7pt | 8pt | 9pt | 10pt | 11pt | 12pt | 14pt | 17pt | 20pt | 25pt | 30pt |
\footnotesize | 7pt | 8pt | 9pt | 10pt | 11pt | 12pt | 14pt | 17pt | 20pt | 25pt | 30pt | 36pt |
\small | 8pt | 9pt | 10pt | 11pt | 12pt | 14pt | 17pt | 20pt | 25pt | 30pt | 36pt | 48pt |
\normalsize | 9pt | 10pt | 11pt | 12pt | 14pt | 17pt | 20pt | 25pt | 30pt | 36pt | 48pt | 60pt |
\large | 10pt | 11pt | 12pt | 14pt | 17pt | 20pt | 25pt | 30pt | 36pt | 48pt | 60pt | 72pt |
\Large | 11pt | 12pt | 14pt | 17pt | 20pt | 25pt | 30pt | 36pt | 48pt | 60pt | 72pt | 84pt |
\LARGE | 12pt | 14pt | 17pt | 20pt | 25pt | 30pt | 36pt | 48pt | 60pt | 72pt | 84pt | 96pt |
\huge | 14pt | 17pt | 20pt | 25pt | 30pt | 36pt | 48pt | 60pt | 72pt | 84pt | 96pt | 108pt |
\Huge | 17pt | 20pt | 25pt | 30pt | 36pt | 48pt | 60pt | 72pt | 84pt | 96pt | 108pt | 120pt |
\HUGE | 20pt | 25pt | 30pt | 36pt | 48pt | 60pt | 72pt | 84pt | 96pt | 108pt | 120pt | 132pt |
The documentclass beamer class
standard font size | ||||||||
command | 8pt | 9pt | 10pt | 11pt | 12pt | 14pt | 17pt | 20pt |
tiny | 5pt | 5pt | 5pt | 6pt | 6pt | 6pt | 8pt | 10pt |
scriptsize | 5pt | 6pt | 7pt | 8pt | 8pt | 8pt | 10pt | 12pt |
footnotesize | 6pt | 7pt | 8pt | 9pt | 10pt | 10pt | 12pt | 14pt |
small | 7pt | 8pt | 9pt | 10pt | 11pt | 12pt | 14pt | 17pt |
normalsize | 8pt | 9pt | 10pt | 11pt | 12pt | 14pt | 17pt | 20pt |
large | 10pt | 10pt | 12pt | 12pt | 14pt | 17pt | 20pt | 25pt |
Large | 11pt | 11pt | 14pt | 14pt | 17pt | 20pt | 25pt | 29.86pt |
LARGE | 12pt | 12pt | 17pt | 17pt | 20pt | 25pt | 29.86pt | 35.83pt |
huge | 14pt | 14pt | 20pt | 20pt | 25pt | 29.86pt | 35.83pt | 42.99pt |
Huge | 17pt | 17pt | 25pt | 25pt | 25pt | 35.83pt | 42.99pt | 51.59pt |
1.2 other font size
By using the default classes and sizes, one can use 12 different font sizes: 5pt, 6pt, 7pt, 8pt, 9pt, 10pt, 11pt, 12pt, 14pt, 17pt, 20pt and 25pt.
To use more, one need first To use more font sizes, you first need a font in which has the desired size, i.e. not all fonts allow all sizes. If you use a size which is not provided by the font, you get an error message like this:
This means that the desired size is not available and the closest matching size is 4.17pt (points) away from the desired one.
1.2.1 command to change font size
First, use a font like lmodern and then you can set the font size:
<\fontsize
How do I change the default font size?
How can I change the default font size throughout the LaTeX document? Is this even possible?
3 Answers 3
at least some document classes provide an optional argument to do this. for example,
will provide a changed set of font sizes ( \footnotesize will be smaller, for example) in a coherent style.
If your using KOMA-Script use the option fontsize= to set a size that may differ from the above three.
To change the size of the main font only try \fontsize< >< >\selectfont but this is not a real user command so one should know what he does when using it 😉
You can change the main font size and the other font sizing commands (as long as the font is scalable) through the fontsize package.
The fontsize package option
The most basic way is to use the fontsize option which automatically sets the line spacing:
The \changefontsize command
If you need precise line spacing you can use the \changefontsize command:
Here is a minimal working example. The normal size and the normal line spacing are set to 11pt and 12.75pt respectively:
Printing samples
The values of the font sizing commands can be obtained with the \printsamples command:
prints the values of the font size and line spacing for all the sizes defined by the package.
prints the values of the font size and line spacing for all the sizes declared in the optional argument.
Here is a minimal working example with the Cochineal font:
LaTeX/Fonts
Help and Recommendations
Contents
Font families [ edit | edit source ]
By default, LaTeX uses Computer Modern, a family of typefaces designed by Donald Knuth for use with TeX. It contains serif, sans serif, and monospaced fonts, each available in several weights and optical sizes.
The bodies of LaTeX documents are set in Roman (serif) type by default, but this can be changed by setting the family default:
where is any of the following:
Emphasizing text [ edit | edit source ]
In order to add some emphasis to a word or a phrase, use the \emph < text >command, which usually italicizes the text. Italics may be specified explicitly with \textit < text >.
I want to emphasize a word.
Note that the \emph command is dynamic: if you emphasize a word which is already in an emphasized sentence, it will be reverted to the upright font.
In this emphasized sentence, there is an emphasized word which looks upright.
Text may be emphasized more heavily through the use of boldface, particularly for keywords the reader may be trying to find when reading the text. As bold text is generally read before any other text in a paragraph or even on a page, it should be used sparingly. It may also be used in place of italics when using sans-serif typefaces to provide a greater contrast with unemphasized text. Bold text can be generated with the \textbf < text >command.
Bold text may be used to heavily emphasize very important words or phrases.
Font styles [ edit | edit source ]
Typefaces usually come in various styles and weights, such as italic and bold. The following table lists the commands you will need to access typical font shapes.
Note: Paragraph breaks are not allowed inside the command forms.
Generally, one should prefer the commands over their equivalent switches because the former automatically corrects spacing immediately following the end of the selected style.
Sizing text [ edit | edit source ]
Built-in sizes [ edit | edit source ]
To scale text relative to the default body text size, use the following commands:
Command | Output |
---|---|
\tiny | sample text |
\scriptsize | sample text |
\footnotesize | sample text |
\small | sample text |
\normalsize | sample text |
\large | sample text |
\Large | sample text |
\LARGE | sample text |
\huge | sample text |
\Huge | sample text |
By default, \normalsize is 10 points, but this can be changed in the \documentclass declaration, e.g. \documentclass [12pt] < article >. Note that not every document class has unique sizes for all of the above size commands.
size | standard classes (except slides), beamer | AMS classes, memoir | slides | ||||
---|---|---|---|---|---|---|---|
[10pt] | [11pt] | [12pt] | [10pt] | [11pt] | [12pt] | ||
\tiny | 5 | 6 | 6 | 6 | 7 | 8 | 13.82 |
\scriptsize | 7 | 8 | 8 | 7 | 8 | 9 | 16.59 |
\footnotesize | 8 | 9 | 10 | 8 | 9 | 10 | 16.59 |
\small | 9 | 10 | 10.95 | 9 | 10 | 10.95 | 16.59 |
\normalsize | 10 | 10.95 | 12 | 10 | 10.95 | 12 | 19.907 |
\large | 12 | 12 | 14.4 | 10.95 | 12 | 14.4 | 23.89 |
\Large | 14.4 | 14.4 | 17.28 | 12 | 14.4 | 17.28 | 28.66 |
\LARGE | 17.28 | 17.28 | 20.74 | 14.4 | 17.28 | 20.74 | 34.4 |
\huge | 20.74 | 20.74 | 24.88 | 17.28 | 20.74 | 24.88 | 41.28 |
\Huge | 24.88 | 24.88 | 24.88 | 20.74 | 24.88 | 24.88 | 41.28 |
Points in TeX follow the standard American point system in which 1 pt is approximately 0.3513 6 mm. The standard point size used in most modern computer programs (known as the desktop publishing point or PostScript point) has 1 pt equal to approximately 0.352 7 mm while the standard European point size (known as the Didot point) had 1 pt equal to approximately 0.37597151 mm (see: point (typography)).
Arbitrary sizes [ edit | edit source ]
sets the current font size to 5cm with 5.5 centimeter leading.
If you are using the latex or pdflatex engines, you may get a warning similar to the following:
Using alternative fonts [ edit | edit source ]
Using TTF and OTF fonts [ edit | edit source ]
If you are using lualatex or xelatex, you can use TTF and OTF fonts with the fontspec package:
The fontspec package is extremely configurable. See the manual [3] for details, but some basics are covered below.
Selecting font files [ edit | edit source ]
Different weights and styles of a given typeface are usually stored as separate font files. A typical typeface might offer four files to represent its normal weight, italics, bold, and bold italics. Given a typefaces’s name, fontspec can generally deduce the names of the individual files. However, many typefaces come in more than two weights—some versions of Futura, for example, comes in light, book, medium, demi, bold, and extra bold weights. Sometimes small caps are stored as separate files as well.
We might want to hand-pick weights to achieve a certain look or better match the weights of other fonts in our document. Continuing to use Futura as an example, say we want to use the «book» weight for our default weight, «demi» for bold, and the font files are named:
Our font setup might resemble:
Note that instead of typing out Futura-Boo, Futura-BooObl, and so on, we can use * to insert the base name.
Controlling font features [ edit | edit source ]
The OpenType (OTF) format allows type designers to embed font features that can be turned on and off, such as:
All of these features can be turned on and off using different fontspec options. If we wanted to set our body text in Linux Libertine with oldstyle, proportionally-spaced figures, for example, we might set up our fonts as follows:
Changing fonts in latex and pdflatex [ edit | edit source ]
If you are not using one of the Unicode-aware engines, font selection is more complicated. (See the discussion of encoding below.) Useful resources for latex and pdflatex font configuration include:
Font encoding [ edit | edit source ]
Digitising human language is a complicated topic that has evolved significantly since TeX’s inception.
Unicode [ edit | edit source ]
Today, text is usually represented in computer systems using Unicode. Briefly,
LuaLaTeX and XeLaTeX use these tools to render Unicode-encoded input files (LuaLaTeX accepts UTF-8 files, while XeLaTeX is a bit more flexible and also accepts UTF-16 and UTF-32) into PDF documents.
TeX encodings [ edit | edit source ]
The original TeX and LaTeX, designed long before the advent of Unicode, use a very different scheme. When using latex or pdflatex, you must choose an input encoding, which the engine uses to interpret your file, and an output encoding, which the engine uses to map your inputs to glyphs. The default font encoding is OT1, the encoding of the original Computer Modern fonts. It contains only 128 characters, many from ASCII, but leaving out some others and including a number that are not in ASCII. When accented characters are required, TeX creates them by combining a normal character with an accent. While the resulting output looks correct, this approach has some caveats compared to Unicode-based approaches:
To overcome these shortcomings, several other 8-bit output encodings were created. Extended Cork (EC) fonts in T1 encoding contains letters and punctuation characters for most European languages that use Latin alphabets. The LH font set contains letters necessary to typeset documents in languages using Cyrillic script. Because of the large number of Cyrillic glyphs, they are arranged into four font encodings—T2A, T2B, T2C, and X2. The CB bundle contains fonts in LGR encoding for the composition of Greek text. By using these fonts you can improve/enable hyphenation in non-English documents. Another advantage of using new CM-like fonts is that they provide fonts of CM families in all weights, shapes, and optically scaled font sizes.
All this is not possible with OT1; that’s why you may want to change the font encoding of your document.
Note that different fonts support different output encodings. The default Computer Modern font does not support T1, for example. You will need Computer Modern Super ( cm-super ) or Latin Modern ( lmodern ), which are Computer Modern-like fonts with T1 support. If you have none of these, it is quite frequent (depends on your TeX installation) that tex chooses a Type3 font such as the Type3 EC, which is a bitmap font. Bitmap fonts look rather ugly when zoomed or printed.
The fontenc package tells LaTeX what font encoding to use. Font encoding is set with:
where encoding is the font encoding. It is possible to load several encodings simultaneously.
There is nothing to change in your document to use CM Super fonts (assuming they are installed), they will get loaded automatically if you use T1 encoding. For lmodern, you will need to load the package after the T1 encoding has been set:
The package ae (almost European) is obsolete. It provided some workarounds for hyphenation of words with special characters. These are not necessary any more with fonts like lmodern. Using the ae package leads to text encoding problems in PDF files generated via pdflatex (e.g. text extraction and searching), besides typographic issues.
PDF fonts and properties [ edit | edit source ]
PDF documents have the capability to embed font files. It makes them portable, hence the name Portable Document Format.
Many PDF viewers have a Properties feature to list embedded fonts and document metadata.
Many Unix systems make use of the poppler tool set which features pdfinfo to list PDF metadata, and pdffonts to list embedded fonts.