I have the following code:

    Something here

which gives the following errors:

  1. Missing \endgroup inserted
  2. Missing } inserted
  3. LaTeX Error: \begin{document} ended by \end{align*}
  4. Missing $ inserted
  5. Display math should end with $$
  6. Extra \endgroup
  7. Too many }s

I'm new to Latex and don't understand why this is happening. Is this a Latex bug? How can I put an equation inside a box?

  • Another alternative to the ones in the existing answer: empheq.
    – E.P.
    Aug 11, 2017 at 9:47
  • 1
    if only a simple box is wanted, amsmath has \boxed{ \begin{aligned} ... \end{aligned} }. must be used in math mode. Aug 11, 2017 at 13:47

4 Answers 4


Not a bug, user error. \framebox is like \mbox and is a single line (horizontal mode) construct, align is a display construct that needs to be in vertical mode. There are several packages for boxed vertical material: mdframed and tcolorbox for example, or simply use


OK so here is an example : firstly use package \usepackage{amsmath,mathtools}

\Aboxed{Nu_\text{m}        &= \frac{\alpha_m \, L}{\lambda}    \text{ \quad .}} \\ 
\Aboxed{Nu_\text{m}        &= \frac{\alpha_m \, L}{\lambda}    \text{ \quad .}}

remove * and put \Aboxed .


enter image description here

here is my full code:

    ]{scrbook}              %KOMA-



\Aboxed{Nu_\text{m}        &= \frac{\alpha_m \, L}{\lambda}    \text{ \quad .}} \\ 
\Aboxed{Nu_\text{m}        &= \frac{\alpha_m \, L}{\lambda}    \text{ \quad .}}

  • I think we don't have to define Aboxed . Aug 11, 2017 at 8:15
  • \Aboxed is defined by mathtools Aug 11, 2017 at 8:22
  • Sir, I respect you but my code is perfectly working. we can use package instead defining Aboxed Aug 11, 2017 at 8:22
  • 1
    My comment was before you had posted code, your edit showed where it was defined, in mathtools, which you had not mentioned in the original answer:-) Aug 11, 2017 at 8:23

I guess you want to box the equations, but this cannot be done that way, because \framebox doesn't support line breaks (directly).

You can avoid having to guess the width of the box by building the alignment beforehand.


\usepackage{lipsum}% only for the example



a &= b(x+y)\\
  &= bx+by


enter image description here

  • why bother with this? amsmath has \boxed, into which an aligned environment fits admirably. Aug 11, 2017 at 13:27
  • @barbarabeeton Instead of \fbox one might want some different ornamentation.
    – egreg
    Aug 11, 2017 at 13:33

It is very easy to have any custom box for any equation environment with empheq. Needless to loadamsmath, as it loadsmathtools, which loads amsmath.




    (x + y)^3 & =x^3 + 3x^2y + 3xy^2 + y^3t\\%
    x^3 + y^3 & = (x + y)(x^2-xy + y^2)


enter image description here

You must log in to answer this question.

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