Tabularx 列设置占用空间和文本左对齐

Tabularx 列设置占用空间和文本左对齐

下表创建了一个 3 列表格,当我使用{l | X | X}列设置时,它会创建等宽的最后 2 列,这正是我想要的,但我还希望其中的文本左对齐。

这可以在列设置中完成吗?

\begin{table}[!htb]
\caption{Caption.....}
\label{tab:____}
\begin{tabularx}{\linewidth}{l | X | X}
\toprule
Col1 & Col2 & Col3\\
\midrule

eMail & \tabitem aaaaaaaaaaaaaaaaaaaaaaaa
    \tabitem bbbbbbbbbbbbbbbbbbbbbbbb
    \tabitem cccccccccccccccccccccccc 
    & 
    \tabitem dddddddddddddddddddddd
    \tabitem eeeeeeeeeeeeeeeeeeeeee
    \tabitem ffffffffffffffffffffff
    \tabitem gggggggggggggggggggggg\\


\bottomrule
\end{tabularx}
\end{table} 

在此处输入图片描述

答案1

\documentclass{article}
\usepackage{tabularx,booktabs,ragged2e}
\newcommand\tabitem{\textbullet~} 
\renewcommand\tabularxcolumn[1]{>{\RaggedRight}p{#1}}

\begin{document}

\begin{table}[!htb]
    \caption{Caption.....}\label{tab:____}
    \noindent
    \begin{tabularx}{\linewidth}{l | X | X}
        \toprule
        Col1 & Col2 & Col3\\
        \midrule

        eMail & \tabitem aaaaaaaaaaaaaaaaaaaaaaaa
        \tabitem bbbbbbbbbbbbbbbbbbbbbbbb
        \tabitem cccccccccccccccccccccccc 
        & 
        \tabitem dddddddddddddddddddddd
        \tabitem eeeeeeeeeeeeeeeeeeeeee
        \tabitem ffffffffffffffffffffff
        \tabitem gggggggggggggggggggggg\\

        \bottomrule
    \end{tabularx}
\end{table} 

\end{document}

在此处输入图片描述

相关内容