Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a problem using \Aboxed in the following align*-environment:

\begin{align*}
\omega(\sigma_{ij}) &\equiv 1 - \left(\frac{27J_3}{2\sigma_e^3}\right)^2 \\
& = \omega(L) = 1 - \frac{\left( 9L - L^3\right)^2}{\left(L^2+3\right)^3}. 
\end{align*}

I want to use \Aboxed to put the last part of the final equation in a box, i.e.

\begin{align*}
\omega(\sigma_{ij}) &\equiv 1 - \left(\frac{27J_3}{2\sigma_e^3}\right)^2 \\
& = \Aboxed{ \omega(L) = 1 - \frac{\left( 9L - L^3\right)^2}{\left(L^2+3\right)^3}. }
\end{align*}

This gives me the error message in the title. However, using \Aboxed in the upper equation of the align* doesn't cause any problems at all. I've also used \Aboxed in the last equation of other align*'s and align's in my document. What causes the error in this case?

share|improve this question

1 Answer 1

\Aboxed (From mathtools) is designed to put a box across an alignment point (Refer mathtools documentation, section- 3.4.5, page 18). Hence,

\Aboxed{\omega(\sigma_{ij}) &\equiv 1 - \left(\frac{27J_3}{2\sigma_e^3}\right)^2 }\\

works. The \Aboxed command is defined as (from mathtools.sty)

\newcommand\Aboxed[1]{\@Aboxed#1\ENDDNE}
\def\@Aboxed#1&#2\ENDDNE{%
  \settowidth\@tempdima{$\displaystyle#1{}$}%
  \addtolength\@tempdima{\fboxsep}%
  \addtolength\@tempdima{\fboxrule}%
  \global\@tempdima=\@tempdima
  \kern\@tempdima
  &
  \kern-\@tempdima
  \boxed{#1#2}
}

Hence, when you use \Aboxed, TeX will greedily look for an & (alignment character) and when it is not found, an error is returned.

If you want a box only for a portion without an alignment point inside, you can use boxed (basically from amsmath and mathtools loads amsmath also) as

& = \boxed{ \omega(L) = 1 - \frac{\left( 9L - L^3\right)^2}{\left(L^2+3\right)^3}. }

The boxed command is defined as (from amsmath.sty)

\newcommand{\boxed}[1]{\fbox{\m@th$\displaystyle#1$}}

which does not have any concern for the alignment character &. (Hence it will not work across &.)

Conclusion: If you want a box to cross through an alignment point, use \Aboxed. On the other hand, if the box is for only a portion without alignment point, use \boxed

Complete MWE will be:

\documentclass{article}
\usepackage{mathtools}
\begin{document}

\begin{align*}
\Aboxed{\omega(\sigma_{ij}) &\equiv 1 - \left(\frac{27J_3}{2\sigma_e^3}\right)^2 }\\
& = \boxed{ \omega(L) = 1 - \frac{\left( 9L - L^3\right)^2}{\left(L^2+3\right)^3}. }
\end{align*}


\end{document}

enter image description here

share|improve this answer
    
Wonderful! Thank you for a thorough answer. –  Christian Dalheim Øien May 11 '12 at 8:00
1  
@ChristianDalheimØien: If the answer has solved your problem , you may consider accepting it (by clicking the green check mark below voting symbols) and also upvote it. That is how we say `thanks' here in TeX.SX. –  Harish Kumar May 11 '12 at 8:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.