1. Introduction

In this tutorial, we’ll describe how to scale an equation in LaTeX.

2. Why Scale an Equation?

LaTeX is a powerful text processor for creating high-quality and professional-looking documents. This tool makes writing easier and faster. LaTeX is suitable for many things, including creating simple and complex equations and drawing high-resolution figures.

Scaling down an equation means reducing its size, and scaling up means increasing it:

Scaled equations

There are many benefits to scaling. First, scaling up helps to highlight an important equation by making it stand out to attract attention.

Scaling down a long equation can adjust the spacing between it and the document’s margins. For instance, if we have an equation longer than the horizontal margin:

Rendered by QuickLaTeX.com

we can scale it down to make every part of the equation visible and within the document width:

Rendered by QuickLaTeX.com

Lastly, we can scale up a small equation to improve its readability.

3. How to Scale an Equation?

To scale an equation in LaTeX, we use the \resizebox command:

\resizebox{horizontal_length}{vertical_length}{custom_equation}

It has several parameters:

  • horizontal_length is the desired width
  • vertical_length is the desired height
  • custom_equation is the equation we want to scale (it must be in an equation environment)

Both horizontal_length and vertical_length can be specified in inches or centimeters. If either horizontal_length or vertical_length is specified as !, then LaTeX uses the other argument to determine the scale factor.

3.1. Scaling With Absolute Values

For example, let’s start with this equation:

Rendered by QuickLaTeX.com

We can set its width and height to 2.1in and 0.1in:
\resizebox{2.1in}{0.1in}{f(x) = \ln(1+b) \sum_{i=1}^{x}a_i}
which generates:

Rendered by QuickLaTeX.com

Here, we knew the width and height for scaling the equation. However, we may sometimes know the absolute value of only one dimension.

3.2. Scaling With the Exclamation Point

In such cases, we want the other dimension to be scaled proportionally. So we set it to ! in the \resizebox command to achieve that.

For example, setting horizontal_length to a numerical value (2.1 inches) and vertical_length to ! gives us:

Rendered by QuickLaTeX.com

The scaling factor used for height is the ratio of the new and old widths.

3.3. Scaling Only One Dimension

In some cases, we want to change only width or only height. To do so, we instruct LaTeX to keep the other dimension the same by setting the corresponding argument to \width or \height.

For example, we can make our equation 2.1 inches wide while keeping the original height:

\resizebox{2.1in}{\height}{f(x) = \ln(1+b) \sum_{i=1}^{x}a_i}

The output is:

Rendered by QuickLaTeX.com

The original height was kept, and only the width was changed.

3.4. Scaling With \textwidth

We usually want to set the equation’s width to a percentage of the total text width. To do so, we specify horizontal_length as p\textwidth, where p is the desired fraction (e.g., 0.5 or 0.2). For example:
\resizebox{0.2\textwidth}{!}{$f(x) = \ln(1+b)\sum_{i=1}^{x}a_i$}

This generates:

Rendered by QuickLaTeX.com

The result is that the equation is 0.5\textwidth wide while its height is scaled proportionally.

Similarly, we can increase or scale up the equation to cover the horizontal length of the document. Setting horizontal_length as 1.0\textwidth and vertical_length as ! in the above code would generate:

Rendered by QuickLaTeX.com

The equation has the width of the text area, and its height is proportional to it.

4. Limitations of Scaling an Equation

Scaling has its benefits, but we should also consider its limitations.

Scaling down an equation too much can reduce its readability, making it difficult to see all the symbols. For instance, if we set horizontal_length as 0.05\textwidth, the resulting equation will be too small:

Rendered by QuickLaTeX.com

Scaling equations can also lead to a visual inconsistency in our document if the horizontal and vertical lengths are not properly used:

Rendered by QuickLaTeX.com

Therefore, we should carefully set the parameters of \resizebox and use it only when necessary.

Another limitation of scaling is incompatibility with some LaTeX packages. Some LaTeX packages, including amsmath and graphicx, may have trouble with equations scaled using \resizebox.

5. Conclusion

In this article, we described how to scale an equation in LaTeX using \resizebox. Scaling down an equation is useful when we have limited space in a document. Scaling it up can improve its readability.