Forgot password?
 Create new account
View 2515|Reply 0

align中某式子加框

[Copy link]

700

Threads

110K

Posts

910K

Credits

Credits
94172
QQ

Show all posts

kuing Posted at 2015-2-2 19:26:32 |Read mode
转自Some LATEX2ε tricks and tips (IV) Luca Merciadri
  1. \makeatletter
  2. \newcommand\Aboxed[1]{%
  3. % syntax: \Aboxed{ left & right }
  4. \@Aboxed#1\ENDDNE}
  5. \def\@Aboxed#1&#2\ENDDNE{%
  6. % idea: get the left and right part
  7. % typeset them in a \boxed AFTER an ‘&’
  8. % and pull it backwards
  9. % but in order to get the horizontal
  10. % placement to work we need to set
  11. % some appropriate space to the left
  12. % of the ‘&’
  13. \settowidth\@tempdima{$\displaystyle#1{}$}%
  14. \setlength\@tempdima
  15. {\@tempdima+\fboxsep+\fboxrule}
  16. % \global does not always mix well
  17. % with \setlength
  18. \global\@tempdima=\@tempdima
  19. \kern\@tempdima
  20. &
  21. \kern-\@tempdima
  22. \boxed{#1#2}%
  23. }
  24. \makeatother
Copy the Code
然后
  1. \begin{align*}
  2. \Aboxed{A&=B}\\
  3. A&=B\\
  4. &=C
  5. \end{align*}
Copy the Code

手机版Mobile version|Leisure Math Forum

2025-4-21 14:07 GMT+8

Powered by Discuz!

× Quick Reply To Top Return to the list