# How to limit the width of \halign?

The glues inside my \halign rows don't get reduced when they should. The contents of \halign behave as if they had infinite horizontal space.

This is the source code for the first table (it's very verbose since I had to expand most of the macros I defined to make it smaller in my own file):

{
\offinterlineskip
\vfil
\vbox{%
\halign{%
% Preamble
#
\aligntab
\hbox to 0.8cm{#}
\aligntab
\hskip 0.2em{#}\hskip 5mm minus 5mm
\aligntab
\LightFont{#}\hskip 5mm minus 5mm
\aligntab
\LightFont{#}
\cr
%
\multispan5{\hbox to 5.6cm{}} \cr

\vrule height2ex depth3pt width0pt
\aligntab
\aligntab
\multispan3\Mot{CG}\hfilll
\cr

\aligntab \aligntab \multispan3\leaders\hrule\hfil \cr

\vrule height2ex depth3pt width0pt
\aligntab
\Num{5909}
\aligntab
Levorin Msa
\aligntab
Dianteira
\aligntab
80/100-18
\cr

\aligntab \aligntab \multispan3\leaders\hrule\hfil \cr

\vrule height2ex depth3pt width0pt
\aligntab
\Num{5904}
\aligntab
Max Tube
\aligntab
Dianteira
\aligntab
80/100-18
\cr

\aligntab \aligntab \multispan3\leaders\hrule\hfil \cr

\vrule height2ex depth3pt width0pt
\aligntab
\Num{8159}
\aligntab
Michelin
\aligntab
Dianteira
\aligntab
80/100-18
\cr

\aligntab \aligntab \multispan3\leaders\hrule\hfil \cr

\vrule height2ex depth3pt width0pt
\aligntab
\Num{6947}
\aligntab
Monte Cristo
\aligntab
Dianteira
\aligntab
80/100-18
\cr

\aligntab \aligntab \multispan3\leaders\hrule\hfil \cr
}}}


How can I force the \halign to have a maximum width so that the glues can be correctly shrinked?

Observation: I'm using ConTeXt, hence the need to use \aligntab instead of &.

• Any particular reason you are not using one of the built-in table macros in ConTeXt. The layout is relatively easy to get using Natural Tables. – Aditya Jan 28 '16 at 0:15
• @Aditya I tried. Some of the solutions were simply broken and others didn't give the control I needed. – philix Jan 28 '16 at 0:30
• @philix Which problem do you have with natural tables? As your layout is the same for both tables you can write a template and load it at the begin of each table. – Wolfgang Schuster Jan 30 '16 at 16:10
• @Metafox I want to be able to define a fixed width for the \halign tables. – philix Jan 31 '16 at 23:25
• @philix When you want tips about \halign read a book about plain TeX but when you’re interested about a solution for ConTeXt’s own table environments, I can show you how you a example where you can set the width of the columns. – Wolfgang Schuster Feb 1 '16 at 9:01

Your example is easily reproduced using natural tables. Documentation can be found in the Garden.

\setupbodyfont[dejavu,sans]
\starttext

\startsetups table:colors
\setupTABLE[column][1][style=blue]
\setupTABLE[row][1][style=red]
\stopsetups

\startsetups table:rules
\setupTABLE[frame=off]
\setupTABLE[row][each][bottomframe=on]
\setupTABLE[column][1][bottomframe=off]
\stopsetups

\startTABLE[setups={table:colors,table:rules}]
\NC\NC CG \NC\NR
\NC 5909 \NC Levorin Msa  \NC Dianteira \NC 80/100-18 \NC\NR
\NC 5904 \NC Max Tube     \NC Dianteira \NC 80/100-18 \NC\NR
\NC 8159 \NC Michelin     \NC Dianteira \NC 80/100-18 \NC\NR
\NC 6947 \NC Monte Cristo \NC Dianteira \NC 80/100-18 \NC\NR
\stopTABLE

\stoptext


• How have you started to learn ConTeXt? Do you have any resources or example documents? I have a really bad relation with the wiki :) – Manuel Jul 17 '16 at 20:59
• @Manuel I'm still a beginner in ConTeXt. I started reading the ConTeXt reference manual which is (IMHO) not very nice to read but the information density is quite high. Actually, the wiki is not that bad. Unfortunately, it is in most cases somewhat out-of-date. An up-to-date but non-user-friendly reference is setup-en.pdf. – Henri Menke Jul 17 '16 at 21:44
• @Manuel Now I'm learning ConTeXt by doing in the sense that I try to answer ConTeXt questions here, participate on the mailing list, and reproduce my TeX/LaTeX documents with it. – Henri Menke Jul 17 '16 at 21:45
• @Manuel Oh, and first and foremost I did Aditya's extremely great tutorial. This is where I learned the most. It perfectly shows how to build a document from scratch. – Henri Menke Jul 17 '16 at 22:49
• @Manuel If you are using TeXlive, you can execute texdoc ma-cb-en to read »ConTeXt Mark IV - an excursion«, which is an updated version of »ConTeXt - an excursion«. This is a very basic introduction and doesn't explain all the keys to \setup.... To find out the accepted keys your best bet is to simply online-search the command name. In most cases this directs you to the wiki or to some mailing list question. – Henri Menke Jul 18 '16 at 11:33