3

I have the following code:

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

\begin{tabular}{|p{1cm}|m{1cm} | @{}m{0pt}@{}}
    \hline
        1-1 & 1-2&\\[1cm]
        \hline
        2-1 & 2-2 &\\[1cm]
    \hline
\end{tabular}
\end{document}

Had to use a hack to make the last column align middle:

Vertical alignment in table: m-column, row size - problem in last column

Wikipedia says:

  1. p{'width'} --- paragraph column with text vertically aligned at the top

  2. m{'width'} --- pragraph column with text vertically aligned in the middle (requires array package)

So I inspected the 1-st column to be top aligned, and the 2-nd to be middle aligned. But instead, both columns are middle aligned:

enter image description here

How to make the 1-st column cells top aligned?

2 Answers 2

2

Not sure if this is what you want? I seem to recall that David Carlisle once said that the alignment parameters apply to the alignment with respect to other matter in that cell, not, as you were hoping, with respect to matter in adjacent cells.

What I did here is add buffer space above and below each data entry.

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

\begin{tabular}{|m{1cm}|m{1cm} | @{}m{0pt}@{}}
    \hline
        \addvbuffer[0.0cm 0.9cm]{1-1} & \addvbuffer[.5cm]{1-2}&\\
        \hline
        \addvbuffer[0.0cm 0.9cm]{2-1} & \addvbuffer[0.5cm]{2-2} &\\
    \hline
\end{tabular}
\end{document}

enter image description here

7

enter image description here

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

\begin{tabular}{|p{1cm}|>{\vspace{.5cm}}p{1cm}<{\vspace{.5cm}}|}
    \hline
        1-1 & 1-2\\
        \hline
        2-1 & 2-2\\
    \hline
\end{tabular}
\end{document}

In your original your paragraph entries are only single line so it is hard to spot the difference between p and m the p makes the reference point be on the baseline of the first line (like \parbox[t]) and m makes the reference point be at the vertical centre offset by the math axis height, (like \parbox[c]) So on a single line entry this only slightly lowers the entries in the second column.

1
  • I like you solution better than mine. @user4035 I won't be offended if you re-award the accepted answer to Dr. Carlisle. Commented May 15, 2013 at 12:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .