Reducing font size in equation

I wanted to type an equation in LaTeX. But it is too long to fit into one line. It involves big arrays with many columns so I cannot split it. I wanted to reduce the font size so that it can fit in one line. However, \small doesn't work in the equation environment.

• Can we see the actual equation? Perhaps we could then suggest some alternatives. – Gonzalo Medina Jun 19 '12 at 20:31
• Will \scriptstyle and \scriptscriptstyle work? – azetina Jun 19 '12 at 20:31
• as a last resort, just pack the whole thing into a \scalebox and shrink as much as necessary. rewriting as much as possible would be advisable first. – barbara beeton Jun 19 '12 at 20:38
• I agree with Gonzalo, don't scale unless nothing else can be done. If the equation is so large that scaling is needed, chances are that scaling the equation will not make it be more understandable for the reader. In most cases a rewrite is a better option. – daleif Jun 20 '12 at 14:49

5 Answers

The following illustrates font size alterations in mathmode:

\documentclass[letterpaper]{article}
\usepackage{graphicx}               % Necessary to use \scalebox
\usepackage{amsmath,amssymb}
\begin{document}
\noindent
normal: $x^2 + 2xy + y^2$\\
displaystyle: ${\displaystyle x^2 + 2xy + y^2}$\\
scriptstyle: ${\scriptstyle x^2 + 2xy + y^2}$\\
scriptscriptstyle: ${\scriptscriptstyle x^2 + 2xy + y^2}$\\
textstyle: ${\textstyle x^2 + 2xy + y^2}$

\noindent
\scalebox{0.5}{%
normal: $x^2 + 2xy + y^2$}
\end{document}


This yields:

Note that:

• \displaystyle gives the command to switch the math font size to normal size for displayed formulas.
• \textstyle is used to go back to normal size font for inline formulas.
• \scriptstyle is used to set the math font to a size used for subscripted and superscripted symbols.
• \scriptscriptstyle provides the normal size for doubly subscripted and superscripted symbols.

When using the \scalebox command from the graphicx package one can specify the width (or height) and the other dimension will be scaled proportionally. In a similar manner you can specify both dimensions, but in this case it is all about aesthetics. Therefore we have the following under the \scalebox command:

• \scalebox{h-dimension}{v-dimension}{content to be scaled}: both dimension stated.
• \scalebox{h-dimension}{content}: both arguments (h-dim and v-dim) scaled with respect to the stated dimension.
• I like this solution: no extra packages, no extra defined commands, short syntax. Yeah! +1 – loved.by.Jesus May 24 '16 at 15:04
• $\scriptstyle$ etc. not only changes the font size. It also affects how lines are broken. – BlenderBender Jun 23 '18 at 22:18
• When you use fractions within display math mode, the font size is automatically reduced... ...to what size? – Matsmath Oct 5 at 12:08

Just put \small before the equation and \normalsize after it if you want to shrink the font, but it's usually better to use an ams multi-line equation environment than to change font size.

It's actually easier to only do the part of a size change command that affects math without changing the baseline to avoid the problems @barabara-beeton mentions. This is a \tiny (5pt) equation in a \large paragraph text, to highlight the differences, and to show that the above and below display skips are not altered.

\documentclass{article}

\showoutput
\showboxdepth3

\begin{document}
\large

hghghga hghghga hghghga hghghga hghghga hghghga hghghga
hghghga hghghga hghghga hghghga hghghga hghghga hghghga
$$abc+xyz=44$$
bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb
bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb

hghghga hghghga hghghga hghghga hghghga hghghga hghghga
hghghga hghghga hghghga hghghga hghghga hghghga hghghga
\begingroup\makeatletter\def\f@size{5}\check@mathfonts
$$abc+xyz=44$$\endgroup
bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb
bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb

\end{document}


with AMS align this would produce:

\documentclass{article}
\usepackage{amsmath}

\showoutput
\showboxdepth3

\begin{document}
\large

hghghga hghghga hghghga hghghga hghghga hghghga hghghga
hghghga hghghga hghghga hghghga hghghga hghghga hghghga
\begin{align}
abc&+xyz&&=44\\
x&-y&&=2\\
a&+b&&=77
\end{align}
bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb
bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb

hghghga hghghga hghghga hghghga hghghga hghghga hghghga
hghghga hghghga hghghga hghghga hghghga hghghga hghghga
\begingroup\makeatletter\def\f@size{5}\check@mathfonts
\def\maketag@@@#1{\hbox{\m@th\large\normalfont#1}}%
\begin{align}
abc&+xyz&&=44\\
x&-y&&=2\\
a&+b&&=77
\end{align}\endgroup
bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb
bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb

\end{document}

• however, unless there's a paragraph break before the display, the baselines of the preceding paragraph will be fouled up, and if there is a blank line/pargraph break before the display, the vertical space preceding the display will be fouled up, and a page break would also be allowed because of the paragraph break. there's no good (automatic) mechanism defined for this yes, as far as i know. – barbara beeton Jun 19 '12 at 21:42
• @barbarabeeton yes I was going to mention that. If there were a MWE I'd have probably shown it with a correction for baselinskip. I suppose I should make one. It can't be that hard can it to insert a par while preserving the predispolay skip. – David Carlisle Jun 19 '12 at 22:15
• @barbarabeeton something like the code in the updated answer? – David Carlisle Jun 19 '12 at 23:08
• make it a 3-line display and i'll be happier. – barbara beeton Jun 20 '12 at 13:04
• @Clément \documentclass{article} \setlength\textwidth{7cm} \usepackage{amsmath} \begin{document} \Large\sloppy \def\aa{one two three four five six seven eight } \def\bb{\aa blue black red \aa\aa yellow pink black orange \aa} \bb\aa \begin{align} a+b+c &=1=2+3 \\ b+c &= z\\ c&=5 \end{align} \bb\aa % \everydisplay{\fontsize{7pt}{10pt}\selectfont}% % \aa \begin{align} a+b+c &=1=2+3 \\ b+c &= z\\ c&=5 \end{align} \bb \end{document} – David Carlisle Nov 3 '16 at 22:52

Similar to How to make math font huge, you can use \scalebox to scale down the equation, or \resizebox the box to a specific width to reduce the size. The first is the normal display mode equation, followed by the scaled version with \scalebox and \resizebox:

Code:

\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}
\newcommand*{\Scale}[2][4]{\scalebox{#1}{$#2$}}%
\newcommand*{\Resize}[2]{\resizebox{#1}{!}{$#2$}}%
\begin{document}
$y = \sin^2 x$
%
$\Scale[0.5]{y = \sin^2 x}$
%
$\Resize{1cm}{y = \sin^2 x}$
\end{document}

• Perhaps you could also mention \resizebox{\textwidth}{!}{...} to not have to guess scaling factors. – Gonzalo Medina Jun 19 '12 at 21:00
• And use \sin, please! :) – egreg Jun 19 '12 at 21:02
• @GonzaloMedina: Done. – Peter Grill Jun 19 '12 at 21:37
• @egreg: How embarrassing! Have corrected it. – Peter Grill Jun 19 '12 at 21:37
• @PeterGrill ;-) – egreg Jun 19 '12 at 21:38

If you want to change the size in the middle of an equation, you can try to change to text mode, change the size, an them retype in equation mode using .

Example:

$$A + B = \text{\footnotesize C + D} + E$$


Why nobody mentions the small environment?

\begin{small}
$x^2 + 2xy + y^2$
\end{small}

• Because it isn't an environment, it just works because, well. It just does, the internals never test, if \endsmall is def'ed. – Johannes_B Nov 12 '14 at 17:33
• @Johannes_B Not really:better to say the implementation of environments is explicitly coded to work whether or not the end code is defined. – David Carlisle Nov 12 '14 at 17:35
• Your small environment knows to behave in a very strange way, and should not be used. It is a (questionable) design choice that the \small command defined the small environment as well. Notice that you can use \begin{cite}{article123}\end{cite} instead of \cite{article123} and the effect will be almost the same, just it will have some strange consequences. – yo' Nov 12 '14 at 17:36
• Nobody mentioned it because it's wrong: see this picture for knowing why. I used footnotesize for making the effect more evident, but it's noticeable also with small. – egreg Nov 12 '14 at 17:42
• @TonyBetaLambda Did you look at the interline spacing above the equation? – egreg Nov 17 '14 at 15:31