[Tex/LaTex] Center ConTeXt table horizontally

contexthorizontal alignmenttables

Although my table is only so wide and inside a alignment[middle] environment, it doesn’t get centered and stays left aligned. (For ConTeXtians: right aligned :))

I tried a hack and add an empty paragraph column, but empty columns appearantly get ignored.

What can I do?

Best Answer

Depends on which table environment you are using. With tables and natural tables, \midaligned centers the table:

\starttext
\midaligned
  {\startTABLE
    \NC A \NC B \NC C \NC \NR
    \NC A \NC B \NC C \NC \NR
    \NC A \NC B \NC C \NC \NR
    \NC A \NC B \NC C \NC \NR
  \stopTABLE}

\stoptext

or

\starttext
\midaligned
  {\starttable[|l|l|l|]
     \NC A \NC B \NC C \NC \AR
     \NC A \NC B \NC C \NC \AR
     \NC A \NC B \NC C \NC \AR
   \stoptable}

\stoptext 

There is no environment version of \midaligned, but you can easily create your own if you want:

\def\startmidaligned
    {\midaligned\bgroup}

\def\stopmidaligned
    {\egroup}