在逐项环境中将表格垂直对齐到基线

在逐项环境中将表格垂直对齐到基线

我有一个tabular内部itemize环境:

\documentclass{article}
\begin{document}
    \begin{itemize}
        \item[(b)]
        \begin{tabular}{|c|c|}
            ...
        \end{tabular}
    \end{itemize}
\end{document}

它看起来像这样:

错误的

但我希望它看起来像这样:

正确的

即我想将表格顶部与当前item基线对齐。该怎么做?

答案1

考虑使用adjustboxtabular将s 与s垂直对齐\item作为默认的[t]op 和[b]ottom 对齐,当包含水平规则 - \hlines - 时会影响它:

在此处输入图片描述

\documentclass{article}

\usepackage{adjustbox}

\begin{document}

\begin{enumerate}
  \item
    \adjustbox{valign=t}{\begin{tabular}{|c|c|}
      \hline
      Lorem & Ipsum \tabularnewline
      \hline
      One  &\tabularnewline
      Two  & Wow \tabularnewline
      Three& \tabularnewline
      \hline
    \end{tabular}}
    \qquad
    \begin{tabular}[t]{|c|c|}
      \hline
      Lorem & Ipsum \tabularnewline
      \hline
      One  &\tabularnewline
      Two  & Wow \tabularnewline
      Three& \tabularnewline
      \hline
    \end{tabular}

  \item
    \adjustbox{valign=b}{\begin{tabular}{|c|c|}
      \hline
      Lorem & Ipsum \tabularnewline
      \hline
      One  &\tabularnewline
      Two  & Wow \tabularnewline
      Three& \tabularnewline
      \hline
    \end{tabular}}
    \qquad
    \begin{tabular}[b]{|c|c|}
      \hline
      Lorem & Ipsum \tabularnewline
      \hline
      One  &\tabularnewline
      Two  & Wow \tabularnewline
      Three& \tabularnewline
      \hline
    \end{tabular}
\end{enumerate}

\end{document}

相关内容