1

I am using De Gruyter template which redefines the tabular command so that it uses basically booktabs commands.

It is possible to turn this feature off using the command \baretabulars, but it seems that the commands to color the table do not make any effect: \cellcolor, \rowcolor and \columncolor. For example, the following table does not display any color.

\begin{baretabulars}
\begin{tabular}{ |c|c| } 
\hline
\rowcolor{red} 1 & 2 \\
\hline 
3 & 4 \\ 
\hline
\end{tabular}
\end{baretabulars}

I wonder if it is possible to color a table using the command \baretabulars since I want my table with vertical lines.

I am sorry if this question is not in the right standards.

  • 2
    Welcome to TeX.SE! Please provide a MWE (Minimal Working Example, a small, complete and compilable document), which demonstrate your problem. – Zarko Nov 11 '19 at 21:51
  • 1
    booktabs rules and coloured cells, rows or columns do not work nicely together. The link is to a commercial available book (€99) so I assume we have to shell out that amount to be able to help you. You may contact the author of the book. – Sveinung Nov 12 '19 at 08:57
  • @Sveinung Thank you for the reply. I don't really know what happened, but I am almost sure I inserted another link. But anyways, I have updated the link, but it seems De Gruyter removed it. Yesterday was working. Is it possible to upload here the sty file? – Bernardo Nov 12 '19 at 10:05
  • Since this is a commercial book, and the style file is not published at CTAN, I assume they are copyrighted. You have to check with the author and publisher what you can and cannot do. – Sveinung Nov 12 '19 at 10:09
  • OK Thank you for the reply. – Bernardo Nov 12 '19 at 10:10

1 Answers1

1

For those who will have the same problem as me, I found a workaround here for this. The idea is to use tikzpicture in order to produce a table. In my case, I wanted to create a Cayley table so it suits me well. So adjusting the code for my example we would have something like:

\begin{baretabulars}
\begin{tikzpicture}

\tikzset{square matrix/.style={
    matrix of nodes,
    column sep=-\pgflinewidth, row sep=-\pgflinewidth,
    nodes={draw,
      minimum height=#1,
      anchor=center,
      text width=#1,
      align=center,
      inner sep=2pt
    },
  },
  square matrix/.default=0.45cm
}

\matrix[square matrix]
{
|[fill=red]|1 & |[fill=red]|2 \\
3 & 4 \\
};

\end{tikzpicture}
\end{baretabulars}