[texhax] fbox in align environment
Sebastian Canagaratna
s-canagaratna at onu.edu
Mon Jun 15 15:43:04 CEST 2009
Thanks, Phil. The first example works fine, but the second fails:
ERROR: Illegal unit of measure (mu inserted).
--- TeX said ---
<to be read again>
=
l.13 \end{align}
--- HELP ---
If you just got a
! Missing number, treated as zero.
error, then this is part of the same problem.
Perhaps I did something wrong, I'll investigate it and let you know.
Thanks again.
Sebastian
On Mon, Jun 15, 2009 at 10:29:06AM +0200, Philip G. Ratcliffe wrote:
> > Say you have three equations in an align environment. You
> > want to box only one of them, say the last one. How does one
> > do this? I want all three equations aligned (at, say the =
> > sign). Fancybox.sty wasn't of much help in this regard. I can
> > put the first two eqns in an align, and the third eqn in an
> > fbox in the equation environment, but the alignment is disturbed.
>
> If you haven't found anything better, here's a not very elegant solution:
>
> \documentclass{article}
> \usepackage{amsmath}
> \newcommand\alignboxed[2]{\rlap{\boxed{#1#2}}\hphantom{#1\mkern6mu}}
> \begin{document}
> \begin{align}
> f_1(x) &= a+bx, \\
> f_2(x) &= a+bx+cx², \\
> \alignboxed{f_3(x)}{= a+bx+cx²+dx³.}
> \end{align}
> \end{document}
>
> This works similarly:
>
> \documentclass{article}
> \usepackage{amsmath}
> \def\alignboxed#1\endalignboxed{\rlap{\boxed{#1#2}}\hphantom{#1\mkern6mu}
> }
> \begin{document}
> \begin{align}
> f_1(x) &= a+bx, \\
> f_2(x) &= a+bx+cx², \\
> \alignboxed
> f_3(x) &= a+bx+cx²+dx³.
> \endalignboxed
> \end{align}
> \end{document}
>
> Cheers, Phil
>
More information about the texhax
mailing list