5

When I try to input:

\begin{eqnarray*}
w(t) &=& \frac{1}{2}Cv^2(t)\\
\boxed{w(t) &=& \frac{1}{2}C \frac{q(t)^2}{C^2}}\\
w(t) &=& \frac{1}{2}\frac{q(t)^2}{C}\\
w(t) &=& \frac{1}{2}Cv^2(t)\\
\end{eqnarray*}

I get an error. The following code works but the box is way of to the left... (I didn't use &=& on the boxed equation this time.)

\begin{eqnarray*}
w(t) &=& \frac{1}{2}Cv^2(t)\\
\boxed{w(t) = \frac{1}{2}C \frac{q(t)^2}{C^2}}\\
w(t) &=& \frac{1}{2}\frac{q(t)^2}{C}\\
w(t) &=& \frac{1}{2}Cv^2(t)\\
\end{eqnarray*}

Are there any ways to fix this issue?

2

1 Answer 1

10

Why no use \Aboxed command of the package mathtools? inside of an align* environment

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{align*}
w(t) &= \frac{1}{2}Cv^2(t)\\
\Aboxed{w(t) &= \frac{1}{2}C \frac{q(t)^2}{C^2}}\\
w(t) &= \frac{1}{2}\frac{q(t)^2}{C}\\
w(t) &= \frac{1}{2}Cv^2(t)\\
\end{align*}
\end{document}

enter image description here

7
  • My editor doesnt want to import mathtools for some reason...
    – Rectifier
    Commented Oct 13, 2014 at 18:18
  • What system do you use? OS? Tex distribution? Editor?
    – skpblack
    Commented Oct 13, 2014 at 18:24
  • Win8, texmaker and the error I get is: 'mathtools.sly' not found
    – Rectifier
    Commented Oct 13, 2014 at 18:25
  • MiKTeX or TeXLive?
    – skpblack
    Commented Oct 13, 2014 at 18:26
  • You must install the mathtools package. If you use MiKTeX install from MiKTeX Package Manager.
    – skpblack
    Commented Oct 13, 2014 at 18:27

You must log in to answer this question.

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