# How to make equal width columns?

Based on Leo's answer but I removed one column and replaced the \big) with a vertical rule. Now I want to make all columns have the same width. How to do this?

\documentclass{article}
\usepackage{amssymb}

\begin{document}

$x^3 - x + 1 = (x-1)(x^2+x) + 1 \in \mathbb{F}_3[x]$

$\renewcommand\arraystretch{1.2} \begin{array}{*{6}{r}} & & & 1& 1& 0\\\cline{3-6} 1& -1& \multicolumn{1}{|r}{1}& 0& -1& 1\\ & & 1& -1& & \\\cline{3-5} & & & 1& -1& \\ & & & 1& -1& \\\cline{4-6} & & & & & 1\\ \end{array}$

\end{document}


I got the solution by using \begin{array}{*{6}{>{\hfill}m{1cm}}}, but is there any other solution?

I would prefer, but it's a question of taste, the following:

\usepackage{array}
\newcolumntype{R}[1]{>{\hbox to #1\bgroup\hfill$}c<{$\egroup}}

...


The syntax \hbox to <dimen> is low level TeX, which is generally not recommended in LaTeX because it can have disastrous effects on color management. However, since this is done at the start at the cell, it should not be a problem. The construction \hbox to 1.5em{\hfil x} is similar to \makebox[1.5em][r]{x}, but it can be split into two parts: \hbox to 1.5em\bgroup at the beginning and \egroup at the end, so the "argument" can be gathered with array's syntax.

A similar setup can be obtained by

\newcolumntype{R}[1]{>{\raggedleft\arraybackslash$}p{#1}<{$}}

• Are you sure it can be compiled? – xport Jun 22 '11 at 8:09
• Sorry, there was a missing brace; I almost always miss one when I use *{n}{cols}. :-( – egreg Jun 22 '11 at 8:17
• what is to? It does not get rendered on the output. – xport Jun 22 '11 at 8:21
• Actually I want to check both Herbert's and your answers. Explaining to makes it a bit different. – xport Jun 22 '11 at 11:50
\documentclass{article}
\usepackage{amssymb,array,ragged2e}
\newcolumntype{R}[1]{>{\RaggedLeft}p{#1}}
\begin{document}

$x^3 - x + 1 = (x-1)(x^2+x) + 1 \in \mathbb{F}_3[x]$

\[
\renewcommand\arraystretch{1.2}
\begin{array}{*6{R{1em}}}
...