bmatrix - 有问题?交替颜色且未完全绘制

bmatrix - 有问题?交替颜色且未完全绘制

在此处输入图片描述

正如您所看到的,我的bmatrix有点问题,但我不知道为什么......

这是源代码:

\begin{equation}
\begin{bmatrix}
\mathbf{d}_x \\
\mathbf{d}_y \\
\mathbf{d}_z \\
\end{bmatrix}=\begin{bmatrix}
   1 & 0 & 0  \\
   0 & {\cos \mathbf{\theta}_x } & { - \sin \mathbf{\theta}_x }  \\
   0 & { \sin \mathbf{\theta}_x } & { \cos \mathbf{\theta}_x }  \\
\end{bmatrix}\begin{bmatrix}
   { \cos \mathbf{\theta}_y } & 0 & { \sin \mathbf{\theta}_y }  \\
   0 & 1 & 0  \\
   { - \sin \mathbf{\theta}_y } & 0 & { \cos \mathbf{\theta}_y }  \\
\end{bmatrix}\begin{bmatrix}
   { \cos \mathbf{\theta}_z } & { - \sin \mathbf{\theta}_z } & 0  \\
   { \sin \mathbf{\theta}_z } & { \cos \mathbf{\theta}_z } & 0  \\
   0 & 0 & 1  \\
\end{bmatrix}\left( {\begin{bmatrix}
   \mathbf{a}_x  \\
   \mathbf{a}_y  \\
   \mathbf{a}_z  \\
\end{bmatrix} - \begin{bmatrix}
   \mathbf{c}_x  \\
   \mathbf{c}_y  \\
\mathbf{c}_z  \\
\end{bmatrix}} \right)
\end{equation}

我的等式中没有什么神奇之处。一个简单的例子,\begin{bmatrix} 1 // 2 // 3 \end{bmatrix}结果和问题都是一样的……

我正在导入这个:

\RequirePackage{amsmath}
\RequirePackage{amsfonts}

有人见过这个问题吗?我该怎么做才能解决这个问题?

答案1

一个穷人的伎俩是将矩阵放两次,第一次带有行颜色,然后不带有:

\documentclass[english]{thesis}
\title{Title}
\geometry{hmargin=25mm}

\rowcolors{1}{yellow}{white}

\usepackage{environ}
\makeatletter
% Remember environment `bmatrix' in environment `org@bmatrix'.
\let\org@bmatrix\bmatrix
\let\endorg@bmatrix\endbmatrix
% (\RenewEnviron complains with an error, thus \NewEnviron is used
%  and the old meaning of environment `bmatrix' needs to be cleared.)
\let\bmatrix\relax
\let\endbmatrix\relax
\NewEnviron{bmatrix}{%
  \mbox{%
    \edef\BODY{%
      $\noexpand\m@th\noexpand\begin{org@bmatrix}%
      \unexpanded\expandafter{\BODY}%
      \noexpand\end{org@bmatrix}$%   
    }%
    \rlap{\BODY}%
    \@rowcolorsfalse
    \BODY
  }%
}   
% Assuming, environment `bmatrix' is not put in \scriptstyle or
% \scriptscriptstyle (subscript, superscript, fractions, ...). 
% Otherwise \mathpalette (or \mathchoice) is needed.
\makeatother

\begin{document}

\begin{equation}
\begin{bmatrix}
\mathbf{d}_x \\
\mathbf{d}_y \\
\mathbf{d}_z \\   
\end{bmatrix}=\begin{bmatrix}
   1 & 0 & 0  \\
   0 & {\cos \mathbf{\theta}_x } & { - \sin \mathbf{\theta}_x }  \\
   0 & { \sin \mathbf{\theta}_x } & { \cos \mathbf{\theta}_x }  \\
\end{bmatrix}\begin{bmatrix}
   { \cos \mathbf{\theta}_y } & 0 & { \sin \mathbf{\theta}_y }  \\
   0 & 1 & 0  \\
   { - \sin \mathbf{\theta}_y } & 0 & { \cos \mathbf{\theta}_y }  \\
\end{bmatrix}\begin{bmatrix}
   { \cos \mathbf{\theta}_z } & { - \sin \mathbf{\theta}_z } & 0  \\
   { \sin \mathbf{\theta}_z } & { \cos \mathbf{\theta}_z } & 0  \\
   0 & 0 & 1  \\
\end{bmatrix}\left( {\begin{bmatrix}
   \mathbf{a}_x  \\
   \mathbf{a}_y  \\
   \mathbf{a}_z  \\
\end{bmatrix} - \begin{bmatrix}
   \mathbf{c}_x  \\
   \mathbf{c}_y  \\
\mathbf{c}_z  \\
\end{bmatrix}} \right)
\end{equation}  

\end{document}

结果

结果并不完美,颜色超出了括号,但至少分隔符是可见的。

相关内容