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 have two tables as follows:

Table 1:

Row/Column | C1 | C2 | C3
ROW 1      | v  | v  | v
ROW 2      | v  | v  | v
ROW 3      | v  | v  | v
ROW 4      | v  | v  | v
ROW 5      | v  | v  | v
...
ROW n    | v | v | v

Table 2:

Row/Column | C1 
Row1       | v
Row2       | v
Row3       | v

I want to have table 1 as a background (possibly transparent) and Table 2 on top of 1 as if it summarize the content of table 1 from ROW 1 up to ROW 4.

What packages do you recommend for doing this?

share|improve this question
add comment

1 Answer

A simple way to do this would be to just fade out the text that want to be underneath. By using the array package package I have defined two new column types, L and C for left and centered columns which have the text displayed with color gray!25. For the entries that you want on top, I used \multicolumn so that the color would not be applied.

enter image description here

Further Enhancements:

  • The collcell package could be used to keep track of the current row and column and only apply the gray color if the current entry was outside of the range of the entries that are to be on top.

    This would allow the table to be entered as a normal table, and the specification of which entries on top would be separated form the content.

Code:

\documentclass{article}
\usepackage{xcolor}
\usepackage{array}
\usepackage{booktabs}

\newcolumntype{C}{>{\color{gray!25}}c<{}}
\newcolumntype{L}{>{\color{gray!25}}l<{}}

\newcommand*{\mc}[1]{\multicolumn{1}{c}{#1}}%
\newcommand*{\ml}[1]{\multicolumn{1}{l}{#1}}%

\begin{document}
\begin{tabular}{L  C  C  C} 
\ml{Row/Column} & \mc{C1} & C2 & C3 \\ \toprule
\ml{ROW 1}      & \mc{v}  & v  & v  \\ 
\ml{ROW 2}      & \mc{v}  & v  & v  \\ 
\ml{ROW 3}      & \mc{v}  & v  & v  \\  %\cmidrule{1-4}
    ROW 4       &     v   & v  & v  \\ 
    ROW 5       &     v   & v  & v  \\ 
    ROW n       &     v   & v  & v  \\  %\bottomrule
\end{tabular}
\end{document}
share|improve this answer
    
Thank you Peter. I should have mentioned that the second table contain different (but related) information so it is not C1 in the first table. –  DotNet Nov 2 '12 at 13:02
1  
@DotNet: I would be helpful if you updated the question to provide the actual LaTeX code for the two tables with data that better represented your actual use case. There may be additional complications depending on the data. –  Peter Grill Nov 2 '12 at 17:46
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.