0

I want to create a frame around a piece of math notation, I'm using the \boxed{} command to do that:

$$
\boxed{
\begin{align*}
    &p = \text{Intervallverhältnis von 1 Cent} \\
    &2 = \text{Intervallverhältnis der reinen Oktave} \\ \\
    &p^{1200} = 2 \rightarrow p = \sqrt[1200]{2} 
\end{align*}
}
$$

It looks exactly how I want it to look like in the compiled pdf, but overleaf.com outputs the following error message: Package amsmath error: erroneous nesting of equation structures. Where is the problem and why does it still work? Are there other or better ways of achieving a black frame around a piece of math notation (or any kind of text) easily? I'm very much a beginner. Thanks in advance :)

2
  • 2
    Welcome! You should never use $$ in LaTeX. Your problem can be solved with the empheq package.
    – egreg
    Mar 8, 2020 at 13:15
  • (Off topic.) Rather than using two double backslashes to insert a blank line, the option \\[<dimen>] can give more control. But, when using amsmath, be sure to not insert a space between the \\ and the option. Mar 8, 2020 at 18:32

1 Answer 1

2

You should never use $$ in LaTeX. Ever.

Anyway, it makes no sense to nest align* inside \boxed, because align* wants to be at the outer level (not even inside equation). You can look at the empheq package for more tricks, but in your case it suffices to do

\begin{equation*}
\boxed{
  \begin{aligned}
    &p = \text{Intervallverhältnis von 1 Cent} \\
    &2 = \text{Intervallverhältnis der reinen Oktave} \\ \\
    &p^{1200} = 2 \rightarrow p = \sqrt[1200]{2} 
  \end{aligned}
}
\end{equation*}

You must log in to answer this question.

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