1
\begin{center}
\ovalbox{Consider the integral
$ I_n = \int_0^1$}
\end{center}

While using the fancybox package, the code above works as I would have expected, but the following gets me an error message about a missing $

\begin{center}
\ovalbox{Consider the integral
$$ I_n = \int_0^1$$}
\end{center}

How can I make this work?

2 Answers 2

8

$$ is not supported latex syntax, you would see the same with \mbox{$$ I_n = \int_0^1$$} as you can not have display math in an hbox, the primitive $$ does not start display math it is interpreted as two $ so makes an empty inline math, and so the following I_n = \int_0^1 is in text mode. Use

$\displaystyle I_n = \int_0^1$

2
  • Line breaks inside this ovalbox don't work. If you put something between double dollar signs, it doesn't appear on the same line as the words that precede it. Apr 17 at 2:05
  • @MichaelHardy yes \ovalbox works like \fbox or \mbox it is a single line boc Apr 17 at 6:18
4

Hope this will helps you:

\documentclass{book}
\usepackage{empheq,fancybox}

\begin{document}

\begin{center}
Consider the integral
\begin{empheq}[box=\ovalbox]{align*}
I_n = \int_0^1
\end{empheq}
\end{center}

\end{document}

enter image description here

Note: I'm using the standard book class file, as you didn't mention anything, and also please avoid $$...$$, as already David mentioned

Edit

Is the one you expected?

\documentclass{book}
\usepackage{empheq,fancybox}

\begin{document}

\ovalbox{
\begin{minipage}{10pc}
Consider the integral
\[
I_n = \int_0^1
\]
\end{minipage}
}

\end{document}
4
  • But I want the ovalbox to include a minipage that includes the words "Consider the integral" followed by the math display. Apr 17 at 1:57
  • @MichaelHardy Please check the update and let me know
    – MadyYuvi
    Apr 17 at 12:11
  • That seems to work. Except that it's not centered, but I think I can fix that. Apr 22 at 2:16
  • 1
    Just add \begin{center} before \ovalbox and \end{center} after \end{minipage}} also if the suggestion meets your expectation, then click the tick mark
    – MadyYuvi
    Apr 22 at 4:59

You must log in to answer this question.

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