TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was wondering if it is possible to use the pipe character, |, instead of the & to separate cells.

Something like this:

c1 | c2 | c3 \\
c4 | c5 | c6 \\

instead of this:

c1 & c2 & c3 \\
c4 & c5 & c6 \\
share|improve this question
See tex.stackexchange.com/a/19761/963 and you get free sorting as well. – Yiannis Lazarides Mar 17 '13 at 11:51
up vote 20 down vote accepted

If you are not using | for anything else

share|improve this answer

Instead of (inherently fragile) catcode trickery, as suggested by David, you could also define a simple helper macro with delimited arguments:


  \def\row#1|#2|#3\\{#1 & #2 & #3 \tabularnewline}
    \row c1 | c2 | c3 \\
    \row c4 | c5 | c6 \\

Even though the extra \row at the beginning of each row is a bit more to type, it also brings you some extra flexibility: You now can easily rearrange, skip, or format columns, by just changing the definition of \row: For instance, \def\row#1|#2|#3\\{\textbf{#1} & & #3 \tabularnewline} would typset the first column in boldface and (maybe temporarily) skip the second column.

share|improve this answer
Nice, but redefining the catcode of | is just as fragile as using & (assuming one does not use | anywhere else, which is quite probable. In fact, even \verb&verbatim text& works under the normal LaTeX catcode regime, by the way, so David's answer does not conflict with the usual \verb|blah|.) – mbork Mar 16 '13 at 22:40
Of course, your \row will break with a number of columns different from three. – egreg Mar 16 '13 at 23:23
@egreg: Sure, the idea is to define it for each table as needed. – Daniel Mar 17 '13 at 7:34
Having to redefine the command poses a bit of a burden on the user and may introduce errors. Why not make the \row a bit more intelligent so it'll work for any number of columns? – Marc van Dongen Mar 17 '13 at 10:50
@MarcvanDongen: In my actual applications, \row is also used to define the formatting of table columns, which often is specific to a table anyway. In many cases I find this less of a burden and more understandable than dealing with \newcolumntype and other trickery. – Daniel Mar 17 '13 at 11:24

Here's a ConTeXt solution using the database module. The idea is to define a separated list with a vertical bar as separator and table macros as delimiters. Example:

\usemodule [database]

   before=\bTABLE, after=\eTABLE,
   first=\bTR, last=\eTR,
   left=\bTD, right=\eTD]

    alpha | beta   | gamma
    first | second | third


As separators the strings comma (default), tab, or space can be used or just any character like I did with the vertical bar here.

The same technique can be used to typeset CSV data as well since the macros, separators and the quoting can be configured.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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