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 am going a little crazy with alignment in the tabular environment.

In the following code I would like both the top-left cell 'Green Die', and the last cell in the 2nd row '6' to be aligned vertically.

I know the alignment issues with the cell '6' have to do with it being the last column, because if I make it the second to last column it is aligned in the middle.

Thanks in advance for any and all help!

\documentclass[11pt]{article}   
\usepackage{array, multirow}
\begin{document}

\newcolumntype{S}{>{\centering\arraybackslash} m{1.2cm} }
\begin{tabular}{|S|S|S|S|S|S|S|}
\hline

\multirow{2}{1.2cm} {\centering Green Die}&\multicolumn{6}{|c|} {Red Die} \\ \cline{2-7}

&1&2&3&4&5& 6\\ [4pt] \hline
1& 1+1=2&&&&&\\ [4pt]\hline
2&&&&&&\\[4pt] \hline
3&&&&&&\\[4pt] \hline
4&&&&&&\\ [4pt]\hline
5&&&&&&\\[4pt] \hline
6&&&&&&\\ [4pt]\hline
\end{tabular}

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

1 Answer 1

up vote 2 down vote accepted
\documentclass[11pt]{article}    
\usepackage{array,ragged2e}
\newcolumntype{S}[1]{>{\Centering}m{#1}}

\begin{document}

\def\arraystretch{1.5}
\begin{tabular}{|*{7}{S{1.2cm}|}}\hline
\makebox(0,-10){\parbox{1.2cm}{\centering Green Die}} 
     & \multicolumn{6}{c|} {Red Die} \\\cline{2-7}
 & 1 & 2 & 3 & 4 & 5 & 6\\ \hline
1& 1+1=2&&&&&\\\hline
2&&&&&&\\\hline
3&&&&&&\\\hline
4&&&&&&\\\hline
5&&&&&&\\\hline
6&&&&&&\\\hline
\end{tabular}

\end{document}

enter image description here

share|improve this answer
    
Why does this solution work, and Michael's code not? (Especially with respect to the placement of the '6'.) –  Alan Munn May 6 '11 at 16:40
    
Thank you! There are several functions I have never used before in your code. I will have to figure them out. It is amazing to me how complicated it is to get some letters in the center of a box. –  Michael May 6 '11 at 21:07
    
Alan, why the '6' is not centered is quite the mystery for me –  Michael May 6 '11 at 21:09
    
the additional vertical space is added to the last column. –  Herbert May 7 '11 at 6:09
    
Your last comment is still a bit cryptic to me. Where in your code (compared to Michael's) does the extra vertical space come from? (And can you add @Alan to your response so I will see it.) –  Alan Munn May 7 '11 at 17:02
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.