0

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.

overfull halign table

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 &.

felipecrv
  • 188
  • 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 00:15
  • @Aditya I tried. Some of the solutions were simply broken and others didn't give the control I needed. – felipecrv Jan 28 '16 at 00: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. – felipecrv 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 01 '16 at 09:01
  • @Metafox I wrote a program that's generating the TeX code and simply setting the width of the columns won't work. I want to get TeX's glue model working to calculate the column widths. I can do some inspection and tweek halign here and there if I don't get a solution for this. The problem I had with natural tables is that they were simply broken on my system (the simplest code didn't even compile). I tried it in the beginning of the project. Now I'm invested in halign and have only this single problem. – felipecrv Feb 02 '16 at 12:51

1 Answers1

3

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

enter image description here

Henri Menke
  • 109,596
  • 1
    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
  • 1
    @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
  • 1
    @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: I did write some articles targeted towards beginners, but haven't written on in some time. If you feel that the wiki and current documentation is lacking in specific areas, let me know and I can see if I can write something about those. – Aditya Jul 17 '16 at 23:48
  • @Aditya My problem is that I tend to learn much better by example, and I would love that there was a lot of sources I could look at and modify by myself. Also the fact that ConTeXt is much more complex means that I just don't even know where to look, in LaTeX I already know where to look for the source of packages, or the source of latex.ltx. In ConTeXt, even if I don't know where I'm looking, I open one file of the source, and I find tons of commands that I don't know how they work and how they are defined. – Manuel Jul 18 '16 at 10:43
  • @Manuel You might be interested in this question. To date there is only one, but excellent, answer. – Henri Menke Jul 18 '16 at 11:26
  • 1
    @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