1

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}
Name
  • 2,816
  • 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? – egreg Nov 03 '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 03 '15 at 10:48

1 Answers1

2

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

Icarus
  • 153
  • 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 03 '15 at 10:53
  • I have updated the answer regarding the right alignment. – Icarus Nov 03 '15 at 10:55