## LaTeX forum ⇒ Math & Science ⇒ Fill \Aboxed With Color Topic is solved

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Kareem
Posts: 9
Joined: Sat Aug 04, 2012 2:28 pm

### Fill \Aboxed With Color

Is there a simple way to fill \Aboxed with color inside an align environment? Below is my code

\begin{align}
\Aboxed{f(x) &= \frac{{{a_0}}}{2} + \sum\limits_{n = 1}^\infty  {\left[a_n \cos{\left( {{\displaystyle{\frac{2n\pi x}{p}}}} \right) + {b_n}\sin \left( {{\displaystyle{\frac{2n\pi x}{p}}}} \right)} \right]},}\\
\vdots
\end{align}

I want to highlight the first equation.

LaTeXguide.org • LaTeX-Cookbook.net

Bartman
Posts: 256
Joined: Fri Jan 03, 2020 2:39 pm

### Fill \Aboxed With Color  Topic is solved

If you had given a complete minimal working example, then the reader would know how to make the \Aboxed command available.

You could redefine the definition of the command by

\makeatletter
\def\@Aboxed#1&#2&#3\ENDDNE{%
\ifnum0={}\fi \setbox \z@
\hbox{$\displaystyle#1{}\m@th$\kern\fboxsep \kern\fboxrule }%
\edef\@tempa {\kern  \wd\z@ &\kern -\the\wd\z@ \fboxsep
\the\fboxsep \fboxrule \the\fboxrule }\@tempa
\fcolorbox{black}{yellow}{$\displaystyle #1#2$}% changed
}
\makeatother

In addition to mathtools, this source code also needs something like xcolor.

The hf-tikz package would be another way to color the equation.

Finally, a remark on the content of the equation: I don't understand why you use \displaystyle in the align` environment.

Kareem
Posts: 9
Joined: Sat Aug 04, 2012 2:28 pm

### Fill \Aboxed With Color

Great answer. It works like a charm!

Kareem
Posts: 9
Joined: Sat Aug 04, 2012 2:28 pm

### Fill \Aboxed With Color

Is there a way to define another environment like Aboxed but with a different colour other than yellow?