如果可能的话,我想以一种更简单、更好的方式实现这一点,即:
使用单一方程,其中线条以规则方式间隔
杯子和支架足够大
每个突出显示的矩形应具有相同的高度
方程的每一行应与图右侧相应的解释矩形水平对齐。
在以自定义方式实现此目的之前,我正在玩:
在环境中有方程
array
(即$\bigcap\left(\begin{array}{c}...\end{array} \right)$
),和
\bigcap
,用
\phantom
相同高度的矩形突出显示子部分,但结果并不完全令人满意。
PS:在这篇文章的末尾找到了使用 TikZ 矩阵库的尝试,但每个左线和其插图之间的对齐丢失了(请注意,使用单个矩阵并不能解决对齐问题)
\documentclass{minimal}
\usepackage{tikz}
\newcommand{\La}[1]{\mathcal{L}_{#1}}
\newcommand{\pre}[1]{\overrightarrow{#1}}
\newcommand{\shuf}{\textnormal{shuf}}
\newcommand{\highlight}[2][black!5]{\mathchoice%
{\colorbox{#1}{$\displaystyle#2$}}%
{\colorbox{#1}{$\textstyle#2$}}%
{\colorbox{#1}{$\scriptstyle#2$}}%
{\colorbox{#1}{$\scriptscriptstyle#2$}}}%
\begin{document}
\begin{tikzpicture}
\begin{scope}[xshift=0cm,yshift=0.2cm]
\node {$\highlight{\shuf(\shuf(\shuf(\shuf(\Sigma^*\setminus \pre{\La{\sigma}},s),s),s),s)}$};
\end{scope}
\begin{scope}[xshift=0cm,yshift=-0.4cm]
\node {$\highlight{\shuf(\shuf(\shuf(\pre{\La{\sigma}},s),s),s)}\highlight[cyan!10]{~s~\Sigma}$};
\end{scope}
\begin{scope}[xshift=0cm,yshift=-1cm]
\node {$\highlight{\shuf(\shuf(\shuf(\highlight{\Sigma^*\setminus\La{\sigma}},s),s),s)}\highlight[cyan!10]{~s~\Sigma}$};
\end{scope}
\begin{scope}[xshift=0cm,yshift=-1.6cm]
\node {$\highlight[pink!30]{\Sigma^+~s~}\highlight{\La{\sigma}}\highlight[cyan!10]{~s~\shuf(\shuf(\Sigma^*,s),s)}$};
\end{scope}
\begin{scope}[xshift=0cm,yshift=-2.2cm]
\node {$\highlight{\shuf(\Sigma^*\setminus\La{\sigma},s)}\highlight[cyan!10]{~s~\shuf(\shuf(\Sigma^*,s),s)}$};
\end{scope}
\begin{scope}[xshift=0cm,yshift=-2.8cm]
\node {$\highlight[pink!30]{\Sigma^+~s~}\highlight{\shuf(\Sigma^*\setminus\pre{\La{\sigma}},s)}\highlight[cyan!10]{~s~\shuf(\Sigma^*,s)}$};
\end{scope}
\begin{scope}[xshift=0cm,yshift=-3.4cm]
\node {$\highlight{\Sigma^+~s~\Sigma^+~s~\Sigma~s~\Sigma^+~s~\Sigma}$};
\end{scope}
\begin{scope}[xshift=4cm,yshift=0cm]
\filldraw[fill=black!5,draw=black,densely dotted] (0,0) rectangle (4,0.5);
\draw (0,0.1) -- (0,0) -- (4,0) -- (4,0.1);
\node at (1.9,0.23) {$w_{1,i}\notin\pre{\La{\sigma}}$};
\end{scope}
\begin{scope}[xshift=4cm,yshift=-0.6cm]
\filldraw[fill=cyan!10,draw=black,densely dotted] (3.6,0) rectangle (4,0.5);
\filldraw[fill=black!5,draw=black,densely dotted] (0,0) rectangle (3.6,0.5);
\draw (0,0.1) -- (0,0) -- (4,0) -- (4,0.1);
\node at (1.75,0.23) {$w_{1,i-1}\in\pre{\La{\sigma}}$};
\end{scope}
\begin{scope}[xshift=4cm,yshift=-1.2cm]
\filldraw[fill=cyan!10,draw=black,densely dotted] (3.6,0) rectangle (4,0.5);
\filldraw[fill=black!5,draw=black,densely dotted] (0,0) rectangle (3.6,0.5);
\draw (0,0.1) -- (0,0) -- (4,0) -- (4,0.1);
\node at (1.75,0.2) {$w_{1,i-1}\notin\La{\sigma}$};
\end{scope}
\begin{scope}[xshift=4cm,yshift=-1.8cm]
\filldraw[fill=pink!30,draw=black,densely dotted] (0,0) rectangle (0.5,0.5);
\filldraw[fill=cyan!10,draw=black,densely dotted] (2.6,0) rectangle (4,0.5);
\filldraw[fill=black!5,draw=black,densely dotted] (0.5,0) rectangle (2.6,0.5);
\draw (0,0.1) -- (0,0) -- (4,0) -- (4,0.1);
\node at (1.55,0.18) {$w_{j,k}\in\La{\sigma}$};
\end{scope}
\begin{scope}[xshift=4cm,yshift=-2.4cm]
\filldraw[fill=cyan!10,draw=black,densely dotted] (2.6,0) rectangle (4,0.5);
\filldraw[fill=black!5,draw=black,densely dotted] (0,0) rectangle (2.6,0.5);
\draw (0,0.1) -- (0,0) -- (4,0) -- (4,0.1);
\node at (1.55,0.18) {$w_{1,k}\notin\La{\sigma}$};
\end{scope}
\begin{scope}[xshift=4cm,yshift=-3cm]
\filldraw[fill=pink!30,draw=black,densely dotted] (0,0) rectangle (0.5,0.5);
\filldraw[fill=cyan!10,draw=black,densely dotted] (3,0) rectangle (4,0.5);
\filldraw[fill=black!5,draw=black,densely dotted] (0.5,0) rectangle (3,0.5);
\draw (0,0.1) -- (0,0) -- (4,0) -- (4,0.1);
\node at (1.7,0.23) {$w_{j,k+1}\notin\pre{\La{\sigma}}$};
\end{scope}
\begin{scope}[xshift=4cm,yshift=-3.6cm]
\draw (0,0.1) -- (0,0) -- (4,0) -- (4,0.1);
\filldraw[fill=black!5,draw=black,densely dotted] (0,0) rectangle (4,0.5);
\draw[gray] (0.5,0) -- (0.5,0.1);
\draw[densely dashed,gray] (0.5,4.1) -- (0.5,0.3);
\draw[gray] (2.6,0) -- (2.6,0.1);
\draw[densely dashed,gray] (2.6,4.1) -- (2.6,0.3);
\draw[gray] (3.0,0) -- (3.0,0.1);
\draw[densely dashed,gray] (3.0,4.1) -- (3.0,0.3);
\draw[gray] (3.6,0) -- (3.6,0.1);
\draw[densely dashed,gray] (3.6,4.1) -- (3.6,0.3);
\node at (0.25,0.25) {$\Sigma^+$};
\node at (0.5,0.2) {$s$};
\node at (1.75,0.25) {$\Sigma^+$};
\node at (2.6,0.2) {$s$};
\node at (2.8,0.24) {$\Sigma$};
\node at (3.0,0.2) {$s$};
\node at (3.35,0.25) {$\Sigma^+$};
\node at (3.6,0.2) {$s$};
\node at (3.8,0.24) {$\Sigma$};
\end{scope}
\begin{scope}[xshift=-4cm,yshift=-1.3cm]
\draw[thick,rounded corners=2pt] (1,-2.3) -- (0.85,-2.3) -- (0.85,1.8) -- (1,1.8);
\node at (0.4,-0.3) {\scalebox{3}{$\cap$}};
\draw[thick,rounded corners=2pt] (6.95,-2.3) -- (7.1,-2.3) -- (7.1,1.8) -- (6.95,1.8);
\node at (7.5,-0.3) {\scalebox{1}{$=\emptyset$}};
\end{scope}
\end{tikzpicture}
\end{document}
建议使用 TikZ 矩阵库的解决方案。
\documentclass{article}
\usepackage{tikz}\usetikzlibrary{matrix}
\newcommand{\La}[1]{\mathcal{L}_{#1}}
\newcommand{\pre}[1]{\overrightarrow{#1}}
\newcommand{\shuf}{\textnormal{shuf}}
\newcommand{\highlight}[2][black!5]{\mathchoice%
{\colorbox{#1}{$\displaystyle#2$}}%
{\colorbox{#1}{$\textstyle#2$}}%
{\colorbox{#1}{$\scriptstyle#2$}}%
{\colorbox{#1}{$\scriptscriptstyle#2$}}}%
\begin{document}
\begin{tikzpicture}
\begin{scope}
\matrix [row sep=-2.4mm,matrix of nodes,left delimiter=(,right delimiter=)] {
$\highlight{\shuf(\shuf(\shuf(\shuf(\Sigma^*\setminus \pre{\La{\sigma}},s),s),s),s)}$
\\
$\highlight{\shuf(\shuf(\shuf(\pre{\La{\sigma}},s),s),s)}\highlight[cyan!10]{~s~\Sigma\hspace{-2em}\phantom{(\pre{\La{\sigma}})}}$
\\
$\highlight{\shuf(\shuf(\shuf(\highlight{\Sigma^*\setminus\La{\sigma}},s),s),s)}\highlight[cyan!10]{~s~\Sigma\hspace{-14.3em}\phantom{\shuf(\shuf(\shuf(\highlight{\Sigma^*\setminus\La{\sigma}},s),s),s)}}$
\\
$\highlight[pink!30]{\Sigma^+~s~\hspace{-6.3em}\phantom{\shuf(\shuf(\Sigma^*))}}\highlight{\La{\sigma}\hspace{-6.3em}\phantom{\shuf(\shuf(\Sigma^*))}}\highlight[cyan!10]{~s~\shuf(\shuf(\Sigma^*,s),s)}$
\\
$\highlight{\shuf(\Sigma^*\setminus\La{\sigma},s)}\highlight[cyan!10]{~s~\shuf(\shuf(\Sigma^*,s),s)}$
\\
$\highlight[pink!30]{\Sigma^+~s~\hspace{-6.5em}\phantom{\shuf(\Sigma^*\setminus\pre{\La{\sigma}},s)}}\highlight{\shuf(\Sigma^*\setminus\pre{\La{\sigma}},s)}\highlight[cyan!10]{~s~\shuf(\Sigma^*,s)\hspace{-6.5em}\phantom{\shuf(\Sigma^*\setminus\pre{\La{\sigma}},s)}}$
\\
$\highlight{\Sigma^+~s~\Sigma^+~s~\Sigma~s~\Sigma^+~s~\Sigma}$
\\
};
\end{scope}
\begin{scope}[xshift=0cm,yshift=0cm]
\node[anchor=west] at (-4.6,0) {\scalebox{3}{$\cap$}};
\node[anchor=east] at (4.4,0) {\scalebox{1}{$=\emptyset$}};
\end{scope}
\begin{scope}[xshift=6.5cm,yshift=0cm]
\matrix [row sep=0mm,matrix of nodes] {
\filldraw[fill=black!5,draw=black,densely dotted] (0,0) rectangle (4,0.5);
\draw (0,0.1) -- (0,0) -- (4,0) -- (4,0.1);
\node at (1.9,0.1) {$w_{1,i}\notin\pre{\La{\sigma}}$};
\\
\filldraw[fill=cyan!10,draw=black,densely dotted] (3.6,0) rectangle (4,0.5);
\filldraw[fill=black!5,draw=black,densely dotted] (0,0) rectangle (3.6,0.5);
\draw (0,0.1) -- (0,0) -- (4,0) -- (4,0.1);
\node at (1.75,0.1) {$w_{1,i-1}\in\pre{\La{\sigma}}$};
\\
\filldraw[fill=cyan!10,draw=black,densely dotted] (3.6,0) rectangle (4,0.5);
\filldraw[fill=black!5,draw=black,densely dotted] (0,0) rectangle (3.6,0.5);
\draw (0,0.1) -- (0,0) -- (4,0) -- (4,0.1);
\node at (1.75,0.1) {$w_{1,i-1}\notin\La{\sigma}$};
\\
\filldraw[fill=pink!30,draw=black,densely dotted] (0,0) rectangle (0.5,0.5);
\filldraw[fill=cyan!10,draw=black,densely dotted] (2.6,0) rectangle (4,0.5);
\filldraw[fill=black!5,draw=black,densely dotted] (0.5,0) rectangle (2.6,0.5);
\draw (0,0.1) -- (0,0) -- (4,0) -- (4,0.1);
\node at (1.55,0.1) {$w_{j,k}\in\La{\sigma}$};
\\
\filldraw[fill=cyan!10,draw=black,densely dotted] (2.6,0) rectangle (4,0.5);
\filldraw[fill=black!5,draw=black,densely dotted] (0,0) rectangle (2.6,0.5);
\draw (0,0.1) -- (0,0) -- (4,0) -- (4,0.1);
\node at (1.55,0.1) {$w_{1,k}\notin\La{\sigma}$};
\\
\filldraw[fill=pink!30,draw=black,densely dotted] (0,0) rectangle (0.5,0.5);
\filldraw[fill=cyan!10,draw=black,densely dotted] (3,0) rectangle (4,0.5);
\filldraw[fill=black!5,draw=black,densely dotted] (0.5,0) rectangle (3,0.5);
\draw (0,0.1) -- (0,0) -- (4,0) -- (4,0.1);
\node at (1.7,0.1) {$w_{j,k+1}\notin\pre{\La{\sigma}}$};
\\
\draw (0,0.1) -- (0,0) -- (4,0) -- (4,0.1);
\filldraw[fill=black!5,draw=black,densely dotted] (0,0) rectangle (4,0.5);
\draw[gray] (0.5,0) -- (0.5,0.1);
\draw[gray] (2.6,0) -- (2.6,0.1);
\draw[gray] (3.0,0) -- (3.0,0.1);
\draw[gray] (3.6,0) -- (3.6,0.1);
\node at (0.25,0.1) {$\Sigma^+$};
\node at (0.5,0.1) {$s$};
\node at (1.75,0.1) {$\Sigma^+$};
\node at (2.6,0.1) {$s$};
\node at (2.8,0.1) {$\Sigma$};
\node at (3.0,0.1) {$s$};
\node at (3.35,0.1) {$\Sigma^+$};
\node at (3.6,0.1) {$s$};
\node at (3.8,0.1) {$\Sigma$};
\\
};
\end{scope}
\begin{scope}[xshift=4.53cm,yshift=-2.1cm]
\draw[densely dashed,gray] (0.5,4.25) -- (0.5,0.3);
\draw[densely dashed,gray] (2.6,4.25) -- (2.6,0.3);
\draw[densely dashed,gray] (3.0,4.25) -- (3.0,0.3);
\draw[densely dashed,gray] (3.6,4.25) -- (3.6,0.3);
\end{scope}
\end{tikzpicture}
\end{document}