# No vertical divider lines in first row of table

\begin{tabular}{c|m{3em}|m{3em}|m{3em}|}
& 1 & 2 & 3 \\
\cline{2-4}
$3$ & $7500^2$ & $25000^2$ & $0$ \\
\cline{2-4}
$2$ & $5000^1$ & $0$ & \cellcolor{gray!5}\\
\cline{2-4}
$1$ & $0$  &\cellcolor{gray!5} &\cellcolor{gray!5}\\
\cline{2-4}
\end{tabular}


How can I remove the vertical bars in the first row? Thanks.

In the definition

\begin{tabular}{c|m{3em}|m{3em}|m{3em}|}


each column specification effectively consists of both a basic type (c or m) and a vertical bar along the right-hand edge.

To avoid getting a vertical bar at the right-hand edge, it's necessary to use a different column specification locally. In the following example, I use \multicolumn{1}{l}{...} -- actually, abbreviated to \mc{...} -- to provide such an alternate column specification in each of the four cells of the first row.

\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{array}
\setlength\extrarowheight{2pt}            % for a less-cramped "look"
\newcommand\mc[1]{\multicolumn{1}{l}{#1}} % Note: no vertical bars
\begin{document}
\begin{tabular}{c|p{3em}|p{3em}|p{3em}|}
\mc{} & \mc{$1$} & \mc{$2$} & \mc{$3$} \\
\cline{2-4}
$3$   & $7500^2$ & $25000^2$ & $0$ \\
\cline{2-4}
$2$   & $5000^1$ & $0$       & \cellcolor{gray!10}\\
\cline{2-4}
$1$   & $0$ &\cellcolor{gray!10} &\cellcolor{gray!10}\\
\cline{2-4}
\end{tabular}
\end{document}

• Is there other alternative? – latra Apr 17 '18 at 21:25
• @latra - I'm not sure I understand the gist of your question. Are you maybe expressing a view that there should be a simpler solution "out there"? – Mico Apr 17 '18 at 21:28
• I think using \multicolumn{1}{l} is a trick. It also depends upon the package of multicolumn. There should have some function of LaTeX that we can directly work on this issue. – latra Apr 18 '18 at 23:07
• @latra - For sure, \multicolumn is a macro that's provided by the LaTeX "kernel" -- there's no need to load a package to access this macro. Moreover, \multicolumn{1}{...}{...}really is the standard way to provide a local override of the overall settings of a given column. Finally, I'm not in charge of deciding what ought to be in the LaTeX kernel. I thus can't provide a meaningful view on your opinion as to what needs to be in the LaTeX kernel. – Mico Apr 19 '18 at 14:15