3

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?

2 Answers 2

1

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*}
    y= 1/x \qquad \scriptscriptstyle {\text{For}~x>0}
\end{equation*}
\end{frame}
\end{document}
1
  • Thanks for your help! P.S. The protected space ~ is not anymore required when we replace \mbox by \text.
    – emeryville
    Commented Sep 28, 2015 at 18:57
4

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} 
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .