# Setting a single equation in a paragraph in a smaller font

I'm trying to figure out the best way of making a single equation just a little bit smaller. Of course, I could try and break up the equation into pieces and proceed that way, but I'd like to understand the best way to accomplish this task. Here's the problem:

\documentclass{article}
\begin{document}
Here is a bunch of text that I'm writing for no good reason.
The overall purpose is to demonstrate how to make an equation
set in a different font size from the surrounding paragraph
without messing up the spacing, like we do here:
{\footnotesize $f(x) = g(x)$ }
with an equation set as \verb#{ \footnotesize $f(x) = g(x)$}#
\end{document}


This results in a terribly scrunched looking paragraph, because the \footnotesize command changes the baseline, I believe.

How do I avoid this?

-
Why do you want to resize the equation. Changing the type size isn't considered good practice. Perhaps you can break the equation? – Marc van Dongen Feb 22 '12 at 1:12
Let me add to Marc's comment the following observation: If you're pressed for space while typesetting a long displayed formula, rather than finding a way to set the entire formula in a smaller fontsize -- \footnotesize is roughly 20% (linearly) smaller than \normalize!, and is probably already pushing the limits of readability of anything but an utterly trivial formula -- you should consider decreasing the amount of whitespace inserted around operators of type mathbin (e.g., + and -) and mathrel (e.g., =). Small adjustments of these parameters won't harm legibility at all. – Mico Feb 22 '12 at 2:03
There are a lot of relevant suggestions here. – rdhs Feb 22 '12 at 2:17

## 6 Answers

Use the math fontsize commands \scriptstyle, \scriptscriptstyle ?

\documentclass{article}
\begin{document}
Here is a bunch of text that I'm writing for no good reason. The overall
purpose is to demonstrate how to make an equation set in a different font size
from the surrounding paragraph without messing up the spacing, like we do here:
$\scriptstyle f(x) = g(x)$  with an equation set as
\verb#{\footnotesize $f(x) = g(x)$}#
\end{document}

-
\scriptstyle changes too many of the other spacing aspects. Compare $\scriptstyle \int_0^1 \sum_{i=1}^k f(x) = g(x)$ to $\int_0^1 \sum_{i=1}^k f(x) = g(x)$ The equal sign doesn't have enough space around it, the limits are in the wrong location, etc. – dgleich Feb 23 '12 at 0:17

This might work (still looks odd though)

\documentclass{article}
\parskip2\baselineskip

\begin{document}
\showoutput
Here is a bunch of text that I'm writing for no good reason.
The overall purpose is to demonstrate how to make an equation
set in a different font size from the surrounding paragraph
without messing up the spacing, like we do here:
\par\nobreak{\parskip0pt \footnotesize \noindent$f(x) = g(x)$}%
with an equation set as \verb#{ \footnotesize $f(x) = g(x)$}#

\end{document}

-
please add \nobreak after \par so there can't be a page break just before the display. (if you put \vspace*{39pc} at the top instead of \showoutput you'll see what i mean.) tsk. – barbara beeton Feb 22 '12 at 19:34
This one seems to work a little a little bit better: \par\nobreak{\parskip0pt \noindent \parbox{\linewidth}{\footnotesize $f(x) = g(x)$}} – dgleich Feb 23 '12 at 0:29

rather than changing the font size, you might consider using \scalebox from the graphicx package. in this example, the scaling factor is ridiculously small to demonstrate that the baseline spacing isn't fouled up. however, unless you really must, shrinking displays is much less preferable than reformulating them (e.g., to use more lines) so they can be read easily.

\documentclass{article}
\usepackage{graphicx}
\begin{document}
Here is a bunch of text that I'm writing for no good reason.
The overall purpose is to demonstrate how to make an equation
set in a different font size from the surrounding paragraph
without messing up the spacing, like we do here:
$\scalebox{.3}{\displaystyle f(x) = g(x)}$
with an equation set as \verb#$\scalebox{.3}{\displaystyle f(x) = g(x)}$#
\end{document}


-

Use the adjustbox package. You can have it scale your equation so that it just fits into the \textwidth.

\begin{adjustbox}{width=\textwidth,totalheight=\textheight,keepaspectratio}
%Equation goes here.
\end{adjustbox}

-

For a single equation without one can do with

$\mbox{\small\displaystyle long equation }$

-

Changing font size and trying to fit a very long formula on one line is not going to benefit readability. However, there is a way to fit slightly more math in a line without changing font size: by sacrificing good spacing. Using @Mico's idea, we decrease the amount of space that TeX inserts between objects in math mode:

\documentclass{article}

\begin{document}

$x+y=5, x-y=1$

\begingroup
\thinmuskip=1mu
\medmuskip=2mu minus 2mu
\thickmuskip=3mu
$x+y=5, x-y=1$
\endgroup

\end{document}


The default definitions of the skips are

\thinmuskip=3mu
\medmuskip=4mu plus 2mu minus 4mu
\thickmuskip=5mu plus 5mu


I omitted the plus components because I do not expect the formula to stretch.

-