# Shrinking text to fit inside parentheses

I have a fraction written inside parentheses. Instead of increasing the size of the parentheses using \left( or \big(, I actually want the fraction to automatically shrink. (Specifically, I want it to resize so that it does not extend beyond the vertical bounds of the size of a default (.)

What is the simplest way to do this manually? And is there a rule I can implement at the top of my document so that this always happens automatically?

\documentclass{article}
\begin{document}
The symbol $(\frac{n^\alpha}{(1 + p)^n})$ is taller than the parentheses,
so it extends below and above them, which I don't want.
\end{document}

-
You can use \scalebox from the \graphicx package, or perhaps the relsize package. –  Peter Grill Mar 29 '12 at 14:51
Scaling down the box is really bad style and the text will be hardly readible, instead you should flatten your fraction $((n^\alpha)/(1 + p)^n)$ or use display equation, whatever fits better. –  Khaled Hosny Mar 29 '12 at 19:05

While I don't recommend it because it is really bad style, you could scale the content using \resizebox{!}{<height>}{..} or \scalebox{<factor>}{..} from the graphicx package. You might want to raise the baseline using \raisebox{<amount>}{..}.

\documentclass{article}
\usepackage{graphicx}
\usepackage{calc}
\begin{document}
The symbol $($\resizebox{!}{\heightof{$()$}}{$\frac{n^\alpha}{(1 + p)^n}$}$)$ is taller than the parentheses,
so it extends below and above them, which I don't want.

The symbol $($\raisebox{.1ex}{\resizebox{!}{1.4ex}{$\frac{n^\alpha}{(1 + p)^n}$}}$)$ is taller than the parentheses,
so it extends below and above them, which I don't want.

\end{document}


The adjustbox package can also be used to simplify the command, e.g. \adjustbox{height=<height>,raise=<amount>}{..}. Also try totalheight instead of height and see if the results fit better.

-
neat! hadn't thought of it as "graphic" material! –  Koji Mar 29 '12 at 14:53
@Koji: Usually you shouldn't ;-) –  Martin Scharrer Mar 29 '12 at 14:58
@Koji: Note that the scaling and resizing commands are needed to include images in a given size, so they are added to graphicx. They also work on other things like text or math. –  Martin Scharrer Mar 29 '12 at 14:58

My best shot would be $(\frac{\scriptscriptstyle n^\alpha}{\scriptscriptstyle(1 + p)^n})$, but that is also bigger that the regular parenthesis (besides looking horrible).

Would you consider $n^\alpha/(1+p)^n$?

-

On the off chance that your question is raised in the hopes of not needing to remember to use \left/\right/\bigs (or something), how about \def\pfrac#1#2{ {#1 \overwithdelims() #2} }? amsmath will nag though, but not error.

-