Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I need some assistance with a longtable (code below). I have a few things that I've been trying to accomplish but have not been able to.

1) I want the grey background to cover the table in a similar fashion to this table:

enter image description here

2) I want the width of the table to take up the whole page and to be perfectly aligned with the heading and the footer (the same example as in (1))

3) I don't want mdframed to display a black line around the edge of the shading.

4) I want the non-decimal elements of each column to align with the decimal elements. I'm not sure how to accomplish this with dcolumn package. Right now I'm resorting to a bad hack with \multicolumn and Gray (i.e. for practical purposes invisible) elements before or after the text to nudge it to the center.

Note that I can't use \rowcolor from colortbl with \multicolumn.

Thanks for any help :)

P.S. I am quite new to LaTeX and not just being lazy!

\documentclass[a4paper,11pt]{article}
\usepackage{color,amsmath,amsfonts,amssymb}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{natbib}
\usepackage{rotating}
\usepackage{colortbl}
\usepackage{booktabs,dcolumn,caption}
\usepackage{expdlist}  %expanded list environment
\usepackage{pdflscape} %landscape single pages
\usepackage{longtable} %multipage table
\usepackage{xcolor, mdframed}

\captionsetup{labelsep=newline,singlelinecheck=false} % optional
\newcolumntype{d}[1]{D{.}{.}{#1}} % "decimal" column type
\renewcommand{\ast}{{}^{\textstyle *}} % for raised "asterisks"

\oddsidemargin 0.5cm %
\evensidemargin 0.5cm %
\textwidth 15cm %
\topmargin  -0.2in  %
\textheight 23.5cm %
\headheight 15pt %


\doublerulesep2pt

\begin{document}
\renewcommand{\baselinestretch}{1.1}

\fontsize{11}{16pt} \selectfont
\definecolor{Gray}{gray}{0.9}


\begin{landscape}
\footnotesize
\begin{mdframed}[backgroundcolor=Gray]
\begin{longtable}{@{}l@{\extracolsep{\fill}}d{4}d{4}d{4}d{4}d{4}d{4}d{4}d{4}d{4}@{}}
\caption{HEADING} \\
%\begin{tabular*}{\textwidth}{@{}l@{\extracolsep{\fill}}d{4}d{4}d{4}d{4}d{4}d{4}d{4}d{4}d{4}@{}}
\toprule
& \multicolumn{3}{c}{Category 1} & \multicolumn{3}{c}{Category 2} & \multicolumn{3}{c}{Category 3} \\
& \multicolumn{1}{c}{OLS} & \multicolumn{1}{c}{OLS} & \multicolumn{1}{c}{OLS} & \multicolumn{1}{c}{OLS} & \multicolumn{1}{c}{OLS} & \multicolumn{1}{c}{PWLS} & \multicolumn{1}{c}{OLS} & \multicolumn{1}{c}{OLS} & \multicolumn{1}{c}{OLS}  \\
\midrule
\endfirsthead
\caption[]{\emph{(continued)}} \\
\toprule
& \multicolumn{3}{c}{Category 1} & \multicolumn{3}{c}{Category 2} & \multicolumn{3}{c}{Category 3} \\
& \multicolumn{1}{c}{OLS} & \multicolumn{1}{c}{OLS} & \multicolumn{1}{c}{OLS} & \multicolumn{1}{c}{OLS} & \multicolumn{1}{c}{OLS} & \multicolumn{1}{c}{PWLS} & \multicolumn{1}{c}{OLS} & \multicolumn{1}{c}{OLS} & \multicolumn{1}{c}{OLS}  \\
\midrule
\endhead



\multicolumn{4}{l}{\emph{Heading1}} & & &  & & & \\
Var1 & -0.086 & -0.082 & -4.525 & -0.028 & -0.022 & 2.441 & -0.092 & -0.099 &     -3.837\ast \\
& (0.107) & (0.110) & (3.948) & (0.087) & (0.091) & (4.346) & (0.076) & (0.070) &     (1.505) \\
Var2\textsuperscript{a}  & 0.012 & 0.012 & -0.007 & 0.004 & 0.003 & 0.046 & 0.000 &     -0.002 & 0.465\ast \ast \\
& (0.009) & (0.009) & (0.319) & (0.007) & (0.007) & (0.351) & (0.006) & (0.006) &     (0.120) \\
Var3\textsuperscript{b} & -0.006 & -0.005 & 0.452 & 0.001 & 0.003 & -0.204 & 0.003 &     0.009 & -0.082 \\
& (0.007) & (0.007) & (0.247) & (0.005) & (0.006) & (0.272) & (0.007) & (0.006) &     (0.132) \\
Var4\textsuperscript{c} & -0.333\ast \ast & -0.333\ast \ast & 15.347\ast \ast &     -0.179\ast \ast & -0.180\ast \ast & -8.593\ast \ast & -0.050 & -0.013 & -3.678\ast \ast \\
& (0.078) & (0.080) & (2.87) & (0.063) & (0.066) & (3.160) & (0.053) & (0.049) &     (1.049) \\
    Var5\textsuperscript{d} & -0.037 & -0.010 & -2.073\ast \ast & -0.066\ast \ast &     -0.035\ast & 2.166\ast \ast & -0.161\ast \ast & -0.043\ast & -0.834 \\
& (0.021) & (0.021) & (0.761) & (0.017) & (0.017) & (0.838) & (0.023) & (0.021) &     (0.451) \\
Var6 & \multicolumn{1}{c}{Yes\textsuperscript{**}} & Yes^{**} & Yes^{**} & Yes^{**} & Yes^{**} & Yes^{**} & Yes^{**} & Yes^{**} & Yes^{**} \\
R-squared & 0.151 & 0.146 & 0.191 & 0.111 & 0.07 & 0.086 & 0.151 & 0.013 & 0.187 \\
& & & & & & & & & \\

\multicolumn{4}{l}{\emph{Heading2}} & & &  & & & \\
Var1 & -0.086 & -0.082 & -4.525 & -0.028 & -0.022 & 2.441 & -0.092 & -0.099 &     -3.837\ast \\
& (0.107) & (0.110) & (3.948) & (0.087) & (0.091) & (4.346) & (0.076) & (0.070) &     (1.505) \\
Var2\textsuperscript{a}  & 0.012 & 0.012 & -0.007 & 0.004 & 0.003 & 0.046 & 0.000 & -0.002 & 0.465\ast \ast \\
& (0.009) & (0.009) & (0.319) & (0.007) & (0.007) & (0.351) & (0.006) & (0.006) & (0.120) \\
Var3\textsuperscript{b} & -0.006 & -0.005 & 0.452 & 0.001 & 0.003 & -0.204 & 0.003 & 0.009 & -0.082 \\
& (0.007) & (0.007) & (0.247) & (0.005) & (0.006) & (0.272) & (0.007) & (0.006) & (0.132) \\
Var4\textsuperscript{c} & -0.333\ast \ast & -0.333\ast \ast & 15.347\ast \ast & -0.179\ast \ast & -0.180\ast \ast & -8.593\ast \ast & -0.050 & -0.013 & -3.678\ast \ast \\
& (0.078) & (0.080) & (2.87) & (0.063) & (0.066) & (3.160) & (0.053) & (0.049) & (1.049) \\
Var5\textsuperscript{d} & -0.037 & -0.010 & -2.073\ast \ast & -0.066\ast \ast &     -0.035\ast & 2.166\ast \ast & -0.161\ast \ast & -0.043\ast & -0.834 \\
& (0.021) & (0.021) & (0.761) & (0.017) & (0.017) & (0.838) & (0.023) & (0.021) & (0.451) \\
    Var6 & \multicolumn{1}{c}{Yes\textsuperscript{**}} & Yes^{**} & Yes^{**} &     Yes^{**} & Yes^{**} & Yes^{**} & Yes^{**} & Yes^{**} & Yes^{**} \\
    R-squared & 0.151 & 0.146 & 0.191 & 0.111 & 0.07 & 0.086 & 0.151 & 0.013 & 0.187 \\
& & & & & & & & & \\

\pagebreak

\multicolumn{4}{l}{\emph{Heading3}} & & &  & & & \\
Var1 & -0.086 & -0.082 & -4.525 & -0.028 & -0.022 & 2.441 & -0.092 & -0.099 & -3.837\ast \\
& (0.107) & (0.110) & (3.948) & (0.087) & (0.091) & (4.346) & (0.076) & (0.070) &     (1.505) \\
Var2\textsuperscript{a}  & 0.012 & 0.012 & -0.007 & 0.004 & 0.003 & 0.046 & 0.000 & -0.002 & 0.465\ast \ast \\
& (0.009) & (0.009) & (0.319) & (0.007) & (0.007) & (0.351) & (0.006) & (0.006) & (0.120) \\
Var3\textsuperscript{b} & -0.006 & -0.005 & 0.452 & 0.001 & 0.003 & -0.204 & 0.003 & 0.009 & -0.082 \\
& (0.007) & (0.007) & (0.247) & (0.005) & (0.006) & (0.272) & (0.007) & (0.006) & (0.132) \\
Var4\textsuperscript{c} & -0.333\ast \ast & -0.333\ast \ast & 15.347\ast \ast & -0.179\ast \ast & -0.180\ast \ast & -8.593\ast \ast & -0.050 & -0.013 & -3.678\ast \ast \\
& (0.078) & (0.080) & (2.87) & (0.063) & (0.066) & (3.160) & (0.053) & (0.049) & (1.049) \\
Var5\textsuperscript{d} & -0.037 & -0.010 & -2.073\ast \ast & -0.066\ast \ast & -0.035\ast & 2.166\ast \ast & -0.161\ast \ast & -0.043\ast & -0.834 \\
& (0.021) & (0.021) & (0.761) & (0.017) & (0.017) & (0.838) & (0.023) & (0.021) & (0.451) \\
    Var6 & \multicolumn{1}{c}{Yes\textsuperscript{**}} & Yes^{**} & Yes^{**} & Yes^{**} & Yes^{**} & Yes^{**} & Yes^{**} & Yes^{**} & Yes^{**} \\
    R-squared & 0.151 & 0.146 & 0.191 & 0.111 & 0.07 & 0.086 & 0.151 & 0.013 & 0.187 \\
& & & & & & & & & \\
No. 1 & \multicolumn{1}{c}{219\textcolor{Gray}{ss}} & \multicolumn{1}{c}{219} &     \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} &     \multicolumn{1}{c}{219} & \multicolumn{1}{c}{445} & \multicolumn{1}{c}{445} & \multicolumn{1}{r}{445\textcolor{Gray}{s}} \\
No. 2 & \multicolumn{1}{c}{219\textcolor{Gray}{ss}} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{445} & \multicolumn{1}{c}{445} &     \multicolumn{1}{r}{445\textcolor{Gray}{s}} \\
No. 3 & \multicolumn{1}{c}{219\textcolor{Gray}{ss}} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{445} & \multicolumn{1}{c}{445} & \multicolumn{1}{r}{445\textcolor{Gray}{s}} \\
days 1 & \multicolumn{1}{c}{219\textcolor{Gray}{ss}} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{445} & \multicolumn{1}{c}{445} & \multicolumn{1}{r}{445\textcolor{Gray}{s}} \\
days 2 & \multicolumn{1}{c}{219\textcolor{Gray}{ss}} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{445} & \multicolumn{1}{c}{445} & \multicolumn{1}{r}{445\textcolor{Gray}{s}} \\
\midrule[\heavyrulewidth]
\end{longtable}
\vspace{0.12cm}
\end{mdframed}

{Dependent variables have been scaled by a factor of 10. Standard errors in parentheses. *Significant at 5\%; **Significant at 1\%.
\begin{description}\compact{
        \item[\small \textsuperscript{a}] Description 1.
    \item[\small \textsuperscript{b}] Description 1.
    \item[\small \textsuperscript{c}] Description 1.
        \item[\small \textsuperscript{d}] Description 1. }
\end{description} }
\end{landscape}



\end{document}
share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

You have quite a few questions! I've reworked your code to incorporate all of your concerns, and have fixed up some additional issues. The only thing I can't seem to address is a weird interaction between longtable and mdframed: if an mdframed environment is placed around the longtable environment and an option such as hidealllines=true (or, say, linecolor=white) is enabled for the former package, various elements of the longtable (such as endhead, endfoot, and endlastfoot) vanish mysteriously. Maybe somebody else can suggest what to do? For now, the mdframed-related commands are commented out.

\documentclass[a4paper,11pt]{article}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage[english]{babel}
\usepackage{natbib}
\usepackage{pdflscape,booktabs,dcolumn,caption}
\usepackage{expdlist}  %expanded list environment

\usepackage{longtable} %multipage table
\setlength\LTleft{0pt}
\setlength\LTright{0pt}

\usepackage[table]{xcolor} 
\definecolor{Gray}{gray}{0.9}
\usepackage{mdframed}

\usepackage[margin=1in]{geometry}
\usepackage{setspace}
\setstretch{1}

\captionsetup{labelsep=newline,singlelinecheck=false} % optional
\newcolumntype{d}[1]{D{.}{.}{#1}} % "decimal" column type

\renewcommand{\ast}{\ensuremath{{}^{\textstyle *}}} % for raised "asterisks"
\newcommand{\aast}{\ensuremath{{}^{\textstyle **}}}

\newcommand{\C}[1]{\multicolumn{1}{c}{#1}} % abbreviations 
\newcommand\Y{\C{Yes\aast}}


\begin{document}

\begin{landscape}
%%\begin{mdframed}[backgroundcolor=Gray,hidealllines=true]
\noindent
\begin{longtable}{@{} l @{\extracolsep{\fill}} *{9}{d{5}} @{}}
\caption{HEADING} \\
\toprule
& \multicolumn{3}{c}{Category 1} 
& \multicolumn{3}{c}{Category 2} 
& \multicolumn{3}{c}{Category 3} \\
\cmidrule(r){2-4} \cmidrule(r){5-7} \cmidrule(l){8-10}
& \C{OLS} & \C{OLS} & \C{OLS} 
& \C{OLS} & \C{OLS} & \C{PWLS} 
& \C{OLS} & \C{OLS} & \C{OLS} \\
\midrule
\endfirsthead
\multicolumn{5}{@{}l}{\emph{(continued)}} \\
\toprule
& \multicolumn{3}{c}{Category 1} 
& \multicolumn{3}{c}{Category 2} 
& \multicolumn{3}{c}{Category 3} \\
\cmidrule(r){2-4} \cmidrule(r){5-7} \cmidrule(l){8-10}
& \C{OLS} & \C{OLS} & \C{OLS} 
& \C{OLS} & \C{OLS} & \C{PWLS} 
& \C{OLS} & \C{OLS} & \C{OLS} \\
\midrule
\endhead
\midrule[\heavyrulewidth]
\multicolumn{10}{r@{}}{\emph{(continued)}}
\endfoot
\bottomrule
\endlastfoot
\multicolumn{4}{@{}l}{\emph{Heading 1}} \\
Var1 & -0.086 & -0.082 & -4.525 & -0.028 & -0.022 & 2.441 & -0.092 & -0.099 & -3.837\ast \\
& (0.107) & (0.110) & (3.948) & (0.087) & (0.091) & (4.346) & (0.076) & (0.070) & (1.505) \\
Var2\textsuperscript{a}  & 0.012 & 0.012 & -0.007 & 0.004 & 0.003 & 0.046 & 0.000 & -0.002 & 0.465\aast \\
& (0.009) & (0.009) & (0.319) & (0.007) & (0.007) & (0.351) & (0.006) & (0.006) & (0.120) \\
Var3\textsuperscript{b} & -0.006 & -0.005 & 0.452 & 0.001 & 0.003 & -0.204 & 0.003 & 0.009 & -0.082 \\
& (0.007) & (0.007) & (0.247) & (0.005) & (0.006) & (0.272) & (0.007) & (0.006) & (0.132) \\
Var4\textsuperscript{c} & -0.333\aast & -0.333\aast & 15.347\aast & -0.179\aast & -0.180\aast & -8.593\aast & -0.050 & -0.013 & -3.678\aast \\
& (0.078) & (0.080) & (2.87) & (0.063) & (0.066) & (3.160) & (0.053) & (0.049) & (1.049) \\
Var5\textsuperscript{d} & -0.037 & -0.010 & -2.073\aast & -0.066\aast & -0.035\ast & 2.166\aast & -0.161\aast & -0.043\ast & -0.834 \\
& (0.021) & (0.021) & (0.761) & (0.017) & (0.017) & (0.838) & (0.023) & (0.021) & (0.451) \\
Var6 & \Y & \Y & \Y & \Y & \Y & \Y & \Y & \Y & \Y \\
R-squared & 0.151 & 0.146 & 0.191 & 0.111 & 0.07 & 0.086 & 0.151 & 0.013 & 0.187 \\
\\
\multicolumn{4}{@{}l}{\emph{Heading2}} \\
Var1 & -0.086 & -0.082 & -4.525 & -0.028 & -0.022 & 2.441 & -0.092 & -0.099 & -3.837\ast \\
& (0.107) & (0.110) & (3.948) & (0.087) & (0.091) & (4.346) & (0.076) & (0.070) & (1.505) \\
Var2\textsuperscript{a}  & 0.012 & 0.012 & -0.007 & 0.004 & 0.003 & 0.046 & 0.000 & -0.002 & 0.465\aast \\
& (0.009) & (0.009) & (0.319) & (0.007) & (0.007) & (0.351) & (0.006) & (0.006) & (0.120) \\
Var3\textsuperscript{b} & -0.006 & -0.005 & 0.452 & 0.001 & 0.003 & -0.204 & 0.003 & 0.009 & -0.082 \\
& (0.007) & (0.007) & (0.247) & (0.005) & (0.006) & (0.272) & (0.007) & (0.006) & (0.132) \\
Var4\textsuperscript{c} & -0.333\aast & -0.333\aast & 15.347\aast & -0.179\aast & -0.180\aast & -8.593\aast & -0.050 & -0.013 & -3.678\aast \\
& (0.078) & (0.080) & (2.87) & (0.063) & (0.066) & (3.160) & (0.053) & (0.049) & (1.049) \\
Var5\textsuperscript{d} & -0.037 & -0.010 & -2.073\aast & -0.066\aast & -0.035\ast & 2.166\aast & -0.161\aast & -0.043\ast & -0.834 \\
& (0.021) & (0.021) & (0.761) & (0.017) & (0.017) & (0.838) & (0.023) & (0.021) & (0.451) \\
Var6 & \Y & \Y & \Y & \Y & \Y & \Y & \Y & \Y & \Y \\
R-squared & 0.151 & 0.146 & 0.191 & 0.111 & 0.07 & 0.086 & 0.151 & 0.013 & 0.187 \\
\\
\multicolumn{4}{@{}l}{\emph{Heading3}}\\
Var1 & -0.086 & -0.082 & -4.525 & -0.028 & -0.022 & 2.441 & -0.092 & -0.099 & -3.837\ast \\
& (0.107) & (0.110) & (3.948) & (0.087) & (0.091) & (4.346) & (0.076) & (0.070) & (1.505) \\
Var2\textsuperscript{a}  & 0.012 & 0.012 & -0.007 & 0.004 & 0.003 & 0.046 & 0.000 & -0.002 & 0.465\aast \\
& (0.009) & (0.009) & (0.319) & (0.007) & (0.007) & (0.351) & (0.006) & (0.006) & (0.120) \\
Var3\textsuperscript{b} & -0.006 & -0.005 & 0.452 & 0.001 & 0.003 & -0.204 & 0.003 & 0.009 & -0.082 \\
& (0.007) & (0.007) & (0.247) & (0.005) & (0.006) & (0.272) & (0.007) & (0.006) & (0.132) \\
Var4\textsuperscript{c} & -0.333\aast & -0.333\aast & 15.347\aast & -0.179\aast & -0.180\aast & -8.593\aast & -0.050 & -0.013 & -3.678\aast \\
& (0.078) & (0.080) & (2.87) & (0.063) & (0.066) & (3.160) & (0.053) & (0.049) & (1.049) \\
Var5\textsuperscript{d} & -0.037 & -0.010 & -2.073\aast & -0.066\aast & -0.035\ast & 2.166\aast & -0.161\aast & -0.043\ast & -0.834 \\
& (0.021) & (0.021) & (0.761) & (0.017) & (0.017) & (0.838) & (0.023) & (0.021) & (0.451) \\
Var6 & \Y & \Y & \Y & \Y & \Y & \Y & \Y & \Y & \Y \\
R-squared & 0.151 & 0.146 & 0.191 & 0.111 & 0.07 & 0.086 & 0.151 & 0.013 & 0.187 \\
\\
No. 1 & \C{219\textcolor{Gray}{ss}} & \C{219} & \C{219} & \C{219} & \C{219} & \C{219} & \C{445} & \C{445} & \multicolumn{1}{r}{445\textcolor{Gray}{s}} \\
No. 2 & \C{219\textcolor{Gray}{ss}} & \C{219} & \C{219} & \C{219} & \C{219} & \C{219} & \C{445} & \C{445} & \multicolumn{1}{r}{445\textcolor{Gray}{s}} \\
No. 3 & \C{219\textcolor{Gray}{ss}} & \C{219} & \C{219} & \C{219} & \C{219} & \C{219} & \C{445} & \C{445} & \multicolumn{1}{r}{445\textcolor{Gray}{s}} \\
days 1 & \C{219\textcolor{Gray}{ss}} & \C{219} & \C{219} & \C{219} & \C{219} & \C{219} & \C{445} & \C{445} & \multicolumn{1}{r}{445\textcolor{Gray}{s}} \\
days 2 & \C{219\textcolor{Gray}{ss}} & \C{219} & \C{219} & \C{219} & \C{219} & \C{219} & \C{445} & \C{445} & \multicolumn{1}{r}{445\textcolor{Gray}{s}} \\
\end{longtable}
\noindent
Dependent variables have been scaled by a factor of 10. Standard errors in parentheses. \ast~Significant at 5\%; \aast~Significant at 1\%.
\begin{description}\compact{
    \item[\small \textsuperscript{a}] Description 1.
    \item[\small \textsuperscript{b}] Description 1.
    \item[\small \textsuperscript{c}] Description 1.
    \item[\small \textsuperscript{d}] Description 1. }
\end{description} 
%%\end{mdframed}
\end{landscape}
\end{document}
share|improve this answer
    
Works brilliantly. Do you have any fix for the drifting "Yes**" (it drifts left after a few columns), or should I just wedge invisible characters before or after it to align it properly? –  user16208 Jul 17 '12 at 13:02
    
Ah, I don't think it matters which mdframed option you use the heading goes from later pages unconditionally Sorry I didn't notice that in my answer. See if I can summon @MarcoDaniel As far as I can see mdframed uses vsplit to split the page "by hand" rather than relying on the output routine to do it. Thus LTs output routine never gets invoked to re-insert the heading. mdframed could probably detect its splitting a longtable and insert the head....... –  David Carlisle Jul 17 '12 at 14:09
    
@IssacM: I suggest that you center-set all "Yes**" instances; the ones in the far-right column are currently right-aligned for some reason. –  Mico Jul 17 '12 at 15:11
    
Is this just putting {c} into the multicolumn? (Because your \Y definition already has that) –  user16208 Jul 17 '12 at 15:26
    
@IssacM -- you're correct: I forgot I had already made this change. I must have been thinking about the \multicolumn{1}{r}{445\textcolor{Gray}{s}} instances... (I would definitely center those guys, and not right-align them.) –  Mico Jul 17 '12 at 15:37
show 1 more comment

1) I want the grey background to cover the table in a similar fashion to this table:http://i50.tinypic.com/2hz4ao0.png

2) I want the width of the table to take up the whole page and to be perfectly aligned with the heading and the footer (the same example as in (1):http://i50.tinypic.com/2hz4ao0.png)

add

\setlength{\LTleft}{0pt}
\setlength{\LTright}{0pt}

To remove the LT margin (you already have the @{} and inter column fill glue.

3) I don't want mdframed to display a black line around the edge of the shading.

\begin{mdframed}[backgroundcolor=Gray, hidealllines=true]

will remove the lines

4) I want the non-decimal elements of each column to align with the decimal elements. I'm not sure how to accomplish this with dcolumn package. Right now I'm resorting to a bad hack with \multicolumn and Gray (i.e. for practical purposes invisible) elements before or after the text to nudge it to the center.

Not sure quite what alignment you want there but for non numeric entry using \multicolumn{1} isn't a hack it is a brilliantly designed interface to dcolumn:-)

Note that I can't use \rowcolor from colortbl with \multicolumn.

If you mean what I think you mean that was a "feature" removed in the 2012 release of colortbl so it should work now.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.