Skip to content
EasyLaTeXDocs

Font Sizes, Families, Styles, and Colors

Use size commands to establish a visual hierarchy, font families and styles to distinguish prose, terms, and code, and xcolor for a small set of meaningful colors. Let the document class or template determine the main body style.

EasyLaTeX compiler setting: pdfLaTeX; this page uses xcolor. PDF fonts are determined by the template and compilation settings, not by the editor's display font. For custom font files, choose a compatible platform engine such as LuaLaTeX or XeLaTeX and a template configuration that reads the uploaded project resource.

Relative Font Sizes

LaTeX provides sizes relative to the document's base size:

latex
{\small Smaller explanatory text}
{\large A larger subheading}
{\Large A larger heading}

Use braces to limit the scope. Set the body size globally with a class option such as \documentclass[12pt]{article}, rather than applying \fontsize to every paragraph.

Explicit Font Sizes

When a specification requires an exact size, \fontsize{size}{baseline}\selectfont sets the font size and baseline distance:

latex
{\fontsize{12}{14.4}\selectfont 12-point text}
{\fontsize{16}{19.2}\selectfont 16-point heading}

Sizes are measured in TeX points. Prefer the template's own size commands whenever available.

Font Families

Common family commands include:

latex
\textrm{Serif body text}
\textsf{Sans-serif interface label}
\texttt{monospace-code}

Use \texttt for short commands, filenames, and identifiers; put long code in a code environment. The PDF font depends on the project template and font resources available to platform compilation, not fonts installed on your own computer.

Combining Styles

Combine families with bold or italic where appropriate:

latex
\textbf{A bold conclusion}
\textit{English terminology}
\texttt{\textbf{warning}}

Not every font provides every weight or shape. If glyphs are missing or a style is substituted, fix the font configuration rather than stacking more style commands.

Defining and Using Colors

Load xcolor to use predefined colors or define a project color:

latex
\usepackage{xcolor}
\definecolor{noticeblue}{HTML}{1F5A94}

\textcolor{noticeblue}{Important information}
\colorbox{yellow!20}{A note on a light background}

Colors should identify links, warnings, or categories. Keep information distinguishable in grayscale and do not rely on color alone to convey an essential difference.

Common Problems

Size or Color Leaks into Following Text

Size commands and \color are declarations. Limit them with {...} or use \textcolor{color}{text}.

Color Replaces Document Structure

Color does not create a table of contents, numbering, or accessible hierarchy. Use heading commands such as \section, and emphasize important content with clear wording and appropriate styles.

Bold or Italic Looks Wrong

Check that the selected font has the required weight and shape, and inspect substitution warnings. Use emphasis purposefully rather than applying it to large passages.

Complete Example

latex
\documentclass[a4paper,12pt]{article}
\usepackage{xcolor}
\definecolor{noticeblue}{HTML}{1F5A94}

\begin{document}

{\fontsize{16}{19.2}\selectfont\textbf{Experiment Report}\par}

The body uses the base font size. {\small This is a smaller supplementary note.}

\textsf{Interface label}, \texttt{main.tex}  and 
\textcolor{noticeblue}{An important conclusion}  use different text styles.

\end{document}
Font Sizes, Families, Styles, and Colors | EasyLaTeX | EasyLaTeX