與列寬 {p{cm}} 左對齊

與列寬 {p{cm}} 左對齊

我正在嘗試創建一個類似的表:

Idioms                Definition 

A dime                Anything that is common, inexpensive, 
a dozen               and easy to get or available any where. 
Beat around           To treat a topic, but omit its main points, 
the bush              often intentionally or To delay or avoid
                      talking about something difficult or unpleasant.
Bite off more         To take on more responsibility than you can manage.
than one can chew

...

我所做的是

 \documentclass{book}
    \begin{document}
    \thispagestyle{empty}
    \noindent
    \begin{tabular}{p{6cm} p{12cm}}
    Idioms & Definitions
    {The Remaining portions of work goes here.} 
    \end{tabular}
    \end{document}

但我得到

成語定義

A         dime        Anything that is common, inexpensive, 
a dozen               and easy to get or available any where. 
Beat       around     To treat a topic, but omit its main points, 
the     bush          often intentionally or To delay or avoid
                      talking about something difficult or unpleasant.
Bite off       more   To take on more responsibility than you can manage.
than one can chew

...

我認為這與對齊有關。上面的範例並不是我在 Latex 中得到的確切範例。但這反映了我的問題。用 l 而不是 p,我可以得到所需的左對齊。但沒有桌子尺寸。但尺寸固定後,對齊就會出錯。

序言中的某些元素可能會遺失,就像我使用 setspace 和 anysize 等套件一樣。

資料來源:上表摘自維基百科,代表我的情況。

答案1

使用tabularx並且還\RaggedRight

\documentclass{book}
\usepackage{tabularx,ragged2e}
\begin{document}
\noindent
\begin{tabularx}{\textwidth}{ 
  @{} % no \tabcolsep on the left side
  >{\RaggedRight}p{6cm}% let the p column typeset ragged right
  X % dynamical column width 
  @{} % no \tabcolsep on the right side
 }
    Idioms & Definitions
    {The Remaining portions of work goes here.} 
\end{tabularx}
\end{document}

相關內容