对齐由一条线分隔的两个表格

对齐由一条线分隔的两个表格

有没有办法对齐两个表格元素,使得它们的列之间的空间位于相同的位置,或者将非表格元素插入到表格中?

以下是示例:

\documentclass[a4paper,10pt]{article} % Default font size and paper size

\begin{document}
\section{Animals and Plants}

\emph{Animals} \\
\begin{tabular}{ll}
My all-time favourites: & gorillas, dogs, horses \\
Other animals: & snakes, frogs, lizards, turtles \\
& squirrels \\
& cats, lions \\
& yaks \\
& eagles \\ 
& various fishes and other marine life \\ 
& many microscopic animals\\
\end{tabular}

\item Fungi are alright\\
\emph{Plants} \\
\begin{tabular}{ll}
    oak & favourite \\
    birch &  alright \\ 
    cactus & good \\
    ivy & hate it\\
\end{tabular}

\end{document}

我希望“收藏”与其上方的“许多微小动物”对齐。另外,我不知道这是否有区别,但我需要它可编译 XeLaTex。谢谢。

答案1

使用固定列:

在此处输入图片描述

\documentclass[a4paper,10pt]{article} % Default font size and paper size

\usepackage{array}
\begin{document}
\section{Animals and Plants}

\begin{itemize}
\item zzz
\emph{Animals}\strut\\
\begin{tabular}{>{\raggedright}p{3cm}l}
My all-time favourites: & gorillas, dogs, horses \\
Other animals: & snakes, frogs, lizards, turtles \\
& squirrels \\
& cats, lions \\
& yaks \\
& eagles \\ 
& various fishes and other marine life \\ 
& many microscopic animals\\
\end{tabular}

\item Fungi are alright\\
\emph{Plants}\strut\\
\begin{tabular}{>{\raggedright}p{3cm}l}
    oak & favourite \\
    birch &  alright \\ 
    cactus & good \\
    ivy & hate it\\
\end{tabular}
\end{itemize}

\end{document}

相关内容