# Question about @{} used in array environment

I saw people use @{} in the array's environment at Align a linear program. I can understand that l means flush the array cell to left, but cannot understand what the purpose of @{} or find it in google. :-(

Could anyone help provide a link or some advice of where I can find the meaning of @{}?

Below is the array where they use the @{}.

\documentclass[a4paper]{article}
\usepackage[paper size={10cm,5cm}]{geometry}
\pagestyle{empty}
\usepackage{amsmath,amssymb}
\begin{document}
\begin{equation*}
\begin{array}{ll@{}ll}
\text{minimize}  & \displaystyle\sum\limits_{j=1}^{m} w_{j}&x_{j} &\\
\text{subject to}& \displaystyle\sum\limits_{j:e_{i} \in S_{j}}   &x_{j} \geq 1,  &i=1 ,..., n\\
&                                                &x_{j} \in \{0,1\}, &j=1 ,..., m
\end{array}
\end{equation*}
\end{document}

• It removes the default space between the two columns. – egreg Oct 16 '14 at 14:43
• Or in other words, replaces the space with nothing. You could use @{hello} as well. – Johannes_B Oct 16 '14 at 14:45
• For a example see tex.stackexchange.com/questions/195899/… (Admitted, it's an answer by me ;-)) – user31729 Oct 16 '14 at 14:47
• It's easier to see what it does if you use @{hello} – David Carlisle Oct 16 '14 at 15:00

• @{command} defines the space before and after one column
• !{command} defines what should be printed as vertical line

\documentclass[border=14pt]{standalone}
\usepackage{array}
\begin{document}
\begin{tabular}{@{dimen} c !{rule} c !{\vrule width 5pt}}\hline
foo & bar \\\hline
\end{tabular}
\end{document}


Instead of a space command in writes dimen directly before the entry foo. Instead of a vertical line it writes rule with space before and after. The right vertical line is set with a width of 5pt. However, something like @{} for no space before/after a column or @{\kern2em} for a space of 2em makes more sense :-)

@egreg has already addressed your main question in a comment: @{} suppresses the intercolumn whitespace anywhere it gets inserted, not only to the left of the first column and to the right of the final column.

I find that writing this particular group of equations using an array environment inside an equation* environment to be quite cumbersome. A more natural way, I believe, would be to use a gather* or an align* environment. In the code below, I suggest using an aligned environment, for the second and third line, nested inside a gather* environment; I don't think it serves much of a purpose to align all three rows.

Some fine points of mathematical typesetting:

• Don't type ...; type \dots instead.
• Don't type : inside a math expression; use \colon.
• To avoid getting a lot of whitespace to the left and right of the second summation symbol, encase its subscript term in a \mathclap macro.

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{gather*}
\text{minimize }\sum_{j=1}^{m} w_{j}x_{j}\\
\begin{aligned}
\text{subject to }
\sum_{\mathclap{j\colon e_{i} \in S_{j}}}x_{j} \ge 1, &\quad i=1,\dots,n\\
x_j \in \{0{,}1\}, & \quad j=1,\dots,m
\end{aligned}
\end{gather*}
\end{document}


It is called @-expression, at least in this source, and is part of the standard table column specifier. It replaces the column separator with the content between { and }, in this case with nothing, which is useful to make very condensed tables, arrays, etc.

In your example it is used to reduce the distance between the summation sign and its operands.