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}

在此輸入影像描述

相關內容