将自定义表格列环境中的内容与每行的顶部对齐

将自定义表格列环境中的内容与每行的顶部对齐

我有一个自定义的表格列样式来固定表格中的行高(这为会议上的海报板制作标签,每张 A4 纸 4 个标签)。它几乎可以正常工作,但内容与底部行,我希望它与顶部行。我做错了什么?MWE:

\documentclass{article}
\usepackage[landscape]{geometry}
\usepackage{anyfontsize}
\usepackage{array}

\usepackage[sfdefault,black]{merriweather} %% Option 'black' gives heavier bold face
\usepackage[T1]{fontenc}

\begin{document}
\pagenumbering{gobble}

\newcolumntype{C}[1]{%
 >{\vbox to 6cm\bgroup\vspace{0pt}}%
 m{#1}%
 <{\egroup}}

\begin{tabular}[t]{|C{10cm} | C{10cm}|}
\hline
\begin{center}
\fontsize{22}{22}\selectfont{}\textsf{\textbf{P128}}\par
%\vspace{1cm}
\fontsize{18}{18}\selectfont{}\emph{Plant Psychology: an integrated approach utilising Neural Networks}
\end{center}
&
\begin{center}
\fontsize{22}{22}\selectfont{}\textsf{\textbf{P134}}\par
%\vspace{1cm}
\fontsize{18}{18}\selectfont{}\emph{Placeholder Text: Nothing to see here}
\end{center}\tabularnewline

\hline

\begin{center}
\fontsize{22}{22}\selectfont{}\textsf{\textbf{P135}}\par
%\vspace{1cm}
\fontsize{18}{18}\selectfont{}\emph{A Much Longer Poster Title A Much Longer Poster Title A Much Longer Poster Title A Much Longer Poster Title A Much Longer Poster Title A Much Longer Poster Title A Much Longer Poster Title A Much Longer Poster Title}
\end{center}
&
\begin{center}
\fontsize{22}{22}\selectfont{}\textsf{\textbf{P428}}\par
%\vspace{1cm}
\fontsize{18}{18}\selectfont{}\emph{Fantastic Bees and Where to Find Them}
\end{center}\tabularnewline
\hline
\end{tabular}

\end{document}

在此处输入图片描述

(单独的问题:如何在每个边框周围添加填充以隔开标签以便进行剪切?)

答案1

通过添加\vfil

\documentclass{article}
\usepackage[landscape]{geometry}
\usepackage{anyfontsize}
\usepackage{array}

\usepackage[sfdefault,black]{merriweather} %% Option 'black' gives heavier bold face
\usepackage[T1]{fontenc}

\begin{document}
\pagenumbering{gobble}

\newcolumntype{C}[1]{%
 >{\vbox to 6cm\bgroup\vspace{0pt}}%
  m{#1}
 <{\vfil\egroup}}

\begin{tabular}[t]{|C{10cm} | C{10cm}|}
\hline
\begin{center}
\fontsize{22}{22}\selectfont{}\textsf{\textbf{P128}}\par
%\vspace{1cm}
\fontsize{18}{18}\selectfont{}\emph{Plant Psychology: an integrated approach utilising Neural Networks}
\end{center}
&
\begin{center}
\fontsize{22}{22}\selectfont{}\textsf{\textbf{P134}}\par
%\vspace{1cm}
\fontsize{18}{18}\selectfont{}\emph{Placeholder Text: Nothing to see here}
\end{center}\tabularnewline

\hline

\begin{center}
\fontsize{22}{22}\selectfont{}\textsf{\textbf{P135}}\par
%\vspace{1cm}
\fontsize{18}{18}\selectfont{}\emph{A Much Longer Poster Title A Much Longer Poster Title A Much Longer Poster Title A Much Longer Poster Title A Much Longer Poster Title A Much Longer Poster Title A Much Longer Poster Title A Much Longer Poster Title}
\end{center}
&
\begin{center}
\fontsize{22}{22}\selectfont{}\textsf{\textbf{P428}}\par
%\vspace{1cm}
\fontsize{18}{18}\selectfont{}\emph{Fantastic Bees and Where to Find Them}
\end{center}\tabularnewline
\hline
\end{tabular}

\end{document}

第一个代码的输出

如果您想要更多填充,您可以提高值\tabcolsep(默认值为 5 pt)并放置 \vspace{10pt} instead of\vspace{0pt} in your\newcolumntype`。

\documentclass{article}
\usepackage[landscape]{geometry}
\usepackage{anyfontsize}
\usepackage{array}

\usepackage[sfdefault,black]{merriweather} %% Option 'black' gives heavier bold face
\usepackage[T1]{fontenc}

\begin{document}
\pagenumbering{gobble}

\setlength{\tabcolsep}{15pt}

\newcolumntype{C}[1]{%
 >{\vbox to 6cm\bgroup\vspace{10pt}}%
  m{#1}
 <{\vfil\egroup}}

\begin{tabular}[t]{|C{10cm} | C{10cm}|}
\hline
\begin{center}
\fontsize{22}{22}\selectfont{}\textsf{\textbf{P128}}\par
%\vspace{1cm}
\fontsize{18}{18}\selectfont{}\emph{Plant Psychology: an integrated approach utilising Neural Networks}
\end{center}
&
\begin{center}
\fontsize{22}{22}\selectfont{}\textsf{\textbf{P134}}\par
%\vspace{1cm}
\fontsize{18}{18}\selectfont{}\emph{Placeholder Text: Nothing to see here}
\end{center}\tabularnewline

\hline

\begin{center}
\fontsize{22}{22}\selectfont{}\textsf{\textbf{P135}}\par
%\vspace{1cm}
\fontsize{18}{18}\selectfont{}\emph{A Much Longer Poster Title A Much Longer Poster Title A Much Longer Poster Title A Much Longer Poster Title A Much Longer Poster Title A Much Longer Poster Title A Much Longer Poster Title A Much Longer Poster Title}
\end{center}
&
\begin{center}
\fontsize{22}{22}\selectfont{}\textsf{\textbf{P428}}\par
%\vspace{1cm}
\fontsize{18}{18}\selectfont{}\emph{Fantastic Bees and Where to Find Them}
\end{center}\tabularnewline
\hline
\end{tabular}

\end{document}

第二段代码的输出

相关内容