When Knuth came up with the catcode table, he dedicated the character & to catcode 4, the alignment tab. It happens rarely that people change these default catcodes and I guess most users have accustomed themselves to typesetting tabulated material by denoting the alignment points with &. Plain TeX users type

  A & B \cr
  C & D \cr

and LaTeX users enjoy the simplified `tabular interface

  A & B \\
  C & D \\

but in ConTeXt MkIV one has

  \NC A \NC B \NR
  \NC C \NC D \NR

I wonder why, because \NC..\NR are more tokens to type than &..\cr, especially with that redundant \NC in the beginning of the line and it makes, in my opinion, the source less readable. I also noticed that & has catcode 12 (other) in a ConTeXt document.

But, everything is there for a reason, so the question is: Why does ConTeXt choose to use \NC..\NR instead of &..\cr and why is the catcode of & 12?

  • 5
    seems like a good idea to me. it allows & to be used to produce & and it gives far more flexibility in controlling tabular layouts (just as latex uses \\ avoiding the primitive \cr to end rows. Jun 13, 2016 at 20:25
  • 4
    How many questions are asked every year about misplaced alignment tab character errors? Perhaps this blog post by Aditya is of interest: randomdeterminism.wordpress.com/2011/09/04/… Jun 13, 2016 at 20:27
  • 1
    In fact, to me, the more flexible solution would be that one, I, in fact, think of the opposite: why would Knuth decide to hardcode certain things rather than just give macros for everything, and then anyone could just use active characters.
    – Manuel
    Jun 13, 2016 at 20:30
  • 1
    Since I stumbled upon these two a few days ago: tug.org/TUGboat/Articles/tb28-3/tb90mahajan.pdf and tug.org/TUGboat/Articles/tb29-1/tb91mahajan.pdf – probably using a macro allows for more flexibility.
    – cgnieder
    Jun 13, 2016 at 20:34
  • 3
    @cfr -- yes, that's essentially what i'm saying. the system that knuth started with, sail ("stanford artificial intelligence lab", running on a decsystem10) was somewhat idiosyncratic. the keyboard wasn't quite what we're used to now (it had a third-level shift for symbols, and in fact what is now an & was more like an \otimes), and with rather severe limitations on memory knuth was trying to be as efficient as possible in that respect. even so, the input was head and shoulders above other existing alternatives. unless you used the earlier systems, you won't appreciate that. Jun 14, 2016 at 1:15

1 Answer 1


I don't know what was the original reason why Hans Hagen used \NC instead of &. In the original table macros, there was also \VL for vertical rule \HC for "hook" column, etc. So, perhaps it was introduced to have a consistent syntax.

But, I find it most useful because it allow for a very clean separation between content and style. And, I don't mind typing a few extra keys, because after a while it just becomes muscle memory: Shift \ n c <release Shift>. Let me illustrate what I mean by separation of content and style by a few examples:

  1. Spanning rows and column. How do you create the following table?

    enter image description here

    In LaTeX, you would create a multi-column and then a multi-row inside. Contrast that with the ConTeXt code:

        \NC[nx=2,ny=2] A big cell \NC A \NC B \NC \NR
                                  \NC C \NC D \NC \NR
        \NC E     \NC   F         \NC G \NC H \NC \NR

    Because \NC is a macro (and not a primitive), it is straight forward for it to take an optional argument.

  2. Separation of content and presentation. Suppose I want a table with rules before and after the first row, a rule after the last row, and the content of the first row in bold (this is a common table format).

    enter image description here

    In LaTeX, you'll need to manually add the \toprule and \midrule and add \textbf around each element of the first row. In ConTeXt, you can do the following:

    \startsetups standard
      \setupTABLE[row][first][topframe=on, rulethickness=2pt]
      \setupTABLE[row][2][topframe=on, rulethickness=1pt]
      \setupTABLE[row][last][bottomframe=on, rulethickness=1.5pt]
        \NC 1st header \NC 2nd header \NC 3rd header \NC \NR
        \NC value      \NC value      \NC value      \NC \NR
        \NC value      \NC value      \NC value      \NC \NR
        \NC value      \NC value      \NC value      \NC \NR
        \NC value      \NC value      \NC value      \NC \NR

    Now suppose, your boss says that he wants fancy tables like Word.

    enter image description here

    Well, you just need a new setups, and you have go it:

    \startsetups uglytable
      \setupTABLE[frame=off, framecolor=blue]
      \setupTABLE[row][first][style=bold, color=white, background=color, backgroundcolor=blue]

    Again, behind the scenes, this mechanism relies on the fact that \NC is a macro and not a primitive.

Sure, it is possible to do so without introducing any new macros: tikz tables does something similar and it keeps & as the column separator. But, IIRC, inside tikz matrix & is an active character which then maps to a macro; this brings all the usual trouble with active characters. In ConTeXt, one tends to avoid active characters as far as possible.

  • 3
    Certainly the LaTeX3 plan is that even if we keep & as the cell separator, this will not be the primitive mechanism (i.e. we'll set up to parse for & or something similar). In the future and not decided, of course!
    – Joseph Wright
    Jun 14, 2016 at 6:27
  • 1
    I hope my boss never demands Word-like tables ;) Your answer is a great primer to tables in ConTeXt! Thank you very much. Jun 14, 2016 at 11:33
  • Perhaps you could comment on the difference and when to use tabulate, TABLE/bTABLE, and xtables. Jun 14, 2016 at 11:36
  • @HenriMenke: A brief comparison is available on the wiki. Personally, I always use natual tables; the only thing that they lack is that the table can break across page boundaries only at the end of a cell, not in the middle of a cell. The main advantages of xtables (apart from slightly better speed, i guess)are automatic calculation of column widths (a la X column specifier in tabularx) and slightly easier method to modify the look and feel of cells (I usually resort to Lua in such cases)
    – Aditya
    Jun 14, 2016 at 18:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .