Information and discussion about graphics, figures & tables in LaTeX documents.
arstaer
Posts: 12 Joined: Sun Jun 17, 2012 5:56 am
Post
by arstaer » Wed Oct 31, 2012 6:33 am
Hey guys,
When I run this MWE I have a strange black rectangle in the first row right after the Innovations. The original code for the table is by Excel2LaTeX. I'm just trying to highlight rows, columns, and cells using colortbl (which took me three hours just to get more or less working).
Code: Select all
\documentclass{article}
\renewcommand{\arraystretch}{1.5}
\usepackage{tabulary}
\usepackage{xcolor}
\usepackage{colortbl}
\usepackage{booktabs}
\usepackage[newcommands]{ragged2e}
\begin{document}
\begin{tabulary}{1\textwidth}{LLLLLLL}
\toprule
\multicolumn{1}{l}{} & \multicolumn{1}{l}{Innovations} & & & Logs & & \\
\midrule
\multicolumn{1}{l}{Variables} & \multicolumn{1}{c}{3} & \multicolumn{1}{c}{2} & \multicolumn{1}{c}{1} & \multicolumn{1}{c}{3} & \multicolumn{1}{c}{2} & \multicolumn{1}{c}{1} \\
\multicolumn{1}{l}{} & \multicolumn{1}{l}{(-1.15)} & \multicolumn{1}{l}{(-1.79)} & \multicolumn{1}{l}{(-1.39)} & \multicolumn{1}{l}{(-1.24)} & \multicolumn{1}{l}{(-1.65)} & \multicolumn{1}{l}{(-1.43)} \\
\rowcolor[gray]{0.95}\multicolumn{1}{l}{ $EQ\_VOL_{t}$} & \multicolumn{1}{l}{1.43***} & \multicolumn{1}{l}{1.22***} & \multicolumn{1}{l}{1.17***} & \multicolumn{1}{l}{0.28***} & \multicolumn{1}{l}{0.26***} & \multicolumn{1}{l}{0.28***} \\
\bottomrule
\end{tabulary}
\end{document}
Hmm, somehow the MWE doesn't show up highlighted.
Here is the file list:
Code: Select all
*File List*
article.cls 2007/10/19 v1.4h Standard LaTeX document class
size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
tabulary.sty 2008/12/01 v0.9 tabulary package (DPC)
array.sty 2008/09/09 v2.4c Tabular extension package (FMi)
xcolor.sty 2007/01/21 v2.11 LaTeX color extensions (UK)
color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX
infwarerr.sty 2010/04/08 v1.3 Providing info/warning/error messages (HO)
ltxcmds.sty 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
colortbl.sty 2012/02/13 v1.0a Color table columns (DPC)
booktabs.sty 2005/04/14 v1.61803 publication quality tables
ragged2e.sty 2009/05/21 v2.1 ragged2e Package (MS)
everysel.sty 2011/10/28 v1.2 EverySelectfont Package (MS)
supp-pdf.mkii
***********
Any idea what this rectangle might be?
Thank you,
Arsenio
NEW: TikZ book now 40% off at Amazon.com for a short time.
cgnieder
Site Moderator
Posts: 2000 Joined: Sat Apr 16, 2011 7:27 pm
Post
by cgnieder » Wed Oct 31, 2012 10:12 pm
Hi.
I'm unsure why this black box appears. But after I removed all the unnecessary
\multicolumn
s (which where
all of them, btw) it disappeared:
Code: Select all
\documentclass{article}
\renewcommand{\arraystretch}{1.5}
\usepackage{tabulary}
\usepackage{xcolor}
\usepackage{colortbl}
\usepackage{booktabs}
\usepackage[newcommands]{ragged2e}
\begin{document}
\noindent
\begin{tabulary}{1\textwidth}{LCCCCCC}
\toprule
& Innovations & & & Logs & & \\
\midrule
Variables & 3 & 2 & 1 & 3 & 2 & 1 \\
& (-1.15) & (-1.79) & (-1.39) & (-1.24) & (-1.65) & (-1.43) \\
\rowcolor[gray]{0.95}
$EQ\_VOL_{t}$ & 1.43*** & 1.22*** & 1.17*** & 0.28*** & 0.26*** & 0.28*** \\
\bottomrule
\end{tabulary}
\end{document}
Regards
arstaer
Posts: 12 Joined: Sun Jun 17, 2012 5:56 am
Post
by arstaer » Thu Nov 01, 2012 12:07 am
Clemens,
Thanks for your reply! The \multicolumns
are inserted automatically by Excel2Latex when the formatting in the excel cells is anything but the default/general. I can't do much about them. Otherwise, you are correct that erasing them works.
You think this is a bug?
Arsenio
Last edited by
cgnieder on Thu Nov 01, 2012 12:10 am, edited 1 time in total.
cgnieder
Site Moderator
Posts: 2000 Joined: Sat Apr 16, 2011 7:27 pm
Post
by cgnieder » Thu Nov 01, 2012 12:21 am
An alternative seems to be to add
\multicolumns
to the empty cells:
Code: Select all
\documentclass{article}
\renewcommand{\arraystretch}{1.5}
\usepackage{tabulary}
\usepackage{xcolor}
\usepackage{colortbl}
\usepackage{booktabs}
\usepackage[newcommands]{ragged2e}
\begin{document}
\begin{tabulary}{1\textwidth}{LLLLLLL}
\toprule
\multicolumn{1}{l}{} & \multicolumn{1}{l}{Innovations} & \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{1}{l}{Logs}\\
\midrule
\multicolumn{1}{l}{Variables} & \multicolumn{1}{c}{3} & \multicolumn{1}{c}{2} & \multicolumn{1}{c}{1} & \multicolumn{1}{c}{3} & \multicolumn{1}{c}{2} & \multicolumn{1}{c}{1} \\
\multicolumn{1}{l}{} & \multicolumn{1}{l}{(-1.15)} & \multicolumn{1}{l}{(-1.79)} & \multicolumn{1}{l}{(-1.39)} & \multicolumn{1}{l}{(-1.24)} & \multicolumn{1}{l}{(-1.65)} & \multicolumn{1}{l}{(-1.43)} \\
\rowcolor[gray]{0.95}\multicolumn{1}{l}{ $EQ\_VOL_{t}$} & \multicolumn{1}{l}{1.43***} & \multicolumn{1}{l}{1.22***} & \multicolumn{1}{l}{1.17***} & \multicolumn{1}{l}{0.28***} & \multicolumn{1}{l}{0.26***} & \multicolumn{1}{l}{0.28***} \\
\bottomrule
\end{tabulary}
\end{document}
or to add
\rowcolor{white}
to the first row.
Code: Select all
\documentclass{article}
\renewcommand{\arraystretch}{1.5}
\usepackage{tabulary}
\usepackage{xcolor}
\usepackage{colortbl}
\usepackage{booktabs}
\usepackage[newcommands]{ragged2e}
\begin{document}
\begin{tabulary}{1\textwidth}{LLLLLLL}
\toprule
\rowcolor{white}
\multicolumn{1}{l}{} & \multicolumn{1}{l}{Innovations} & & & Logs & & \\
\midrule
\multicolumn{1}{l}{Variables} & \multicolumn{1}{c}{3} & \multicolumn{1}{c}{2} & \multicolumn{1}{c}{1} & \multicolumn{1}{c}{3} & \multicolumn{1}{c}{2} & \multicolumn{1}{c}{1} \\
\multicolumn{1}{l}{} & \multicolumn{1}{l}{(-1.15)} & \multicolumn{1}{l}{(-1.79)} & \multicolumn{1}{l}{(-1.39)} & \multicolumn{1}{l}{(-1.24)} & \multicolumn{1}{l}{(-1.65)} & \multicolumn{1}{l}{(-1.43)} \\
\rowcolor[gray]{0.95}
\multicolumn{1}{l}{ $EQ\_VOL_{t}$} & \multicolumn{1}{l}{1.43***} & \multicolumn{1}{l}{1.22***} & \multicolumn{1}{l}{1.17***} & \multicolumn{1}{l}{0.28***} & \multicolumn{1}{l}{0.26***} & \multicolumn{1}{l}{0.28***} \\
\bottomrule
\end{tabulary}
\end{document}
I don't know if it is a bug but it is a very unhappy behavior.
Regards
arstaer
Posts: 12 Joined: Sun Jun 17, 2012 5:56 am
Post
by arstaer » Wed Nov 07, 2012 6:07 am
Clemens,
\rowcolor{white}
for the first row works great!
Thanks,
Arsenio
Last edited by
cgnieder on Wed Nov 07, 2012 12:36 pm, edited 1 time in total.