JDMCreator / LaTeXTableEditor

readme
MIT License
143 stars 15 forks source link

Error with alternative row coloring #47

Closed avivajpeyi closed 3 years ago

avivajpeyi commented 3 years ago

Hi! First of all, thanks for creating this tool!

Below is how I would like to format my table: Screen Shot 2021-07-01 at 4 20 35 pm

When I use https://www.latex-tables.com/ to generate the above and copy the contents into my overleaf file, I get the following:

Screen Shot 2021-07-01 at 4 19 18 pm

Do you have any ideas what might be going on / suggestions on how I can fix this?

Thanks!

Latex code:
% \usepackage{multirow}
% \usepackage{colortbl}
% \usepackage{hhline}
% \usepackage{vcell}

\begin{table}
\centering
\caption{Asdadasdadsdadasdadad}
\arrayrulecolor{black}
\begin{tabular}{ll|c|cc|cc|ccc|c} 
\hhline{>{\arrayrulecolor{black}}->{\arrayrulecolor[rgb]{0.945,0.945,0.945}}----------}
\rowcolor[rgb]{0.945,0.945,0.945} {\cellcolor[rgb]{0.945,0.945,0.945}}                        & {\cellcolor[rgb]{0.945,0.945,0.945}}                            & \multicolumn{8}{c|}{\vcell{Significances}}                                                          & {\cellcolor[rgb]{0.945,0.945,0.945}}                      \\[-\rowheight]
\rowcolor[rgb]{0.945,0.945,0.945} {\cellcolor[rgb]{0.945,0.945,0.945}}                        & {\cellcolor[rgb]{0.945,0.945,0.945}}                            & \multicolumn{8}{c|}{\printcellbottom}                                                               & {\cellcolor[rgb]{0.945,0.945,0.945}}                      \\
\rowcolor[rgb]{0.945,0.945,0.945} {\cellcolor[rgb]{0.945,0.945,0.945}}                        & {\cellcolor[rgb]{0.945,0.945,0.945}}                            & BCR  & \multicolumn{2}{c|}{GWTC} & IAS                       & Pratten & \multicolumn{3}{c|}{PyCBC} & {\cellcolor[rgb]{0.945,0.945,0.945}}                      \\
\rowcolor[rgb]{0.945,0.945,0.945} \multirow{-3}{*}{{\cellcolor[rgb]{0.945,0.945,0.945}}Event} & \multirow{-3}{*}{{\cellcolor[rgb]{0.945,0.945,0.945}}Catalogue} &      & pyCBC & GstLal            &                           &         & S    & OGC-3 & OGC-3       & \multirow{-3}{*}{{\cellcolor[rgb]{0.945,0.945,0.945}}tc}  \\ 
\arrayrulecolor{black}\hline
GW170104                                                                                      & GWTC-1                                                          & 0.97 & 1.00  & 1.00              &                           & 1.00    &      & 1.00  &             & 1167559936.60                                             \\
\rowcolor[rgb]{0.945,0.945,0.945} GW170121                                                    & IAS-1                                                           & 0.83 &       & 1.00              & 1.00                      & 0.53    &      & 1.00  & 1.00        & 1169069154.57                                             \\
170209                                                                                        & -                                                               & 0.32 &       &                   &                           &         &      &       &             & 1170659643.47                                             \\
\rowcolor[rgb]{0.945,0.945,0.945} 170222                                                      & -                                                               & 0.58 &       &                   &                           &         &      &       &             & 1171814476.97                                             \\
170302                                                                                        & IAS-1                                                           & 0.78 &       & 0.45              & 0.45                      & 0.00    &      &       &             & 1172487817.48                                             \\
\rowcolor[rgb]{0.945,0.945,0.945} GW170304                                                    & IAS-1                                                           & 0.94 &       & 0.70              & 0.99                      & 0.03    &      & 0.70  & 0.70        & 1172680691.36                                             \\
GWC170402                                                                                     & IAS-2                                                           & 0.60 &       & 0.68              & \multicolumn{1}{c|}{0.68} & 0.00    & 0.03 &       &             & 1175205128.57                                             \\
\rowcolor[rgb]{0.945,0.945,0.945} GW170403                                                    & IAS-1                                                           & 0.54 &       & 0.03              & 0.56                      & 0.27    &      & 0.03  & 0.71        & 1175295989.22                                             \\
GW170608                                                                                      & GWTC-1                                                          & 0.99 & 1.00  & 0.92              &                           & 1.00    &      &       &             & 1180922494.50                                             \\
\rowcolor[rgb]{0.945,0.945,0.945} GW170727                                                    & IAS-1                                                           & 0.98 &       & 0.99              & 0.98                      & 0.66    &      & 0.99  & 1.00        & 1185152688.02                                             \\
GW170729                                                                                      & GWTC-1                                                          & 0.98 & 0.52  & 0.98              &                           & 1.00    &      & 1.00  & 0.99        & 1185389807.30                                             \\
\rowcolor[rgb]{0.945,0.945,0.945} GW170809                                                    & GWTC-1                                                          & 0.99 & 1.00  & 0.99              &                           & 1.00    &      & 1.00  & 1.00        & 1186302519.75                                             \\
GW170814                                                                                      & GWTC-1                                                          & 1.00 & 1.00  & 1.00              &                           & 1.00    &      & 1.00  & 1.00        & 1186741861.53                                             \\
\rowcolor[rgb]{0.945,0.945,0.945} GW170817A                                                   & IAS-2                                                           & 0.92 &       & 0.86              & 0.86                      & 0.02    & 0.36 &       &             & 1186974184.72                                            
\end{tabular}
\end{table}
avivajpeyi commented 3 years ago

Interesting! When I put the https://www.latex-tables.com/ code into a latex document, it works like a charm! Eg:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{multirow}
\usepackage{colortbl}
\usepackage{hhline}
\usepackage{vcell}

\title{table test}
\author{avi vajpeyi }
\date{July 2021}

\begin{document}

\maketitle

% \usepackage{multirow}
% \usepackage{colortbl}
% \usepackage{vcell}

\begin{table}
\centering
\begin{tabular}{ll|c|cc|cc|ccc|c}
\rowcolor[rgb]{0.945,0.945,0.945} {\cellcolor[rgb]{0.945,0.945,0.945}}                        & {\cellcolor[rgb]{0.945,0.945,0.945}}                            & \multicolumn{8}{c|}{\vcell{Significances}}                                                          & {\cellcolor[rgb]{0.945,0.945,0.945}}                      \\[-\rowheight]
\rowcolor[rgb]{0.945,0.945,0.945} {\cellcolor[rgb]{0.945,0.945,0.945}}                        & {\cellcolor[rgb]{0.945,0.945,0.945}}                            & \multicolumn{8}{c|}{\printcellbottom}                                                               & {\cellcolor[rgb]{0.945,0.945,0.945}}                      \\
\rowcolor[rgb]{0.945,0.945,0.945} {\cellcolor[rgb]{0.945,0.945,0.945}}                        & {\cellcolor[rgb]{0.945,0.945,0.945}}                            & BCR  & \multicolumn{2}{c|}{GWTC} & IAS                       & Pratten & \multicolumn{3}{c|}{PyCBC} & {\cellcolor[rgb]{0.945,0.945,0.945}}                      \\
\rowcolor[rgb]{0.945,0.945,0.945} \multirow{-3}{*}{{\cellcolor[rgb]{0.945,0.945,0.945}}Event} & \multirow{-3}{*}{{\cellcolor[rgb]{0.945,0.945,0.945}}Catalogue} &      & pyCBC & GstLal            &                           &         & S    & OGC-3 & OGC-3       & \multirow{-3}{*}{{\cellcolor[rgb]{0.945,0.945,0.945}}tc}  \\ 
\hline
GW170104                                                                                      & GWTC-1                                                          & 0.97 & 1.00  & 1.00              &                           & 1.00    &      & 1.00  &             & 1167559936.60                                             \\
\rowcolor[rgb]{0.945,0.945,0.945} GW170121                                                    & IAS-1                                                           & 0.83 &       & 1.00              & 1.00                      & 0.53    &      & 1.00  & 1.00        & 1169069154.57                                             \\
170209                                                                                        & -                                                               & 0.32 &       &                   &                           &         &      &       &             & 1170659643.47                                             \\
\rowcolor[rgb]{0.945,0.945,0.945} 170222                                                      & -                                                               & 0.58 &       &                   &                           &         &      &       &             & 1171814476.97                                             \\
170302                                                                                        & IAS-1                                                           & 0.78 &       & 0.45              & 0.45                      & 0.00    &      &       &             & 1172487817.48                                             \\
\rowcolor[rgb]{0.945,0.945,0.945} GW170304                                                    & IAS-1                                                           & 0.94 &       & 0.70              & 0.99                      & 0.03    &      & 0.70  & 0.70        & 1172680691.36                                             \\
GWC170402                                                                                     & IAS-2                                                           & 0.60 &       & 0.68              & \multicolumn{1}{c|}{0.68} & 0.00    & 0.03 &       &             & 1175205128.57                                             \\
\rowcolor[rgb]{0.945,0.945,0.945} GW170403                                                    & IAS-1                                                           & 0.54 &       & 0.03              & 0.56                      & 0.27    &      & 0.03  & 0.71        & 1175295989.22                                             \\
GW170608                                                                                      & GWTC-1                                                          & 0.99 & 1.00  & 0.92              &                           & 1.00    &      &       &             & 1180922494.50                                             \\
\rowcolor[rgb]{0.945,0.945,0.945} GW170727                                                    & IAS-1                                                           & 0.98 &       & 0.99              & 0.98                      & 0.66    &      & 0.99  & 1.00        & 1185152688.02                                             \\
GW170729                                                                                      & GWTC-1                                                          & 0.98 & 0.52  & 0.98              &                           & 1.00    &      & 1.00  & 0.99        & 1185389807.30                                             \\
\rowcolor[rgb]{0.945,0.945,0.945} GW170809                                                    & GWTC-1                                                          & 0.99 & 1.00  & 0.99              &                           & 1.00    &      & 1.00  & 1.00        & 1186302519.75                                             \\
GW170814                                                                                      & GWTC-1                                                          & 1.00 & 1.00  & 1.00              &                           & 1.00    &      & 1.00  & 1.00        & 1186741861.53                                             \\
\rowcolor[rgb]{0.945,0.945,0.945} GW170817A                                                   & IAS-2                                                           & 0.92 &       & 0.86              & 0.86                      & 0.02    & 0.36 &       &             & 1186974184.72                                            
\end{tabular}
\end{table}

\end{document}

So it must something with my preamble which is messing it up..

\documentclass[%
%reprint,
%superscriptaddress,
%groupedaddress,
%unsortedaddress,
%runinaddress,
%frontmatterverbose, 
% preprint,
%preprintnumbers,
 nofootinbib,
%nobibnotes,
%bibnotes,
 amsmath,amssymb,
 aps,
%pra,
%prb,
%rmp,
%prstab,
%prstper,
%floatfix,
 twocolumn,
 superscriptaddress
]{revtex4-2}

\usepackage{aas_macros}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{array}
\usepackage{color,units}
\usepackage[dvipsnames]{xcolor} % for more colours!
\usepackage{lineno}
\usepackage{dcolumn}
\usepackage{longtable}
\usepackage[normalem]{ulem} %% for striking out text
\usepackage{subfigure}
\usepackage[T1]{fontenc}
\usepackage[breaklinks]{hyperref}
\usepackage{booktabs}
\usepackage{xspace} 
\usepackage{bm}% bold math
\usepackage{graphicx} % Include figure files

%%% Table stuff
\usepackage{multirow}
\usepackage{colortbl}
\usepackage{hhline}
\usepackage{vcell}
\addtolength{\extrarowheight}{\belowrulesep}
\aboverulesep=0pt
\belowrulesep=0pt
avivajpeyi commented 3 years ago

I've been able to further isolate the issue. I think its to do with revtex4-2. Eg:

Using \documentclass[aps, twocolumn]{revtex4-2}

\documentclass[aps, twocolumn]{revtex4-2}

\usepackage{multirow}
\usepackage{colortbl}
\usepackage{vcell}

\begin{document}

\begin{table*}
\centering
\begin{tabular}{ll|c|cc|cc|ccc|c}
\rowcolor[rgb]{0.945,0.945,0.945} {\cellcolor[rgb]{0.945,0.945,0.945}}                        & {\cellcolor[rgb]{0.945,0.945,0.945}}                            & \multicolumn{8}{c|}{\vcell{Significances}}                                                          & {\cellcolor[rgb]{0.945,0.945,0.945}}                      \\[-\rowheight]
\rowcolor[rgb]{0.945,0.945,0.945} {\cellcolor[rgb]{0.945,0.945,0.945}}                        & {\cellcolor[rgb]{0.945,0.945,0.945}}                            & \multicolumn{8}{c|}{\printcellbottom}                                                               & {\cellcolor[rgb]{0.945,0.945,0.945}}                      \\
\rowcolor[rgb]{0.945,0.945,0.945} {\cellcolor[rgb]{0.945,0.945,0.945}}                        & {\cellcolor[rgb]{0.945,0.945,0.945}}                            & BCR  & \multicolumn{2}{c|}{GWTC} & IAS                       & Pratten & \multicolumn{3}{c|}{PyCBC} & {\cellcolor[rgb]{0.945,0.945,0.945}}                      \\
\rowcolor[rgb]{0.945,0.945,0.945} \multirow{-3}{*}{{\cellcolor[rgb]{0.945,0.945,0.945}}Event} & \multirow{-3}{*}{{\cellcolor[rgb]{0.945,0.945,0.945}}Catalogue} &      & pyCBC & GstLal            &                           &         & S    & OGC-3 & OGC-3       & \multirow{-3}{*}{{\cellcolor[rgb]{0.945,0.945,0.945}}tc}  \\ 
\hline
GW170104                                                                                      & GWTC-1                                                          & 0.97 & 1.00  & 1.00              &                           & 1.00    &      & 1.00  &             & 1167559936.60                                             \\
\rowcolor[rgb]{0.945,0.945,0.945} GW170121                                                    & IAS-1                                                           & 0.83 &       & 1.00              & 1.00                      & 0.53    &      & 1.00  & 1.00        & 1169069154.57                                             \\
170209                                                                                        & -                                                               & 0.32 &       &                   &                           &         &      &       &             & 1170659643.47                                             \\
\rowcolor[rgb]{0.945,0.945,0.945} 170222                                                      & -                                                               & 0.58 &       &                   &                           &         &      &       &             & 1171814476.97                                             \\
170302                                                                                        & IAS-1                                                           & 0.78 &       & 0.45              & 0.45                      & 0.00    &      &       &             & 1172487817.48                                             \\
\end{tabular}
\end{table*}

\end{document}

Screen Shot 2021-07-02 at 11 02 10 am

Using \documentclass[twocolumn]{article}

\documentclass[twocolumn]{article}

\usepackage{multirow}
\usepackage{colortbl}
\usepackage{vcell}

\begin{document}

\begin{table*}
\centering
\begin{tabular}{ll|c|cc|cc|ccc|c}
\rowcolor[rgb]{0.945,0.945,0.945} {\cellcolor[rgb]{0.945,0.945,0.945}}                        & {\cellcolor[rgb]{0.945,0.945,0.945}}                            & \multicolumn{8}{c|}{\vcell{Significances}}                                                          & {\cellcolor[rgb]{0.945,0.945,0.945}}                      \\[-\rowheight]
\rowcolor[rgb]{0.945,0.945,0.945} {\cellcolor[rgb]{0.945,0.945,0.945}}                        & {\cellcolor[rgb]{0.945,0.945,0.945}}                            & \multicolumn{8}{c|}{\printcellbottom}                                                               & {\cellcolor[rgb]{0.945,0.945,0.945}}                      \\
\rowcolor[rgb]{0.945,0.945,0.945} {\cellcolor[rgb]{0.945,0.945,0.945}}                        & {\cellcolor[rgb]{0.945,0.945,0.945}}                            & BCR  & \multicolumn{2}{c|}{GWTC} & IAS                       & Pratten & \multicolumn{3}{c|}{PyCBC} & {\cellcolor[rgb]{0.945,0.945,0.945}}                      \\
\rowcolor[rgb]{0.945,0.945,0.945} \multirow{-3}{*}{{\cellcolor[rgb]{0.945,0.945,0.945}}Event} & \multirow{-3}{*}{{\cellcolor[rgb]{0.945,0.945,0.945}}Catalogue} &      & pyCBC & GstLal            &                           &         & S    & OGC-3 & OGC-3       & \multirow{-3}{*}{{\cellcolor[rgb]{0.945,0.945,0.945}}tc}  \\ 
\hline
GW170104                                                                                      & GWTC-1                                                          & 0.97 & 1.00  & 1.00              &                           & 1.00    &      & 1.00  &             & 1167559936.60                                             \\
\rowcolor[rgb]{0.945,0.945,0.945} GW170121                                                    & IAS-1                                                           & 0.83 &       & 1.00              & 1.00                      & 0.53    &      & 1.00  & 1.00        & 1169069154.57                                             \\
170209                                                                                        & -                                                               & 0.32 &       &                   &                           &         &      &       &             & 1170659643.47                                             \\
\rowcolor[rgb]{0.945,0.945,0.945} 170222                                                      & -                                                               & 0.58 &       &                   &                           &         &      &       &             & 1171814476.97                                             \\
170302                                                                                        & IAS-1                                                           & 0.78 &       & 0.45              & 0.45                      & 0.00    &      &       &             & 1172487817.48                                             \\
\end{tabular}
\end{table*}

\end{document}

Screen Shot 2021-07-02 at 11 02 31 am

avivajpeyi commented 3 years ago

I ended up using the package nicematrix!