我有以下 2 个矩阵。如果我这样做:
\documentclass{article}
\usepackage{amsmath}
\usepackage[usenames,dvipsnames]{xcolor}
\newcommand\x{\times}
% requires version 0.3 of the package
\usepackage[customcolors]{hf-tikz}
\tikzset{style EstiloRojo/.style={
set fill color=red!35!,
set border color=MidnightBlue,
},
style EstiloAzul/.style={
set fill color=MidnightBlue!35!,
set border color=red,
},
hor/.style={
above left offset={-0.15,0.35},
below right offset={0.15,-0.160},
#1
},
ver/.style={
above left offset={-0.1,0.4},
below right offset={0.15,-0.20},
#1
}
}
\begin{document}
\begin{equation}\label{eq:appendcol}
\left(\begin{array}{cccc}
\tikzmarkin[ver=style red]{col 1}\x & \x & \tikzmarkin[ver=style red]{col 2} \x & \x \\
0 & \x & \x & \x \\
0 & 0 & \x & \x \\
0 & 0 & 0 & \x \\
a \tikzmarkend{col 1} & b & c \tikzmarkend{col 2} & d \\
\end{array}\right)
\end{equation}
\begin{equation}\label{eq:appendcol}
\left(\begin{array}{cccc}
\tikzmarkin[ver=style red]{col 1}\x & \x & \tikzmarkin[ver=style red]{col 2} \x & \x \\
0 & \x & \x & \x \\
0 & 0 & \x & \x \\
0 & 0 & 0 & \x \\
a \tikzmarkend{col 1} & b & c \tikzmarkend{col 2} & d \\
\end{array}\right)
\end{equation}
\end{document}
垂直突出显示从第一个矩阵延续到第二个矩阵,侵入它们之间的空间。结果:
我该如何解决?感谢您的帮助。
答案1
正如 percusse 在评论中所建议的那样,第二个等式中的标识符应该不同。引用手册第 2 页:
请注意,分隔符标签(也称为标记 ID,应唯一地表征突出显示的部分。重复使用相同的名称多次会导致不良结果。本文档中有一些示例,说明了一些提供一致名称的准则。
因此:
\documentclass{article}
\usepackage{amsmath}
\usepackage[usenames,dvipsnames]{xcolor}
\newcommand\x{\times}
% requires version 0.3 of the package
\usepackage[customcolors]{hf-tikz}
\tikzset{style red/.style={
set fill color=red!35!,
set border color=MidnightBlue,
},
style EstiloAzul/.style={
set fill color=MidnightBlue!35!,
set border color=red,
},
hor/.style={
above left offset={-0.15,0.35},
below right offset={0.15,-0.160},
#1
},
ver/.style={
above left offset={-0.1,0.4},
below right offset={0.15,-0.20},
#1
}
}
\begin{document}
\begin{equation}\label{eq:appendcol}
\left(\begin{array}{cccc}
\tikzmarkin[ver=style red]{col 1}\x & \x & \tikzmarkin[ver=style red]{col 2} \x & \x \\
0 & \x & \x & \x \\
0 & 0 & \x & \x \\
0 & 0 & 0 & \x \\
a \tikzmarkend{col 1} & b & c \tikzmarkend{col 2} & d \\
\end{array}\right)
\end{equation}
\begin{equation}\label{eq:appendcol-second}
\left(\begin{array}{cccc}
\tikzmarkin[ver=style red]{col 1-a}\x & \x & \tikzmarkin[ver=style red]{col 2-a} \x & \x \\
0 & \x & \x & \x \\
0 & 0 & \x & \x \\
0 & 0 & 0 & \x \\
a \tikzmarkend{col 1-a} & b & c \tikzmarkend{col 2-a} & d \\
\end{array}\right)
\end{equation}
\end{document}
结果: