[texhax] fbox in align environment
Sebastian Canagaratna
s-canagaratna at onu.edu
Wed Jun 17 18:12:06 CEST 2009
Phil:
I am having some problem getting your code to work. i am using
texlive, the latest version. I am unfamiliar with the 3D format you are
using for lengths. I presume this stands for the space occupied by "3D"?
Whatever it is, here is the error message I get:
ERROR: Illegal unit of measure (pt inserted).
--- TeX said ---
<to be read again>
D
l.13 \alignboxedsep=3D1
pt
--- HELP ---
If you just got a
! Missing number, treated as zero.
error, then this is part of the same problem. If not, it means that
LaTeX was expecting a length as an argument and found a number
instead. The most common cause of this error is writing 0 instead of
something like 0in for a length of zero, in which case typing return
should result in correct output. However, the error can also be caused
by omitting a command argument.
Just in case my mailer mangled the code, here is what I am using:
\documentclass{article}
\usepackage{amsmath}
\def\alignboxed#1\endalignboxed{%
\bgroup
\fboxsep=3D\alignboxedsep
\rlap{\boxed{#1#2}}\hphantom{#1\kern\fboxsep}
\egroup
}
\newlength{\alignboxedsep}
\alignboxedsep=3D1pt
\begin{document}
\begin{align}
f_1(x) &=3D a+bx,
\\
\alignboxed
f_2(x) &=3D a+bx+cx=B2,
\endalignboxed
\\
\alignboxed
f_3(x) &=3D a+bx+cx=B2+dx=B3.
\endalignboxed
\end{align}
\begin{align*}
x+y+2 & =3D 1
\\
2x+3y-4z & =3D 2
\\
\alignboxed
3x-2y+z & =3D3
\endalignboxed
\\
\alignboxed
a & =3D b+c+d
\endalignboxed
\end{align*}
\end{document}
I will experiment to see whether I can solve it on my own. Since you
have tested it, I presume my mailer introduced some character. I'll try
and track it down. Thanks.
Sebastian
On Wed, Jun 17, 2009 at 04:13:59PM +0200, Philip G. Ratcliffe wrote:
> Here's a more self-contained version, which should handling alignmnet better
> and allows for changing of \fboxsep via \alignboxedsep:
>
> \documentclass{article}
> \usepackage{amsmath}
> \def\alignboxed#1\endalignboxed{%
> \bgroup
> \fboxsep=\alignboxedsep
> \rlap{\boxed{#1#2}}\hphantom{#1\kern\fboxsep}
> \egroup
> }
> \newlength{\alignboxedsep}
> \alignboxedsep=1pt
> \begin{document}
> \begin{align}
> f_1(x) &= a+bx,
> \\
> \alignboxed
> f_2(x) &= a+bx+cx²,
> \endalignboxed
> \\
> \alignboxed
> f_3(x) &= a+bx+cx²+dx³.
> \endalignboxed
> \end{align}
> \begin{align*}
> x+y+2 & = 1
> \\
> 2x+3y-4z & = 2
> \\
> \alignboxed
> 3x-2y+z & =3
> \endalignboxed
> \\
> \alignboxed
> a & = b+c+d
> \endalignboxed
> \end{align*}
> \end{document}
>
> Cheers, Phil
>
More information about the texhax
mailing list