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.
- 6,228
- 2,921
6 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:
\displaystylegives the command to switch the math font size to normal size for displayed formulas.\textstyleis used to go back to normal size font for inline formulas.\scriptstyleis used to set the math font to a size used for subscripted and superscripted symbols.\scriptscriptstyleprovides 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-dimandv-dim) scaled with respect to the stated dimension.
- 757,742
- 28,884
-
2$\scriptstyle$ etc. not only changes the font size. It also affects how lines are broken. – BlenderBender Jun 23 '18 at 22:18
-
2When you use fractions within display math mode, the font size is automatically reduced... ...to what size? – Matsmath Oct 05 '19 at 12:08
-
The command
\scriptstyleworked so well, it can be applied to only part of the equation and it only decrease the font size, doing nothing else. Thanks! – zyy May 01 '20 at 02:40 -
somehow
\scriptstylereduces the font of only the first symbol following it inside analign, is that behavior expected? – xealits Oct 27 '20 at 11:59 -
-
@xealits Yes it is the expected behavior: each & or \ require a new size – Ernesto Iglesias May 18 '22 at 16:25
-
@ErnestoIglesias Any way to make
\scriptystyleholds for an entirealignenvironment instead of only for one side of an=side for example? – Hermi Sep 06 '23 at 13:29
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}
- 757,742
-
3however, 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 3 line display added, so you should be happy, but I guess you wanted tighter line spacing in the display? – David Carlisle Jun 20 '12 at 13:58
-
yes, i'm happier now -- all the ramifications are visible. thank you. and yes, for the smallified display, i see two things that bother me (actually three, but i'll ignore the unaligned = signs). you've identified the first (the vertical spacing), but what's done there depends on the second: the equation numbers shouldn't change size. (we've got a fix for that, already in place in-house. too complicated to show the code in a comment.) this problem is on our list, but we haven't yet found a foolproof solution, and will keep looking for ideas. – barbara beeton Jun 20 '12 at 19:25
-
-
@DavidCarlisle: Adding
\smallbefore the equation doesn't work unless you precede with a\par(otherwise it shrinks the preceding paragraph's line spacing)… but I just learned from you in http://tex.stackexchange.com/questions/337104/where-does-the-space-before-align-come-from that it was wrong to add that\par… so how do you actually change the size (including the tighter line spacing in the math itself)? – Clément Nov 03 '16 at 22:08 -
@Clément with difficulty:-) best to ask that as a new question I think, also depends whether you need to allow page breaking (as that stops some simplifications like doing the small text inside a parbox) – David Carlisle Nov 03 '16 at 22:14
-
1@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 03 '16 at 22:52 -
I always find Your solution simple and efficient. Really grateful to You – MAzharul Islam Dec 12 '21 at 15:38
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}
- 223,288
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:
\begin{equation}
A + B = \text{\footnotesize $C + D$} + E
\end{equation}
Why nobody mentions the small environment?
\begin{small}
\[ x^2 + 2xy + y^2 \]
\end{small}
- 259,911
- 34
- 706
- 1,036
- 320
-
8Because it isn't an environment, it just works because, well. It just does, the internals never test, if
\endsmallis def'ed. – Johannes_B Nov 12 '14 at 17:33 -
2@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
-
-
1Your
smallenvironment knows to behave in a very strange way, and should not be used. It is a (questionable) design choice that the\smallcommand defined thesmallenvironment 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 -
@Johannes_B yes (although has to be used with care, tricky to get white space correct when doing this, with any environment not just
small) – David Carlisle Nov 12 '14 at 17:42 -
5Nobody mentioned it because it's wrong: see this picture for knowing why. I used
footnotesizefor making the effect more evident, but it's noticeable also withsmall. – egreg Nov 12 '14 at 17:42 -
1
-
3@TonyBetaLambda Did you look at the interline spacing above the equation? – egreg Nov 17 '14 at 15:31
-
First, put the following code in the preamble:
\newcommand\scalemath[2]{\scalebox{#1}{\mbox{\ensuremath{\displaystyle #2}}}}
Then you can change the size of your equation using \scalemath as follows:
$$\scalemath{2}{sin(x)^2 + cos(x) + x^2}$$
$$\scalemath{1}{sin(x)^2 + cos(x) + x^2}$$
$$\scalemath{0.8}{sin(x)^2 + cos(x) + x^2}$$
$$\scalemath{0.6}{sin(x)^2 + cos(x) + x^2}$$
$$\scalemath{0.4}{sin(x)^2 + cos(x) + x^2}$$
$$\scalemath{0.2}{sin(x)^2 + cos(x) + x^2}$$
\[
\scalemath{0.7}{
sin(x)^2 + cos(x) + x^2
}
\]
- 101


\scaleboxand shrink as much as necessary. rewriting as much as possible would be advisable first. – barbara beeton Jun 19 '12 at 20:38