2

I am trying to put a rounded corners box that contains an equation. I keep having an error: 'Missing $ inserted' and I don't understand why?

Could someone help me to figure it out please?

\documentclass{beamer}

\usepackage{fancybox}
\usepackage{amsmath}

\begin{document}

\begin{frame}
    \begin{equation*}
    \ovalbox{\nabla \zeta_0 = -\frac{\delta r}{h^{*}}  \ \text{avec :}\ \frac{1}{h^{*}} = \frac{1}{\alpha h_p} - \frac{1}{H}}
    \end{equation*}
\end{frame}
\end{document}

2 Answers 2

3

Adaptations

  • the argument of \ovalbox must be in math mode

Result

enter image description here

Code

\documentclass{beamer}

\usepackage{fancybox}
\usepackage{amsmath}

\begin{document}

\begin{frame}
    \ovalbox{$\nabla \zeta_0 = -\frac{\delta r}{h^{*}}  \ \text{avec :}\ \frac{1}{h^{*}} = \frac{1}{\alpha h_p} - \frac{1}{H}$}
\end{frame}
\end{document}
2
  • Thank you for your help it works ! Could I ask you too if it's possible to impose same height of ovalboxes for 2 different boxes side to side ? Like in this code if I add another one : \begin{equation*} \ovalbox{$\nabla \zeta_0 = -\frac{\delta r}{h^{*}} \ \text{avec :}\ \frac{1}{h^{*}} = \frac{1}{\alpha h_p} - \frac{1}{H}$} \ \ovalbox{$\alpha = 1 - \frac{n}{n'} \ \text{et :} \ h_p = h_0$} \end{equation*}
    – Wiss
    Sep 13 at 11:02
  • 1
    Have a look at How to specify height and width of \fbox{}.
    – dexteritas
    Sep 13 at 11:12
3

You could use the hf-tikz package instead. This has some nice additional features, like overlay awareness, control over height and size...

Off-topic: you don't need to load amsmath, beamer loads it automatically.

\documentclass{beamer}

\usepackage[beamer,customcolors,nofill]{hf-tikz}
\hfsetbordercolor{black}

\begin{document}

\begin{frame}
    \begin{equation*}
    \tikzmarkin<1->{a}(0.1,-0.4)(-0.1,0.6) 
    \nabla \zeta_0 = -\frac{\delta r}{h^{*}}  \quad \text{avec :}\quad \frac{1}{h^{*}} = \frac{1}{\alpha h_p} - \frac{1}{H} 
    \tikzmarkend{a}
    \end{equation*}
\end{frame}
\end{document}

enter image description here


Or one could use the tcolorbox package:

\documentclass{beamer}

\usepackage[most]{tcolorbox}
\tcbset{
  every box/.style={
    highlight math style={
      colback=bg,
      colframe=black
    }
  }
}

\begin{document}

\begin{frame}
    \begin{equation*}
    \tcbhighmath{
    \nabla \zeta_0 = -\frac{\delta r}{h^{*}}  \quad \text{avec :}\quad \frac{1}{h^{*}} = \frac{1}{\alpha h_p} - \frac{1}{H} 
    }
    \end{equation*}
\end{frame}
\end{document}

enter image description here

0

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.