1

My question is similar to this question But it seems different. I wrote this code:

\documentclass[letterpaper,11pt]{article}
\usepackage{tabularx}
\section{Selected courses}
\begin{center}
\begin{tabular}{ m{8cm} m{6.5cm} r{2cm} }
 C & C & C \\
 C & C & C \\
\end{tabular}
\end{center}

My code was working last month without error. but I opened it today and got this error:

Package array Error: Illegal pream-token (2cm): `c' used.
See the array package documentation for explanation.
Type  H <return>  for immediate help.
...                                                                                            
l.295 ...\begin{tabular}{ m{8cm} m{6.5cm} r{2cm} }
Try typing  <return>  to proceed.
If that doesn't work, type  X <return>  to quit.

I think it's maybe related to the package update.

4
  • 3
    The r column type does not allow an argument for the width. Jan 19, 2023 at 14:25
  • 2
    Replace r{...} with wr{...}
    – Celdor
    Jan 19, 2023 at 14:37
  • Welcome to TeX.SX! You could turn your good question into a great question if you turned the code into a syntactically valid LaTeX document. It is only missing the \begin{document}...\end{document}. That way the code you show avoids spurious errors and actually reproduces (only) your problem. (I can't offer the incentive that I will upvote your question if you do that, because I already voted.)
    – moewe
    Jan 19, 2023 at 14:57
  • "My code was working last month without error" no, that has never worked. Jan 19, 2023 at 17:28

1 Answer 1

1

The r column type does not allow an argument for the width. If you'd like a fixed width column with right aligned text, you could use something like this (I added vertical boarders | so one can see the alignment and made the columns much smaller so they fit on the page):

\documentclass[letterpaper,11pt]{article}
\usepackage{tabularx}
\begin{document}
\section{Selected courses}
\begin{center}
\begin{tabular}{ |m{3cm} |m{3.5cm}| >{\raggedleft\arraybackslash}m{2cm}| }
 C & C & C \\
 C & C & C \\
\end{tabular}
\end{center}
\end{document}
2
  • Note celdors comment, might be an idea to start promoting it.
    – daleif
    Jan 19, 2023 at 14:49
  • @daleif I'm looking forward to upvote their answer! Jan 19, 2023 at 14:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .