[texhax] fbox in align environment

E. Krishnan ekmath at asianetindia.com
Wed Jun 17 02:50:25 CEST 2009


On Tue, 16 Jun 2009, Philip G. Ratcliffe wrote:

>>    \usepackage{amsmath}
>>
>>    \begin{equation*}
>>      \setlength{\arraycolsep}{0pt}
>>      \renewcommand{\arraystretch}{1.25}
>>      \begin{array}{r@{\;}c@{\;}r@{\;}}
>>        x+y+2    & = & 1\\
>>        2x+3y-4z & = & 2\\
>>        \hline
>>        \multicolumn{1}{|r@{\;}}{3x-2y+z}
>>        & \multicolumn{1}{c@{\;}}{=}
>>        & \multicolumn{1}{r@{\;}|}{3}\\
>>        \hline
>>      \end{array}
>>    \end{equation*}
>
> A couple of comments:
>
> 1. the alignment of the third column ought to be with "l" (not "r");
> 2. if, e.g., the r.h.s. of one of the first two equations is longer (say,
> 1+p) then the output looks a little odd since the box is always as wide as
> the table and not a given entry (the same is also true w.r.t. the l.h.s.).

Thank you. Didn't think of these contingencies when I shot off the first 
solution that came to my mind. Anyway here's an entirely new attempt, this 
time using PostScript:

\usepackage{pstricks}

\newlength{\eqwd}
\newlength{\eqht}
\newlength{\eqdp}

\newcommand{\mkeqbx}[1]{%
   \settowidth{\eqwd}{$#1$}
   \settoheight{\eqht}{$#1$}
   \settodepth{\eqdp}{$#1$}
    \addtolength{\eqwd}{2pt}
    \addtolength{\eqht}{2pt}
    \addtolength{\eqdp}{2pt}
    \psframe(-2pt,-\eqdp)(\eqwd,\eqht)}


  \begin{align*}
     x+y+2    & = 1\\
     2x+3y-4z & = 2\\
     \mkeqbx{3x-2y+z=3}%
     3x-2y+z  & =3\\
     \mkeqbx{a=b+c+d}%
     a & = b+c+d\\
   \end{align*}



-- 
Krishnan


More information about the texhax mailing list