1

I have a multi-line equation;

\begin{align} 
  \label{eq:er25} 
  F(\gamma) &= aaaaa \nonumber\\ 
  &+ bbbbbb \nonumber\\ 
  &- cccccc 
\end{align}

How I can put this equation inside a box?

1
  • With the package bm you can create a box with the environment empheq wirth something like \begin{empheq}[box=\fbox] equation \end{empheq}
    – Aradnix
    Commented Oct 3, 2014 at 15:36

1 Answer 1

5

Here are some some details of what can be done with empheq and mathtools(which is loaded by empeheq). The overload option simplifies the syntax, but has the drawback that breaking equations over pages is forbidden (however you can use the AmSalign & the like,. environments to enable the ordinary behaviour). The \Aboxed command allows boxing a line with one alignment point.

\documentclass[12pt]{article}

\usepackage [utf8]{inputenc}
\usepackage[x11names]{xcolor}
\usepackage[overload]{empheq}
\colorlet{textcolor}{black}

\newcommand*{\widebox}[2][0.5em]{\fbox{\hspace{#1}$\displaystyle #2$\hspace{#1}}}
\usepackage{xpatch}%
\makeatletter
\xpatchcmd{\@Aboxed}{%
\boxed {#1#2}}
{%
\color{HotPink3}\boxed {\color{textcolor}#1#2}}
{}{}
\makeatother

\begin{document}

\begin{align}[box=\widebox]
  \label{eq:er25}
  F(γ) &= aaaaa \notag\\
  &+ bbbbbb \notag\\
  &- cccccc
\end{align}

\fboxrule=1pt%
\begin{empheq}[box=\fcolorbox{HotPink3}{MistyRose2!30! white}]{alignat = 2}
 \label{eq:er25}
\Aboxed{F(γ) = & aaaaa }& \Aboxed{G & = dddddd}\notag\\
 &\! + bbbbbb \notag\\
 & - cccccc
\end{empheq}

\end{document}

enter image description here

You must log in to answer this question.

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