4

I have an array inside an equation in a beamer presentation. I tried scaling it down using resizebox but it gives me error :

\begin{equation}
\label{eq:recursive}
\resizebox{\linewidth}{!}{
R_{k+1}(a,b) =
\left\{ \begin{array}{rl}
1 & \mbox{if } a=b \\
0 &  \mbox{if } I(a)=\phi \mbox{ or } I(b)=\phi \\
\frac{C}{|I(a)||I(b)|}\sum_{i=1}^{|I(a)|}\sum_{j=1}^{|I(b)|} R_k(I_i(a),I_j(b)) & \mbox{otherwise } \\
\end{array}\right.
}
\end{equation}

any suggestions?

6

If you really need numbering, you can do like

\documentclass{beamer}
\usepackage{mathtools}
\begin{document}
\begin{frame}
\frametitle{Big formula}

\begin{equation}
\label{eq:recursive}
\resizebox{.9\textwidth}{!}{$\displaystyle % restart math mode!
R_{k+1}(a,b) =
\begin{dcases}
1 & \text{if $a=b$} \\
0 & \text{if $I(a)=\phi$ or $I(b)=\phi$} \\
\frac{C}{|I(a)|\,|I(b)|}
  \sum_{i=1}^{|I(a)|}
  \sum_{j=1}^{|I(b)|} R_k(I_i(a),I_j(b)) & \text{otherwise}
\end{dcases}
$} % end math mode and close the box to be resized
\end{equation}
\end{frame}
\end{document}

Note that I used dcases provided by mathtools, which gains some horizontal space as the limits are typeset above and below the summation sign. Alternatively, you can type

\documentclass{beamer}

\begin{document}
\begin{frame}
\frametitle{Big formula}

\begin{equation}
\label{eq:recursive}
\resizebox{.9\textwidth}{!}{$\displaystyle % restart math mode
R_{k+1}(a,b) =
\begin{cases}
1 & \text{if $a=b$} \\
0 & \text{if $I(a)=\phi$ or $I(b)=\phi$} \\
\frac{C}{|I(a)|\,|I(b)|}
  \sum\limits_{i=1}^{|I(a)|}
  \sum\limits_{j=1}^{|I(b)|} R_k(I_i(a),I_j(b)) & \text{otherwise}
\end{cases}
$} % end math mode and close the box to be resized
\end{equation}
\end{frame}
\end{document}

This will use smaller summation signs.

enter image description here

Notes.

  1. The cases (or dcases) environment is more convenient than using array.

  2. For the conditions, it's better to use \text and switch to math mode inside it, rather than using clumsy \mbox commands with spaces.

|improve this answer|||||
  • 2
    or cases* or dcases which typeset the second column in text mode, so no \text needed. – daleif Jun 10 '13 at 10:22
2

You are not in math mode inside the argument of the \resizebox command. You can get back into (display) math mode using dollar signs and \displaystyle.

\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}
\begin{document}
\begin{equation}
\label{eq:recursive} 
\resizebox{\linewidth}{!}{$\displaystyle a = b$}
\end{equation}
\end{document}

Note that the equation environment is partly redundant here; it can be omitted in cases where you don't need numbering.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.