Sometimes, I need such a table whose column widths should be equal with each other. Here is an example:

Name    Email
John    john1989@gmail.com
Bill    bill1990@outlook.com
Tim     tim1995@hotmail.com

The Name Column should flushed right and the Email Column should be flushed left. Of course, each column has the same width.

I think this requirement can be achieved by the \starttable and \stoptable, but how to combine the l or r with the required width?


The \starttable syntax is deprecated and should thus be avoided for new documents. That's why I present a solution using natural tables, also called HTML tables. Since natural tables are very verbose they can be best combinded with the database module. That allows very easy and readable syntax, but is less flexible. It depends on your requirements if the database module makes sense in this case. The natural table setup is the same in both cases.

For more simple tasks the tabulate tables might be sufficient.

\usemodule [database]

  [separator=comma, %% not necessary, already the default
   before=\bTABLE, after=\eTABLE,
   first=\bTR, last=\eTR,
   left=\bTD, right=\eTD,

\startsetups [s:NaturalTable]
  \setupTABLE              [frame=off, distance=5mm]
  \setupTABLE [column] [1] [width=2cm, align=flushright]
  \setupTABLE [row]    [1] [style=bold]


  Name, Email
  John, john1989@gmail.com
  Bill, bill1990@outlook.com
  Tim , tim1995@hotmail.com

\starttabulate [|p(3cm)r|l|]
  \NC Name \NC Email                \AR
  \NC John \NC john1989@gmail.com   \AR
  \NC Bill \NC bill1990@outlook.com \AR
  \NC Tim  \NC tim1995@hotmail.com  \AR



  • by the way, how can I center the table created by \starttabulate and \stoptabulate? I have tried \startalignment[middle] and \stopalignment, but nothing happened. – Lucas Li Apr 16 '13 at 2:36
  • I use the plain TeX method \hbox to\hsize{\vbox{\starttabulate...\stoptabulate}}. This won't be broken across pages, is there another way by which the table can span pages? – Lucas Li Apr 16 '13 at 2:55
  • That's tricky with tabulate. The easiest (but ugly) way is to use something like \starttabulate[|p(.4\textwidth)|l|]. For a more automatic solution see Philipps \centertabulation macro. – Marco Apr 16 '13 at 6:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.