%-------------------------------------------------------------------------------
\setupoutput [pdftex]

\setuppapersize [A4, landscape] [A4, landscape]
\setuplayout[
    topspace=1cm, 
    backspace=1cm, 
    width=27.7cm, 
    height=19.5cm, 
    header=0cm, 
    footer=1.5cm,
    top=0.7cm,
    topdistance=0.8cm
]

\setupbodyfont [sansserif, 10pt]

\setupcolors [state=start]
\definecolor [TableBackground] [r=0.91, g=0.93, b=0.96]
\definecolor [CouleurChapitre] [r=0.35, g=0.53, b=0.77]
\definecolor [CouleurSujet] [r=0.96, g=0.52, b=0.15]

\setupheads [sectionnumber=no]
\setuphead [chapter] [style=\bfc, color=CouleurChapitre]
\setuphead [subject] [style=\bfa, color=CouleurSujet]

\setupTABLE[frame=off, option=stretch]
\setupTABLE[row][first][topframe=on, bottomframe=on, background=color, backgroundcolor=TableBackground]
\setupTABLE[row][last][bottomframe=on]
\setupTABLE[column][first][align={right,lohi}, aligncharacter=no]
\setupTABLE[column][each][align={middle,lohi}, aligncharacter=yes, alignmentcharacter={,}]

%-------------------------------------------------------------------------------
\starttext

\chapter{A bug in character alignment?}

\subject{Table 1 - Numbers in this table are correctly aligned}

\bTABLE
    \bTR
        \bTH Produit \eTH 
        \bTH Nombre \crlf de cours \eTH
        \bTH Part \crlf des cours \eTH
        \bTH Evolution en cours \crlf / année 2000 \eTH
        \bTH Revenu \eTH
        \bTH Part du revenu \eTH
        \bTH Evolution en revenu \crlf / année 2000 \eTH
        \bTH \% cumulé \crlf du revenu total \eTH
        \bTH Revenu moyen \crlf par cour \crlf par produit \eTH
    \eTR
        \bTR
            \bTD Sardine Maison Parent \eTD 
            \bTD 27 269 \eTD        
            \bTD 92,1\% \eTD
                \bTD +7,3\% \eTD
            \bTD 127 110 k\$ \eTD
            \bTD 46,7\% \eTD
                \bTD -2,0\% \eTD
            \bTD 46,7\% \eTD
                \bTD 4,7 k\$ \eTD
        \eTR
        \bTR
            \bTD Sardine Ami Parent \eTD 
            \bTD 20 084 \eTD        
            \bTD 67,8\% \eTD
                \bTD +1,6\% \eTD
            \bTD 65 770 k\$ \eTD
            \bTD 24,2\% \eTD
                \bTD +2,7\% \eTD
            \bTD 70,8\% \eTD
                \bTD 3,3 k\$ \eTD
        \eTR
        \bTR
            \bTD Sardine Maison Canapé \eTD 
            \bTD 2 606 \eTD        
            \bTD 8,8\% \eTD
                \bTD +14,7\% \eTD
            \bTD 50 302 k\$ \eTD
            \bTD 18,5\% \eTD
                \bTD +7,5\% \eTD
            \bTD 89,3\% \eTD
                \bTD 19,3 k\$ \eTD
        \eTR
        \bTR
            \bTD Sardine Maison Frange \eTD 
            \bTD 13 923 \eTD        
            \bTD 47,0\% \eTD
                \bTD +0,3\% \eTD
            \bTD 23 318 k\$ \eTD
            \bTD 8,6\% \eTD
                \bTD -5,8\% \eTD
            \bTD 97,9\% \eTD
                \bTD 1,7 k\$ \eTD
        \eTR
        \bTR
            \bTD Sardine Canapé Ami \eTD 
            \bTD 379 \eTD        
            \bTD 1,3\% \eTD
                \bTD +95,4\% \eTD
            \bTD 2 414 k\$ \eTD
            \bTD 0,9\% \eTD
                \bTD +75,5\% \eTD
            \bTD 98,8\% \eTD
                \bTD 6,4 k\$ \eTD
        \eTR
        \bTR
            \bTD Arbre Souple Maison \eTD 
            \bTD 1 321 \eTD        
            \bTD 4,5\% \eTD
                \bTD -12,1\% \eTD
            \bTD 2 198 k\$ \eTD
            \bTD 0,8\% \eTD
                \bTD -11,0\% \eTD
            \bTD 99,6\% \eTD
                \bTD 1,7 k\$ \eTD
        \eTR
        \bTR
            \bTD Filet Profond \eTD 
            \bTD 871 \eTD        
            \bTD 2,9\% \eTD
                \bTD -9,6\% \eTD
            \bTD 553 k\$ \eTD
            \bTD 0,2\% \eTD
                \bTD -15,2\% \eTD
            \bTD 99,8\% \eTD
                \bTD 0,6 k\$ \eTD
        \eTR
        \bTR
            \bTD Arbre Souple Voisin \eTD 
            \bTD 298 \eTD        
            \bTD 1,0\% \eTD
                \bTD -10,2\% \eTD
            \bTD 392 k\$ \eTD
            \bTD 0,1\% \eTD
                \bTD +6,0\% \eTD
            \bTD 99,9\% \eTD
                \bTD 1,3 k\$ \eTD
        \eTR
        \bTR
            \bTD Sardine Ami Frange \eTD 
            \bTD 637 \eTD        
            \bTD 2,2\% \eTD
                \bTD +29,2\% \eTD
            \bTD 184 k\$ \eTD
            \bTD 0,1\% \eTD
                \bTD +43,9\% \eTD
            \bTD 100,0\% \eTD
                \bTD 0,3 k\$ \eTD
        \eTR
        \bTR
            \bTD Bloc Profond \eTD 
            \bTD 2 \eTD        
            \bTD 0,0\% \eTD
                \bTD -80,0\% \eTD
            \bTD 1 k\$ \eTD
            \bTD 0,0\% \eTD
                \bTD -61,1\% \eTD
            \bTD 100,0\% \eTD
                \bTD 0,5 k\$ \eTD
        \eTR
    \bTR[style=\bf,topframe=on]
        \bTD Total \eTD
        \bTD 29 616 \eTD
        \bTD NA \eTD
        \bTD +7,0\% \eTD
        \bTD 272 241 k\$ \eTD 
        \bTD 100,0\% \eTD
        \bTD +0,7\% \eTD
        \bTD 100,0\% \eTD        
        \bTD NA \eTD 
    \eTR
\eTABLE

\subject{Tables 2 \& 3 - These tables cause a bug in last table! Comment these tables to remove the bug...}

\bTABLE
    \setupTABLE[c][1][width=4.3cm]
    \setupTABLE[c][2,3,4,5,6,7][width=3.9cm]
    \bTR
        \bTH Responsable \eTH
        \bTH Nombre de cours \eTH
        \bTH Evolution en cours \crlf / année 2000 \eTH
        \bTH Revenu \eTH
        \bTH Evolution en revenu \crlf / année 2000 \eTH
        \bTH Revenu moyen par an \crlf par cour \eTH
        \bTH Evolution du revenu moyen \crlf / année 2000 \eTH
    \eTR
    \bTR
        \bTD Cacahuète \eTD
        \bTD 38 229 \eTD
        \bTD +8,3\% \eTD
        \bTD 387 930 k\$ \eTD
        \bTD +8,3\% \eTD
        \bTD 10,1 k\$ \eTD
        \bTD -0,0\% \eTD
    \eTR
    \bTR
        \bTD Choufleur Italie \eTD
        \bTD 29 616 \eTD
        \bTD +7,0\% \eTD
        \bTD 272 241 k\$ \eTD
        \bTD +0,7\% \eTD
        \bTD 9,2 k\$ \eTD
        \bTD -5,9\% \eTD
    \eTR
    \bTR[style=\bf,topframe=on]
        \bTD Total \eTD
        \bTD 60 129 \eTD
        \bTD +7,8\% \eTD
        \bTD 660 172 k\$ \eTD 
        \bTD +5,1\% \eTD
        \bTD 11,0 k\$ \eTD
        \bTD -2,5\% \eTD
    \eTR
\eTABLE

\blank[1cm]

\bTABLE
    \setupTABLE[c][1,2,3][width=5cm]
    \bTR
        \bTH Responsable \eTH
        \bTH Evolution en cours \crlf / année 2000 \eTH
        \bTH Evolution en revenu \crlf / année 2000 \eTH
    \eTR
    \bTR
        \bTD Cacahuète \eTD
        \bTD -5,7\% \eTD
        \bTD +7,9\% \eTD
    \eTR
    \bTR
        \bTD Choufleur Italie \eTD
        \bTD +7,9\% \eTD
        \bTD -2,9\% \eTD
    \eTR
    \bTR[style=\bf,topframe=on]
        \bTD Total \eTD
        \bTD -0,4\% \eTD
        \bTD +3,1\% \eTD
    \eTR
\eTABLE

\subject{Table 4 - Same table as table 1, but numbers in column 4 and 5 are no more aligned!}

\bTABLE
    \bTR
        \bTH Produit \eTH 
        \bTH Nombre \crlf de cours \eTH
        \bTH Part \crlf des cours \eTH
        \bTH Evolution en cours \crlf / année 2000 \eTH
        \bTH Revenu \eTH
        \bTH Part du revenu \eTH
        \bTH Evolution en revenu \crlf / année 2000 \eTH
        \bTH \% cumulé \crlf du revenu total \eTH
        \bTH Revenu moyen \crlf par cour \crlf par produit \eTH
    \eTR
        \bTR
            \bTD Sardine Maison Parent \eTD 
            \bTD 27 269 \eTD        
            \bTD 92,1\% \eTD
                \bTD +7,3\% \eTD
            \bTD 127 110 k\$ \eTD
            \bTD 46,7\% \eTD
                \bTD -2,0\% \eTD
            \bTD 46,7\% \eTD
                \bTD 4,7 k\$ \eTD
        \eTR
        \bTR
            \bTD Sardine Ami Parent \eTD 
            \bTD 20 084 \eTD        
            \bTD 67,8\% \eTD
                \bTD +1,6\% \eTD
            \bTD 65 770 k\$ \eTD
            \bTD 24,2\% \eTD
                \bTD +2,7\% \eTD
            \bTD 70,8\% \eTD
                \bTD 3,3 k\$ \eTD
        \eTR
        \bTR
            \bTD Sardine Maison Canapé \eTD 
            \bTD 2 606 \eTD        
            \bTD 8,8\% \eTD
                \bTD +14,7\% \eTD
            \bTD 50 302 k\$ \eTD
            \bTD 18,5\% \eTD
                \bTD +7,5\% \eTD
            \bTD 89,3\% \eTD
                \bTD 19,3 k\$ \eTD
        \eTR
        \bTR
            \bTD Sardine Maison Frange \eTD 
            \bTD 13 923 \eTD        
            \bTD 47,0\% \eTD
                \bTD +0,3\% \eTD
            \bTD 23 318 k\$ \eTD
            \bTD 8,6\% \eTD
                \bTD -5,8\% \eTD
            \bTD 97,9\% \eTD
                \bTD 1,7 k\$ \eTD
        \eTR
        \bTR
            \bTD Sardine Canapé Ami \eTD 
            \bTD 379 \eTD        
            \bTD 1,3\% \eTD
                \bTD +95,4\% \eTD
            \bTD 2 414 k\$ \eTD
            \bTD 0,9\% \eTD
                \bTD +75,5\% \eTD
            \bTD 98,8\% \eTD
                \bTD 6,4 k\$ \eTD
        \eTR
        \bTR
            \bTD Arbre Souple Maison \eTD 
            \bTD 1 321 \eTD        
            \bTD 4,5\% \eTD
                \bTD -12,1\% \eTD
            \bTD 2 198 k\$ \eTD
            \bTD 0,8\% \eTD
                \bTD -11,0\% \eTD
            \bTD 99,6\% \eTD
                \bTD 1,7 k\$ \eTD
        \eTR
        \bTR
            \bTD Filet Profond \eTD 
            \bTD 871 \eTD        
            \bTD 2,9\% \eTD
                \bTD -9,6\% \eTD
            \bTD 553 k\$ \eTD
            \bTD 0,2\% \eTD
                \bTD -15,2\% \eTD
            \bTD 99,8\% \eTD
                \bTD 0,6 k\$ \eTD
        \eTR
        \bTR
            \bTD Arbre Souple Voisin \eTD 
            \bTD 298 \eTD        
            \bTD 1,0\% \eTD
                \bTD -10,2\% \eTD
            \bTD 392 k\$ \eTD
            \bTD 0,1\% \eTD
                \bTD +6,0\% \eTD
            \bTD 99,9\% \eTD
                \bTD 1,3 k\$ \eTD
        \eTR
        \bTR
            \bTD Sardine Ami Frange \eTD 
            \bTD 637 \eTD        
            \bTD 2,2\% \eTD
                \bTD +29,2\% \eTD
            \bTD 184 k\$ \eTD
            \bTD 0,1\% \eTD
                \bTD +43,9\% \eTD
            \bTD 100,0\% \eTD
                \bTD 0,3 k\$ \eTD
        \eTR
        \bTR
            \bTD Bloc Profond \eTD 
            \bTD 2 \eTD        
            \bTD 0,0\% \eTD
                \bTD -80,0\% \eTD
            \bTD 1 k\$ \eTD
            \bTD 0,0\% \eTD
                \bTD -61,1\% \eTD
            \bTD 100,0\% \eTD
                \bTD 0,5 k\$ \eTD
        \eTR
    \bTR[style=\bf,topframe=on]
        \bTD Total \eTD
        \bTD 29 616 \eTD
        \bTD NA \eTD
        \bTD +7,0\% \eTD
        \bTD 272 241 k\$ \eTD 
        \bTD 100,0\% \eTD
        \bTD +0,7\% \eTD
        \bTD 100,0\% \eTD        
        \bTD NA \eTD 
    \eTR
\eTABLE

\stoptext
