3

I'm having a problem with vertical alignment of cells in a somewhat complicated case. Does anyone know how to have a different vertical alignment for two cells in the same column? And also if you use the "p" alignment on some columns, it affects the alignment of other columns in the table that are set to "m". Below is the example:

Example table A: Using the "m" vertical alignment. Everything here is correct, except for the bullet-pointed items in the 2nd row, 5th and 6th column. These entries should be vertically aligned to the top left, like in Example table B

In latex (Table A):

\documentclass{revtex4-1}
\usepackage{array}
\begin{document}

\begin{table*}
\begin{ruledtabular}
\begin{tabular}{ >{\centering}m{0.8 in} >{\centering}m{0.8in} 
                  >{\centering}m{0.8in} >{\centering}m{0.8in} 
                  >{\centering}m{1.5in} >{\centering\arraybackslash}m{1.5in} }
    \bfseries Heading 1 & \bfseries Heading 2 & \bfseries Heading 3 & \bfseries Heading 4 & \bfseries Heading Heading Heading 5 & \bfseries Heading Heading Heading 6 \\

\hline

text & text & text & text &
    \begin{itemize}
        \item texttexttexttexttex texttexttexttexttexttexttexttext \end{itemize} &
    \begin{itemize}
         \item texttext texttext texttext texttext
        \item texttext texttext texttext texttext\end{itemize} \\

\end{tabular}
\end{ruledtabular}
\end{table*}

\end{document}

Example table B: Now, when using the "p" vertical alignment, the bullet-pointed items are correctly aligned, but everything else gets thrown off in the other columns. Also, I wanted to leave the "Headings" all vertically aligned.

In latex (Table B):

\documentclass{revtex4-1}
\usepackage{array}
\begin{document}

\begin{table*}
\begin{ruledtabular}
\begin{tabular}{ >{\centering}m{0.8 in} >{\centering}m{0.8in} 
                  >{\centering}m{0.8in} >{\centering}m{0.8in} 
                  >{\centering}p{1.5in} >{\centering\arraybackslash}p{1.5in} }
    \bfseries Heading 1 & \bfseries Heading 2 & \bfseries Heading 3 & \bfseries Heading 4 & \bfseries Heading Heading Heading 5 & \bfseries Heading Heading Heading 6 \\

\hline

text & text & text & text &
    \begin{itemize}
        \item texttexttexttexttex texttexttexttexttexttexttexttext \end{itemize} &
    \begin{itemize}
         \item texttext texttext texttext texttext
        \item texttext texttext texttext texttext\end{itemize} \\

\end{tabular}
\end{ruledtabular}
\end{table*}

\end{document}
David Carlisle
  • 757,742
st77
  • 31
  • Please always show a complete document that produces the image, it's hard to guess what markup you have used otherwise. A column specifier such as m, p, b only affects the one column not others, and can be changed per cell with \multicolumn{1}{b{..}}{...} – David Carlisle Oct 13 '14 at 19:40
  • Sorry, I just added it in. – st77 Oct 13 '14 at 19:42
  • well a complete document is better (I don't know where ruledtabular is defined for example, so i can't run your code, also whhat layout do you want? I'm guessing like the second example but without the space above the lists? – David Carlisle Oct 13 '14 at 19:44
  • 1
    @David Carlisle: I think ruledtabular comes from revtex. – Bernard Oct 13 '14 at 19:49
  • I'd like to look almost exactly like Table A, except that the bullet-pointed items are aligned to the top left. And so all the other entries are vertically centered. – st77 Oct 13 '14 at 19:53
  • Yes, I'm using revtex4-1 as the document class. The ruledtabular here isn't important, it just makes the double horizontal lines at the top and bottom of the table. – st77 Oct 13 '14 at 19:54
  • 1
    Note that m doesn't mean to vertically centre the text in the space taken up be that row, it means place the vertical cemtre of _this entry" (the word text here) on the reference line for the row, which is why when they have m and the list entries have p the centre of text lines up with the top of the space above the list – David Carlisle Oct 13 '14 at 19:56
  • 1
    @st77 it's important as people like to test their answers by running your code, and that's hard if it contains undefined commands. – David Carlisle Oct 13 '14 at 19:57
  • @DavidCarlisle You're definitely right. Sorry, my first post here, I'll remember for next time. – st77 Oct 13 '14 at 20:12
  • @st77 yes I know it's first post that's why I fixed up your example (otherwise I just wouldn't have answered:-) welcome to the site:-) – David Carlisle Oct 13 '14 at 20:13

1 Answers1

3

You can use nested tabular to control the alignment and enumitem to use a list with less vertical space:

enter image description here

\documentclass{revtex4-1}
\usepackage{array,enumitem}
\begin{document}
\begin{table*}
\begin{ruledtabular}
\begin{tabular}{ >{\centering}p{0.8 in} >{\centering}p{0.8in} 
                  >{\centering}p{0.8in} >{\centering}p{0.8in} 
                  >{\centering}p{1.5in} >{\centering\arraybackslash}p{1.5in} }
    \bfseries Heading 1 & \bfseries Heading 2 & \bfseries Heading 3 & \bfseries Heading 4 & \bfseries Heading Heading Heading 5 & \bfseries Heading Heading Heading 6 \\

\hline

text & text & text & text &
\multicolumn{2}{@{}m{\dimexpr3in+2\tabcolsep}@{}}{%
\begin{tabular}{>{\centering}p{1.5in} >{\centering\arraybackslash}p{1.5in}}
    \begin{itemize}[leftmargin=1em,noitemsep,topsep=0pt,parsep=0pt,partopsep=0pt]
        \item texttexttexttexttex texttexttexttexttexttexttexttext \end{itemize} &
    \begin{itemize}[leftmargin=1em,noitemsep,topsep=0pt,parsep=0pt,partopsep=0pt]
         \item texttext texttext texttext texttext
        \item texttext texttext texttext texttext\end{itemize} \\
\end{tabular}}
\end{tabular}
\end{ruledtabular}
\end{table*}
\end{document}
David Carlisle
  • 757,742
  • This looks great, I'll try it out. Thanks a lot! – st77 Oct 13 '14 at 20:16
  • David Carlisle: I try your code with two changes: instead of 'revex4-1' I use 'article', and for easy see obtained result I added 'preview' package. Without of 'preivew' I obtained the same result as you, with it, on the top of last column in nested table arise empty space. – Zarko Oct 14 '14 at 05:24
  • @Zarko presumably preview is conflicting with enumitem in some way, I don't know that package, perhaps ask a new question just about that – David Carlisle Oct 14 '14 at 08:01