Graphics, Figures & TablesConflicts with tabulary, xcolor and multicolumn

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
verschell
Posts: 1
Joined: Wed Mar 23, 2016 7:00 pm

Conflicts with tabulary, xcolor and multicolumn

Post by verschell »

I have searched and searched (and tried a number of suggestions), but I still get completely bizarre results when trying to use alternating rowcolors when I am using multicolumn with tabulary.

Here is what I get now:
Screen Shot 2016-03-23 at 12.55.51 PM.png
Screen Shot 2016-03-23 at 12.55.51 PM.png (23.17 KiB) Viewed 3339 times
I want row 1 to have a white background, row 2 to have columns 1 and 2 be white background, while columns 3-8 to have a blue background, and then row 3 is white background, row 4 is blue background, (and repeat, which I left off for shorter example). I have no idea where the phantom white partial row comes from.

Here is the code that generates what I don't want (note that rowcolors basically doesn't work beyond identifying the colors I want, starting row and order of colors seems to have no effect on output):

Code: Select all

\documentclass[11pt]{article}
\usepackage{tabulary}				% Tabular with variable width columns balanced
\usepackage[table]{xcolor}

\definecolor{lightblue}{rgb}{0.93,0.95,1.0}
  
\begin{document}

\begin{table*}[!ht]
\rowcolors{1} {lightblue}{white}
\begin{tabulary}{0.98\textwidth}{LL|CCCCCC}\hline
\multicolumn{2}{c|}{\color{blue} Federal Funds Rate \%} & \multicolumn{6}{c}{\color{blue} Central Tendency} \\ \cline{3-8} 
 & & \color{blue} 2014 & \color{blue} 2015 & \color{blue} 2016 & \color{blue} 2017 & \color{blue} 2018 & \color{blue} Longer Run \\ \hline
\color{red} 2016 & \color{red} Mar &  &  & \color{red} 1.02 & \color{red} 2.04 & \color{red} 2.95 & \color{red} 3.31 \\
\color{blue} 2015 & \color{blue} Dec &  & \color{blue} .35 & \color{blue} 1.29 & \color{blue} 2.41 & \color{blue} 3.16 & \color{blue} 3.41 \\
 & \color{blue} Sep &  & \color{blue} .40 & \color{blue} 1.48 & \color{blue} 2.64 & \color{blue} 3.34 & \color{blue} 3.46 \\ \hline
\end{tabulary}
\end{table*}

\end{document}
I get some improvement by adding \rowcolor{white} to the first row, but putting \multicolumn{2}{c|}{\cellcolor{white}} on row 2 just removes the white block from the row, leaving the whole background blue.

Any help? Thanks!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Post Reply