latex

# How to Modify the Font Size in LaTex

LaTex is intelligent when it comes to choosing the appropriate font and font size. However, there are instances where you may need to implement a specific font or font size.

This tutorial will discuss how to work with and modify fonts and styling in LaTex documents.

## How to Set the Font Size

The easiest way to change the font size in LaTex documents is to use pre-defined commands.

The following commands are used to set the font size in LaTex.

• \tiny – Smallest size between 5 and 6 points
• \scriptsize – Ranges between 7 and 8 points
• \footnotesize – Size between 8 to 10 points
• \small – Smaller font with the size of 9 to 10.95 points
• \normalsize – Normal font size between 10 12 points
• \large – Font size between 12 to 14.44 points
• \Large – Large fonts size ranges from 14.4 to 17.28 points
• \LARGE – Size ranges between 17.28 to 20.74 points
• \huge – A large font between 20.74 to 24.88 points
• \Huge – Massive font above 24.88 point

NOTE: The size values above apply to selected documents such as an article, book, report, and letter. Other documents such as memoirs may have varying font sizes.

## Examples:

The following code illustrates various font size commands:

\documentclass{article}
\usepackage[utf8]{inputenc}
\begin{document}
Foo bar {\tiny and Hello, world!} \\
Foo bar {\scriptsize and Hello, world!} \\
Foo bar {\footnotesize and Hello, world!} \\
Foo bar {\small and Hello, world!} \\
Foo bar {\normalize and Hello, world!} \\
Foo bar {\large and Hello, world!} \\
Foo bar {\Large and Hello, world!} \\
Foo bar {\LARGE and Hello, world!} \\
Foo bar {\huge and Hello, world!} \\
Foo bar {\Huge and Hello, world!} \\
\end{document}

The rendered font sizes are as follows:

You can also use custom LaTex packages. However, that is beyond the scope of this article. Therefore, it is not illustrated. Check the font size package to learn more.

## How to Change Font Family in LaTeX

Changing the font family in LaTex is easy. First, use default commands that include:

• \textrm – Serif font family
• \texttt – Monospaced font family
• \textsf – Sans Serif font family

## Examples:

The following LaTex code illustrates various font families:

\documentclass{article}
\usepackage[utf8]{inputenc}
\begin{document}
\huge\textrm{Foo Bar – Serif } \\
\huge\texttt{Foo Bar - Monospaced} \\
\huge\textsf{Foo Bar – Sans Serif}
\end{document}

Here is an illustration of the resulting text results:

LaTex also provides you various commands to set a block of text to specific text. For example:

\documentclass{article}
\usepackage[utf8]{inputenc}
\begin{document}

\rmfamily
All the text below this command  uses serif font until terminated.
\rmfamily
\newline

\sffamily
This block uses sans serif fonts until here
\ssfamily
\newline

\newline
\ttfamily
Monospaced font family goes here until you terminate it
\ttfamily
\end{document}

The above produces the content shown below:

## How to Work With Font Styles in LaTeX

The following are the commands for font styles:

• \textmd – Medium Text
• \textbf – Bold Text
• \textup – Upright Text
• \textit – Italicized text
• \textsl – Slanted text
• \textsc – All caps.

## Examples:

The following code shows the usage of font style commands in LaTex:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\begin{document}
\textmd{I am Medium Text} \\
\textbf{I am Bold Text} \\
\textup{I am Upright Text} \\
\textit{I am Italicized Text} \\
\textsl{For me, I am Slanted} \\
\textsc{I am all caps} \\
\end{document}

The resulting text is:

## Conclusion

This tutorial shows you how to work with font size, font family, and font style in LaTex documents.