0

I have a table that uses alternating white and gray colored rows, but there is always a lack of color applied to the intercolumn space. I have tried what other threads suggested in using variations of tabular like tabularx, but they all reproduce exactly the same table with missing intercolumn color. Even copy and pasting examples in comments with attached pictures, my environment reproduces their tables with no color applied to the intercolumn space. I am assuming that my issue lies with the documentclass being AAStex, but I do not have any other option. Is there something I can define myself to correct this behavior?

\rowcolors{2}{white}{gray!25}
\begin{tabular}{llllll}
\toprule
Cluster ID & Distance (pc) & Members & Age (Gyr) & $[\frac{Fe}{H}]$ & Reddening \\ \midrule
IC4651     & 942.78        & 950     & 1.585     & 0.5              & 0.04      \\
M35        & 871.02        & 1231    & 0.056     & 0.0              & 0.46      \\
M46        & 1667.83       & 2000    & 0.398     & 0.25             & 0.17      \\
M47        & 479.27        & 470     & 0.045     & 0.0              & 0.25      \\
M48        & 759.42        & 638     & 0.447     & 0.25             & 0.02      \\
M50        & 973.31        & 908     & 0.063     & 0.0              & 0.44      \\
M67        & 873.41        & 1000    & 3.548     & 0.25             & 0.0       \\
NGC188     & 1940.26       & 802     & 5.012     & 0.5              & 0.0       \\
NGC2158    & 882.04        & 854     & 0.045     & 0.0              & 0.41      \\
NGC2204    & 4895.61       & 138     & 1.413     & 0.25             & 0.0       \\
NGC2301    & 888.75        & 935     & 0.126     & 0.25             & 0.09      \\
NGC2355    & 1941.65       & 321     & 0.794     & 0.0              & 0.22      \\
NGC2360    & 1121.45       & 736     & 0.708     & 0.5              & 0.0       \\
NGC6633    & 380.77        & 264     & 0.708     & 0.25             & 0.11      \\
NGC6791    & 4140.39       & 1104    & 8.913     & 0.25             & 0.19      \\
NGC752     & 443.18        & 182     & 1.259     & 0.25             & 0.01      \\ \bottomrule
\end{tabular}

1 Answers1

1

With your code fragment is not possible to reproduce table showed in your question. For example, if you expand it to small but compilable document (MWE: Minimal Working Example}:

\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{booktabs}
\usepackage[version=4]{mhchem}

\begin{document} \begin{center} \rowcolors{2}{white}{gray!25} \begin{tabular}{llllll} \toprule Cluster ID & {Distance (pc)} & {Members} & {Age (Gyr)} & {$\left[\frac{\ce{Fe}}{\ce{H}}\right]$} & {Reddening} \ \midrule IC4651 & 942.78 & 950 & 1.585 & 0.5 & 0.04 \ M35 & 871.02 & 1231 & 0.056 & 0.0 & 0.46 \ M46 & 1667.83 & 2000 & 0.398 & 0.25 & 0.17 \ M47 & 479.27 & 470 & 0.045 & 0.0 & 0.25 \ M48 & 759.42 & 638 & 0.447 & 0.25 & 0.02 \ M50 & 973.31 & 908 & 0.063 & 0.0 & 0.44 \ M67 & 873.41 & 1000 & 3.548 & 0.25 & 0.0 \ NGC188 & 1940.26 & 802 & 5.012 & 0.5 & 0.0 \ NGC2158 & 882.04 & 854 & 0.045 & 0.0 & 0.41 \ NGC2204 & 4895.61 & 138 & 1.413 & 0.25 & 0.0 \ NGC2301 & 888.75 & 935 & 0.126 & 0.25 & 0.09 \ NGC2355 & 1941.65 & 321 & 0.794 & 0.0 & 0.22 \ NGC2360 & 1121.45 & 736 & 0.708 & 0.5 & 0.0 \ NGC6633 & 380.77 & 264 & 0.708 & 0.25 & 0.11 \ NGC6791 & 4140.39 & 1104 & 8.913 & 0.25 & 0.19 \ NGC752 & 443.18 & 182 & 1.259 & 0.25 & 0.01 \ \bottomrule \end{tabular} \end{center} \end{document}

than its compilation gives:

enter image description here

Addendum:

You may consider to use tabularray package with libraries booktabs and siunitx (which load packages with the same names).

\documentclass{aastex631}
\usepackage{xcolor}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}
\usepackage[version=4]{mhchem}

\begin{document} \begin{center} \begin{tblr}{colspec = {lS[table-format=4.2] S[table-format=4.0] S[table-format=1.3] *{2}{S[table-format=1.2]}}, row{even} = {bg=gray!25}, rowsep = {1pt} } \toprule Cluster ID & {{{Distance (pc)}}} & {{{Members}}} & {{{Age (Gyr)}}} & {{{$\left[\frac{\ce{Fe}}{\ce{H}}\right]$}}} & {{{Reddening}}} \ \midrule IC4651 & 942.78 & 950 & 1.585 & 0.5 & 0.04 \ M35 & 871.02 & 1231 & 0.056 & 0.0 & 0.46 \ M46 & 1667.83 & 2000 & 0.398 & 0.25 & 0.17 \ M47 & 479.27 & 470 & 0.045 & 0.0 & 0.25 \ M48 & 759.42 & 638 & 0.447 & 0.25 & 0.02 \ M50 & 973.31 & 908 & 0.063 & 0.0 & 0.44 \ M67 & 873.41 & 1000 & 3.548 & 0.25 & 0.0 \ NGC188 & 1940.26 & 802 & 5.012 & 0.5 & 0.0 \ NGC2158 & 882.04 & 854 & 0.045 & 0.0 & 0.41 \ NGC2204 & 4895.61 & 138 & 1.413 & 0.25 & 0.0 \ NGC2301 & 888.75 & 935 & 0.126 & 0.25 & 0.09 \ NGC2355 & 1941.65 & 321 & 0.794 & 0.0 & 0.22 \ NGC2360 & 1121.45 & 736 & 0.708 & 0.5 & 0.0 \ NGC6633 & 380.77 & 264 & 0.708 & 0.25 & 0.11 \ NGC6791 & 4140.39 & 1104 & 8.913 & 0.25 & 0.19 \ NGC752 & 443.18 & 182 & 1.259 & 0.25 & 0.01 \ \bottomrule \end{tblr} \end{center} \end{document}

Compiling above solution in overleaf (as I do) or if you have installed in revtext4-1 in your LaTeX installation (which is needed for documentclass aastex631) , than you will get table as is shown:

enter image description here

Zarko
  • 296,517
  • The above works for me when using a documentclass of article, but if I switch to using documentclass{aastex631}, I am left with what is shown in the OP. I have gutted a copy of aastex.cls and I am unable to find what causes this difference – immediacy Mar 25 '22 at 07:25
  • I've traced my issue back to being a part of revtex 4-1, which aastex uses as a basis – immediacy Mar 25 '22 at 08:05
  • @immediacy, unfortunately aastex631is based onrevtex4-1which is obsolete (due to their bugs) and is not available in regular CTAN. However, if you use Overleaf service for my second example, it works. Tested. – Zarko Mar 25 '22 at 09:12