The Ins And Outs Of Non-Standard Font Sizes In Latex

LaTeX allows users great flexibility in specifying font sizes for both text and mathematical formulas. While the default font size is 10pt, LaTeX provides straightforward methods for changing the font size for entire documents, specific sections of text, or math formulas. This article will explore the ins and outs of using non-standard font sizes in LaTeX documents, including how to set sizes, best practices, and troubleshooting issues that may arise.

Default Font Size in LaTeX

The default font size used by LaTeX for normal body text is 10pt. This size is set by the document class used when the document is compiled. The standard \documentclass options, such as article or book, define 10pt as the normalsize. This font size will be used for all regular text in the document that does not have a specific font size set.

Setting Font Size for the Entire Document

To change the base font size used throughout an entire document, the font size option can be passed as an argument to the \documentclass command. For example, to set all regular body text to use a 12pt font size, the document class would be specified as:

\documentclass[12pt]{article}

This will set 12pt as the normalsize base font size used for all regular text in the document. Specifying a font size option in the \documentclass in this manner is the recommended approach for globally changing font size.

Changing Font Size for Text Blocks

LaTeX also allows locally overriding the font size used for specific sections of text, paragraphs, or blocks. This is done using font size declaration commands. For example, to set a section of text to be displayed in a huge 24pt font size, the {\huge ...} command can be used:

{\huge This text will be displayed in a 24pt font size}

Font size commands can be nested to get relatively larger or smaller sizes. For example:

{\large This text is large (14pt) 
{\huge while this text is huge (24pt)}
and this text returns to large}

Common font size commands include:

  • \tiny - 6pt size
  • \scriptsize - 7pt size
  • \footnotesize - 8pt size
  • \small - 9pt size
  • \normalsize - 10pt size (base document size)
  • \large - 12pt size
  • \Large - 14pt size
  • \LARGE - 17pt size
  • \huge - 20pt size
  • \Huge - 25pt size

Nesting the declarations allows switching between different sizes quickly within a block of text.

Changing Font Size for Math Formulas

In mathematical formulas and expressions, LaTeX adjusts font sizes automatically depending on context using a nested hierarchy of sizes. However, explicit font size commands can also be used to override the default math sizes.

The \displaystyle command forces the size used for fractions and nested formulas to be the same as the surrounding text:

\[ \displaystyle \frac{x+1}{x-1} \]

Additionally, the \scriptstyle and \scriptscriptstyle size commands can be used as a math-mode equivalent of \small and \tiny sizes:

\[ x = \frac{1+\scriptstyle\frac{1}{2}}{y} \]

Which renders as:
\[ x = \frac{1+\scriptstyle\frac{1}{2}}{y} \]

With \scriptscriptstyle being an even smaller size. These commands give manual control over the font size hierarchy in math mode formulas.

Custom Font Sizes with Packages

Some packages like extsizes also exist for defining custom font size commands if the preset sizes are insufficient. This package can be imported in the document preamble and then used to create new size commands.

For example, adding:

\usepackage{extsizes}
\newcommand\xxlarge{\@setfontsize\xxlarge{18}{20}}

Will allow using \xxlarge for an 18pt font size in the document body.

Custom sizes like this can help fill in gaps between standardized sizes or provide commonly used font sizes not otherwise available by default in LaTeX.

When Font Size Changes Cause Problems

Most font size adjustments in LaTeX work seamlessly, however in some cases the changes can cause unintended formatting issues. The most common problems are:

  • Overfull boxes - This refers to text that spills outside the expected margin of the page. It typically occurs when a large font size causes a paragraph to take up more space than available in the column width.
  • Inconsistent spacing - Drastic font size changes may interact poorly with the spacing algorithms LaTeX uses, sometimes causing irregular gaps in paragraphs.
  • Font substitutions - If an adjusted font size isn't available in the font being used, LaTeX will automatically substitute the closest available size. This may cause inconsistencies.

Minor tweaks like adjusting margins or allowing font substitution can typically resolve most issues stemming from font size changes. Identifying paragraphs with bad breaks or spacing is key to troubleshooting problems.

Tools like overfull-hbox indicators can help debug alignment and fitting problems arising from font size adjustments. Getting familiar with these tools is useful when working extensively with typesetting size adjustments.

Leave a Reply

Your email address will not be published. Required fields are marked *