# How to reduce font size in equation for text

I have a slide in my beamer presentation that looks like:

\documentclass{beamer}
\begin{document}
\begin{frame}
$$y= 1/x \qquad \scriptscriptstyle {\mbox{For}~ x>0}$$
$$y= 1/x \qquad \scriptscriptstyle {\mbox{For}}~ x>0$$
$$y= 1/x \qquad \mbox{For}~ \scriptscriptstyle {x>0}$$
\end{frame}
\end{document}


To save space, I want to reduce the size of $\mbox{For}~ x>0$ with \scriptscriptstyle but all the three ways of using this command give me the same result only $x>0$ is re-sized. Is the command \mbox the problem?

Yes, the \mbox content is not influenced by the layout you define outside. To achieve what you are looking for you can use \text instead of \mbox.
Furthermore, do not use $$...$$, but $...$ or \begin{equation*}...\end{equation*}, see this question. And I think the space after the protected space ~ should not be there.

\documentclass{beamer}
\begin{document}
\begin{frame}
\begin{equation*}
\end{equation*}
\end{frame}
\end{document}

• Thanks for your help! P.S. The protected space ~ is not anymore required when we replace \mbox by \text. Sep 28 '15 at 18:57

The \mbox macro, as you've discovered, isn't sufficiently aware of the surrounding font size. I suggest you (a) use \text (rather than \mbox) to encase both the word "for" and the formula $x>0$ and (b) not use the math-mode \scriptscriptstyle directive but the text-mode directive \tiny as the first instruction in the argument of \text.

\documentclass{beamer}
\begin{document}
\begin{frame}
$y= 1/x \qquad \text{\tiny for x>0}$
\end{frame}
\end{document}