![对多对齐方程的分量进行装箱](https://linux22.com/image/376422/%E5%AF%B9%E5%A4%9A%E5%AF%B9%E9%BD%90%E6%96%B9%E7%A8%8B%E7%9A%84%E5%88%86%E9%87%8F%E8%BF%9B%E8%A1%8C%E8%A3%85%E7%AE%B1.png)
答案1
无需图形包即可完成此操作。我在下面给出了代码,为了好玩, pstricks
代码如下:
\documentclass[svgnames]{article}
\usepackage{mathtools}
\usepackage{pst-node}
\usepackage{eqparbox}
\usepackage{auto-pst-pdf}
\begin{document}
\[ \begin{aligned}
A &= B = \\
D &= E = \\
G &= H =
\end{aligned}
\fboxsep =1pt
\boxed{\begin{aligned}
& C \\
& F\mkern1mu \\
& I
\end{aligned}} \]
\begin{postscript}
\begin{alignat*}{3}
A &= B &&= \pnode[0pt, 2.5ex]{C}C \\
D &= E &&= F \\
G &= H &&=I\pnode[6pt, -1ex]{I}
\end{alignat*}
\psset{linejoin=1, linecolor=IndianRed}
\psframe[linewidth=0.6pt](C)(I)
\end{postscript}
\end{document}
答案2
另一种方式是,
\documentclass{article}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{booktabs}
\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}
\newcommand{\DrawBox}[3][]{%
\tikz[overlay,remember picture]{
\draw[black,#1]
($(#2)+(-0.2em,2.0ex)$) rectangle
($(#3)+(0.75em,-0.75ex)$);}
}
\begin{document}
\begin{alignat*}{3}
A &= B &&= \tikzmark{top left} C \\
D &= E &&= F \\
G &= H &&= I \tikzmark{bottom right}
\end{alignat*}
\DrawBox[thin]{top left}{bottom right}
\end{document}
您可以在前言中调整框的大小以及其他参数。此技术使用 TikZ 标记并将框架叠加在 alignat 环境之上。
罗曼
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\newcommand{\tikznode}[2]{\relax
\ifmmode%
\tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {$#2$};
\else
\tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {#2};%
\fi}
\usetikzlibrary{fit}
\begin{document}
\begin{alignat*}{3}
A &= B &&= \tikznode{C}{C} \\
D &= E &&= \tikznode{F}{F} \\
G &= H &&= \tikznode{I}{I}
\end{alignat*}
\tikz[remember picture,overlay]{\node[draw,blue,rounded corners,fit=(C) (F) (I)]{};}
% F is not required in this example but it will be if it is replaced by a object
\end{document}
答案3
如果您喜欢黑色和其他背景,您可以在这里选择:
set fill color=white,
set border color=blue,
\documentclass{article}
\usepackage{amsmath}
\usepackage[customcolors]{hf-tikz}
\tikzset{offset def/.style={
above left offset={-.1,0.5},
below right offset={.5,-1.3},
},
color def/.style={
offset def,
set fill color=white,
set border color=blue,
},
}
\begin{document}
\begin{alignat*}{3}
A &= B &&=\tikzmarkin[color def]{a} C \\
D &= E &&= F \\
G &= H &&= I
\end{alignat*}
\end{document}