# How to customize IEEEeqnarraybox tables?

The package ieeetrantools provides access to the environment IEEEeqnarraybox which can be used to create nice tables and matrices. Since it is meant for IEEE journals, it doesn't provide options to add some "style" (dashed lines, background color for rows/columns, ...). How could one customize tables/matrices created with this environment?

For example, I recreated a table from the ieeetran manual and tried to add a background color to a row with the package hf-tikz. The result is not great. The border hf-tikz adds is to thick and it messes with the right-hand side vertical and horizontal lines of the table.

Code:

%! TEX program = xelatex

\documentclass[fontsize = 12pt]{scrbook}

\usepackage{IEEEtrantools}

\usepackage[customcolors]{hf-tikz}

\tikzset{style green/.style={
set fill color=green!50!lime!60,
set border color=black,
},
hor/.style={
above left offset={0.0,0.7},
below right offset={-0.1,0.-0.55},
#1
},
}

\begin{document}

\begin{table}
\centering
\caption{Possible $\Omega$ Functions}
\label{table_omega}
\IEEEeqnarrayrulerow\\
&\mbox{Range}&&\Omega(m)&\\
\IEEEeqnarraydblrulerow\\
\IEEEeqnarrayseprow[3pt]\\
&x < 0&&\Omega(m)=\sum\limits_{i=0}^{m}K^{-i}& \IEEEeqnarraystrutsize{0pt}{0pt}\\
\IEEEeqnarrayseprow[3pt]\\
\IEEEeqnarrayrulerow\\
\IEEEeqnarrayseprow[3pt]\\
&x \ge 0&&\Omega(m)=\sqrt{m}\hfill& \IEEEeqnarraystrutsize{0pt}{0pt}\\
\IEEEeqnarrayseprow[3pt]\\
\IEEEeqnarrayrulerow
\end{IEEEeqnarraybox}
\end{table}

\begin{table}
\centering
\caption{Possible $\Omega$ Functions}
\label{table_omega2}
\IEEEeqnarrayrulerow\\
&\mbox{Range}&&\Omega(m)&\\
\IEEEeqnarraydblrulerow\\
\IEEEeqnarrayseprow[3pt]\\
\tikzmarkin[disable rounded corners=true,hor=style green]{row}&x < 0&&\Omega(m)=\sum\limits_{i=0}^{m}K^{-i}& \tikzmarkend{row} \IEEEeqnarraystrutsize{0pt}{0pt}\\
\IEEEeqnarrayseprow[3pt]\\
\IEEEeqnarrayrulerow\\
\IEEEeqnarrayseprow[3pt]\\
&x \ge 0&&\Omega(m)=\sqrt{m}\hfill& \IEEEeqnarraystrutsize{0pt}{0pt}\\
\IEEEeqnarrayseprow[3pt]\\
\IEEEeqnarrayrulerow
\end{IEEEeqnarraybox}
\end{table}

\end{document}

• You can obtain this layout without tikz and IEEtrantools in a very simple way. – Bernard Aug 1 at 13:47
• ....or using nicematrix package. – Sebastiano Aug 1 at 16:03

For information, here is how to do easily such a table with nicematrix.

\documentclass{article}
\usepackage{nicematrix}
\usepackage{xcolor}
\usepackage{colortbl}

\begin{document}

\NiceMatrixOptions{cell-space-top-limit=3pt,cell-space-bottom-limit=3pt}
\doublerulesepcolor{white}

$\begin{NiceArray}{cl}[vlines,code-before = \rowcolor{green!15}{2}] \hline \text{Range}&\multicolumn{1}{c}{\Omega(m)} \\ \hline\hline x < 0&\Omega(m)=\sum\limits_{i=0}^{m}K^{-i} \\ \hline x \ge 0&\Omega(m)=\sqrt{m} \\ \hline \end{NiceArray}$

\end{document}


With such a code, you won't have artefacts as in the PDF viewers as you have sometimes if you use only the tools of colortbl.

• Great...thanks for the +1 on my comment. – Sebastiano Aug 1 at 22:36