In ConTeXt, a tabular environment evidently does not behave a centered context. e.g.:
\startalignment[center]
\starttabular
\NC item one \NC item two \NC\NR
\NC item three \NC item four \NC\NR
\stoptabular
\stopalignment
will still result in the table being up against the left side of the page. One answer here advises using \midaligned {}
around tables to center them, but this technique seems to throw an error when applied to tabulars. What's the correct way to center a tabular block?
Best Answer
The low-level
\vbox
wrapping aside, there are two way to achieve centered tables relying on the user interface only: Floats and the frame parameter. Floats are more powerful but even with the abundance of placement options they might turn out to behave erratically. So the frame parameter that comes with tabulation-style tables might be the preferred choice in some situations.EDIT As Marco pointed out, the framed version will suppress page breaks. In case your tabulations get too long, you will have to resort to the first version (float, with the split option). Or you can just create a narrower environment that centers the table according to its width. In below listing this is done inside the macro
\centertabulation
which takes the table as an argument.Beware that this approach will misalign all horizontal rules in the table.