|
转自Some LATEX2ε tricks and tips (IV) Luca Merciadri- \makeatletter
- \newcommand\Aboxed[1]{%
- % syntax: \Aboxed{ left & right }
- \@Aboxed#1\ENDDNE}
- \def\@Aboxed#1\ENDDNE{%
- % idea: get the left and right part
- % typeset them in a \boxed AFTER an ‘&’
- % and pull it backwards
- % but in order to get the horizontal
- % placement to work we need to set
- % some appropriate space to the left
- % of the ‘&’
- \settowidth\@tempdima{$\displaystyle#1{}$}%
- \setlength\@tempdima
- {\@tempdima+\fboxsep+\fboxrule}
- % \global does not always mix well
- % with \setlength
- \global\@tempdima=\@tempdima
- \kern\@tempdima
- &
- \kern-\@tempdima
- \boxed{#1#2}%
- }
- \makeatother
Copy the Code 然后- \begin{align*}
- \Aboxed{A&=B}\\
- A&=B\\
- &=C
- \end{align*}
Copy the Code |
|