# bmatrix - buggy? Alternating Color and not completely drawn

As you can see, my bmatrix is a little bit bugged and I don't know why...

This is the sourcecode:

$$\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)$$


Nothing magic inside of my equation. A simple example with \begin{bmatrix} 1 // 2 // 3 \end{bmatrix} has the same result and problem...

I'm importing this:

\RequirePackage{amsmath}
\RequirePackage{amsfonts}


Has anyone seen this problem before? What can I do to solve it?

-
Welcome to TeX.SE. It would be helpful if you composed a fully compilable MWE including \documentclass and the appropriate packages that sets up the problem. As it is, the code you provided does not add the colors. While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem. – Peter Grill May 30 '13 at 0:29
It gives what I assume to be the intended output for me, have you updated your packages recently? Also, is this really minimal? Where are the alternating row colors coming from? – Scott H. May 30 '13 at 0:31
Hey. Thanks for including my image! I thought about writing the full sourcecode for compiling inside my question, but I'm using a very complex .cls with over 600 lines which has a lot of dependencies... :( – Frame91 May 30 '13 at 0:32
The template is found on: github.com/dmke/thesis-template - maybe this will help? – Frame91 May 30 '13 at 0:34
I don't understand why thesis.cls uses babel if it is meant to use xelatex. – Gonzalo Medina May 30 '13 at 2:06

## 1 Answer

A poor man's trick would be to put the matrices twice, first with the row colors, then without:

\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{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{document}


The result is not perfect, the colors exceeds the brackets, but at least the delimiters are visible.

-