0

Consider the following:

\documentclass{memoir}
\usepackage{array}
\begin{document}
\begin{tabular}{l>{\raggedright}p{0.45\textwidth}}
        foo   & bar  \\
        one   & two  \\
        three & four \\
\end{tabular}
\end{document}

It gives me the following error message:

! Extra alignment tab has been changed to \cr.
<recently read> \endtemplate 

l.6         one   &
                    two  \\
? 

Clearly I am doing something wrong but I just can't figure it out. Can someone explain it to me?

jonalv
  • 11,466
  • You need to add \arraybackslash after \raggedright. (I'm pretty sure similar questions have been asked before, if I can't find one I can add an answer.) – Torbjørn T. May 28 '14 at 10:05
  • See for example http://tex.stackexchange.com/questions/12703/how-to-create-fixed-width-table-columns-with-text-raggedright-centered-raggedlef or http://tex.stackexchange.com/questions/4839/raggedleft-paragraph-in-a-table?rq=1 – Torbjørn T. May 28 '14 at 10:09
  • Somehow I missed those two. I was looking at a third one but for some reason completely missed the \arraybackslash thing. I also looked in the array package documentation but missed it there as well for some reason... – jonalv May 28 '14 at 10:16
  • I was looking at: http://tex.stackexchange.com/a/52247/298 I don't understand if that works though but that is beside the point now I guess... – jonalv May 28 '14 at 10:18

0 Answers0