4

How to set the column width in the align environment. I've got a align environment to demonstrate how to do division by hand so the columns always contain only one number, but the columns are much wider than this.

Following an example only showing the ugly result because of to wide columns:

\begin{align}
    &1&2&3&4&4\\
    & & & &2&4\\
\end{align}
2
  • Not to sway you from what you're after, but why not just typeset this in an array? – Werner Oct 9 '11 at 18:07
  • Oh that's a good hint. I did this now. But still I would like narrower columns. How to achieve this for array? – Sebastian Oct 9 '11 at 18:12
7

If the only reason for using align is to have elements aligned across columns, then an array environment would be an easier way to manage your situation. The column specification when using an array is straight-forward, and allows you to modify the width between columns very easily. Include the array package that provides the column separator specification @{} (as well as a host of other functionality). Here's an example:

\documentclass{article}
\usepackage{array}% http://ctan.org/pkg/array
\begin{document}
    Regular array with centered columns:
    \[
    \begin{array}{ccccc}
    1&2&3&4&4\\
    & & &2&4
    \end{array}
    \]
    
    Varied spacing between columns:
    \[
    \begin{array}
    {c@{\hspace{2em}}c@{\hspace{2pt}}c@{\hspace{2ex}}c@{\hspace{2bp}}c}
    1&2&3&4&4\\
    & & &2&4
    \end{array}
    \]
    
    Varied column alignment:
    \[
    \begin{array}{ccclr}
    111&222&333&444&444\\
    &   &   &  2&4
    \end{array}
    \]
\end{document}

enter image description here

If you want to remove the intercolumn spacing completely, use @{}.

7

Increase the value to whatever you like:

\documentclass{article}
\begin{document}

$\arraycolsep=1.5pt%
\begin{array}{*6c}
    &1&2&3&4&4\\
    & & & &2&4\\
\end{array}$

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.