# Math cases align being colored as a table

My cases environment is being colored as a table. I do not want that. Seems tikz is causing this, because removing it from document fix, but I use tikz everywhere in my real document.

Is there any other solutions for coloring tables without mess with cases environment?

Below the MWE (compiled with LuaLatex)

\documentclass[table]{article}
\usepackage{polyglossia}
\usepackage{amsmath}
\usepackage{tikz}

\begin{document}

\rowcolors{2}{green}{pink}

\begin{table}[htb]
\centering
\begin{tabular}{c|c}
a & b  \\
\hline
1 & 2 \\
3 & 4
\end{tabular}
\end{table}

\begin{align*}
\begin{cases}
x + y &\le 2 \\
x - y &\ge 2
\end{cases}
\end{align*}
\end{document}

• When one removes \usepackage{tikz} from your MWE one gets ! Undefined control sequence. l.8 \rowcolors {2}{green}{pink}. True, the cases won't be colored then but is this really what you want to say? Can you provide us with a code which runs when removing tikz and substantiates that tikz is the culprit? – user121799 Jun 8 '19 at 18:48
• Please also remove the rowcolors. Since, seems rowcolors is being provided by tikz. – Lin Jun 8 '19 at 18:50
• Seems is a mix of [table] parameter and rowcolors, don't know who really provides. Don't know enough about latex internals. – Lin Jun 8 '19 at 18:52
• Yes, if you remove \rowcolors, neither the table nor the cases environment will be colored. \rowcolors can be made work by adding \usepackage[table]{xcolor} \usepackage{colortbl}, i.e. you do not need tikz for that. So if you do not want the cases to be colored, either do not use \rowcolors, or just use them locally in the tables you want to color. – user121799 Jun 8 '19 at 18:52
• should be used the xcolor or colortbl or both? – Lin Jun 8 '19 at 18:53

## 1 Answer

I read your question as

• you want to color the table and not the cases environment and
• you want to use tikz.

This can be accomplished by using \rowcolors only locally.

\documentclass[table]{article}
\usepackage{polyglossia}
\usepackage{amsmath}
\usepackage{tikz}

\begin{document}

\begin{table}[htb]
\centering\rowcolors{2}{green}{pink}
\begin{tabular}{c|c}
a & b  \\
\hline
1 & 2 \\
3 & 4
\end{tabular}
\end{table}

\begin{align*}
\begin{cases}
x + y &\le 2 \\
x - y &\ge 2
\end{cases}
\end{align*}
\end{document}


Instead of \usepackage{tikz} you could also use

\usepackage[table]{xcolor}
\usepackage{colortbl}


to make the above example compile.

Of course, you can make things more automatic by patching \begin{table} etc. but I am not necessarily a fan of these hacks.

• thanks. That is what I was trying to figure out. – Lin Jun 8 '19 at 18:56