# different column widths in a tabular [duplicate]

I would like that the width of the first column of an array to be 2cm and the second column to be 1cm. I have the following document but apparently the setting for the width of the second column is not working.

  \documentclass{book}
\usepackage{multicol}
\begin{document}
\begin{multicols}{2}
\noindent
\begin{tabular}{ p{2cm} l   p{1cm} r}
abc abc abc abc   & xyz xyz xyz xyz xyz \\
\end{tabular}
\end{multicols}
\end{document}

• You have defined four columns, the second of which has no fixed width. Are you trying to specify that the first column must have left alignment and the second one right alignment? Nov 3 '15 at 10:46
• @egreg yes exactly, I would like that the first column to have left alignment and the second one to have right alignment.
– Name
Nov 3 '15 at 10:48

The problem is the unnecessary l annd r in \begin{tabular}{ p{2cm} l p{1cm} r}:

\documentclass{book}
\usepackage{multicol}
\begin{document}
\begin{multicols}{2}
\noindent
\begin{tabular}{ p{2cm}   p{1cm}}
abc abc abc abc   & xyz xyz xyz xyz xyz \\

aaaaaa   & bbbbbb bbbbbbbb bbbbbbbb bbbbbbb \\
\end{tabular}
\end{multicols}
\end{document}


Update: Regarding aligning the second column right, I recommend reading this answer

• Thanks, is it possible to preserve the left alignment for the first column and the right alignment for the second one (as discussed in the comments above)?
– Name
Nov 3 '15 at 10:53
• I have updated the answer regarding the right alignment. Nov 3 '15 at 10:55