我想按照下图所示的方式突出显示线性方程组的变量值。
\begin{align*}
(IV) - (V) & \Rightarrow 4x_1 = 8 & \Rightarrow x_1 = 2
\\ x_1 = \text{2 in (V):} & \Rightarrow 7 * 2 + 5x_2 = 34 &
\Rightarrow x_2 = 4 \\ x_1 = \text{2 und } x_2 = \text{4 in (II):} &
\Rightarrow 3 * 2 + 4 + x_3 = 13 &\Rightarrow x_3 = 3
\end{align*}
如果相关的话,这是我使用的代码。
答案1
这里有一个使用 TikZ 数学节点矩阵的可能解决方案:
\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\noindent Your example as a benchmark:
\begin{align*}
(IV) - (V) & \Rightarrow 4x_1 = 8 & \Rightarrow x_1 = 2
\\ x_1 = \text{2 in (V):} & \Rightarrow 7 * 2 + 5x_2 = 34 &
\Rightarrow x_2 = 4 \\ x_1 = \text{2 und } x_2 = \text{4 in (II):} &
\Rightarrow 3 * 2 + 4 + x_3 = 13 &\Rightarrow x_3 = 3
\end{align*}
My solution with a Ti\emph{k}Z matrix:
\begin{center}
\begin{tikzpicture}
\matrix[matrix of math nodes,
column 1/.style={nodes={anchor=east}},
column 2/.style={nodes={anchor=west}},
row sep=-.4ex
] (m) {
(IV) - (V) &[-4pt] \Rightarrow 4x_1 = 8 &[30pt] \Rightarrow x_1 = 2
\\
x_1 = \text{2 in (V):} & \Rightarrow 7 * 2 + 5x_2 = 34 &
\Rightarrow x_2 = 4 \\
x_1 = \text{2 und } x_2 = \text{4 in (II):} &
\Rightarrow 3 * 2 + 4 + x_3 = 13 &\Rightarrow x_3 = 3\\
};
\draw[red, line width=2pt] ([shift={(-4pt,2pt)}]m-1-3.north west) rectangle ([shift={(4pt,-2pt)}]m-3-3.south east);
\end{tikzpicture}
\end{center}
\end{document}
答案2
解决方案高频-tikz:
\documentclass{article}
\usepackage{amsmath}
\usepackage[customcolors]{hf-tikz}
\tikzset{offset def/.style={
above left offset={-0.2,0.5},
below right offset={0.35,-0.3},
},
color def/.style={
offset def,
set fill color=white,
set border color=red,
},
}
\begin{document}
\begin{align*}
(IV) - (V) & \Rightarrow 4x_1 = 8 & \tikzmarkin[color def]{z}\Rightarrow x_1 = 2
\\ x_1 = \text{2 in (V):} & \Rightarrow 7 * 2 + 5x_2 = 34 &
\Rightarrow x_2 = 4 \\ x_1 = \text{2 und } x_2 = \text{4 in (II):} &
\Rightarrow 3 * 2 + 4 + x_3 = 13 &\Rightarrow x_3 = 3\tikzmarkend{z}
\end{align*}
\end{document}
结果:
检查包装文档以获取更多选项,包括一个防止圆角的选项。
答案3
使用 tikz :
\documentclass[french]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{babel}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{fit}
\newcommand{\tikzmark}[2]{%
\tikz[remember picture,baseline=(#1.base)]
\node[text=black,anchor=center,inner sep=1pt] (#1) {#2};}
\begin{document}
\begin{align*}
(IV) - (V) & \Rightarrow 4x_1 = 8 & \Rightarrow\tikzmark{a}{} x_1 = 2
\\ x_1 = \text{2 in (V):} & \Rightarrow 7 * 2 + 5x_2 = 34 &
\Rightarrow x_2 = 4 \\ x_1 = \text{2 und } x_2 = \text{4 in (II):} &
\Rightarrow 3 * 2 + 4 + x_3 = 13 &\Rightarrow x_3 = \tikzmark{b}{} 3
\end{align*}
\tikz[overlay,remember picture]{
\node[rectangle, draw=red,thick, minimum size=2cm ] at (barycentric cs:a=1,b=1) {};
}
\end{document}