# @{} removing the vertical line for the header row of table

I'd like to remove the horizontal spacing between the text and table lines. I am using @{}, but it removes the vertical line of the table for the first row. Does anyone know why?

\documentclass[11pt,onecolumn]{article}
\usepackage{array}
\usepackage{color, colortbl}
\definecolor{mColor1}{rgb}{0.9,0.9,0.9}
\begin{document}
\newcolumntype{N}{@{}>{\columncolor{red}[0pt][0pt]}m{0pt}@{}}
\begin{table}[h!]
\scriptsize
\caption{Summary}
\centering
\begin{tabular}{| c | @{}c | c | N }
\hline
\rowcolor{mColor1}
\textbf{Author(s)} & \textbf{App.} & \textbf{Algorithm} & \\ [0.5cm]
\hline
\textbf{Author(s)} & \textbf{App.} & \textbf{Algorithm} & \\ [0.5cm]
\hline
\end{tabular}
\label{tabSummary}
\end{table}
\end{document}


I believe \rowcolor{mColor1} is causing the issue, but I don't know how to fix it! Any help is appreciated. Thanks

• It removed even \documentclass ... \begin{document}...\end{document} apparently ;-)
– user31729
Jan 25 '15 at 17:21
• \rowcolor has some overhang
– user31729
Jan 25 '15 at 17:25

It's easier to set \tabcolsep to zero then add space where you need it, this has some space in the outer columns, and tight space in the middle

\documentclass[11pt,onecolumn]{article}
\usepackage{array}
\usepackage{color, colortbl}
\definecolor{mColor1}{rgb}{0.9,0.9,0.9}
\begin{document}
\newcolumntype{N}{@{}>{\columncolor{red}[0pt][0pt]}m{0pt}@{}}
\begin{table}[h!]
\setlength\tabcolsep{0pt}
\scriptsize
\caption{Summary}
\centering
\begin{tabular}{| c | c | c | N }
\hline
\rowcolor{mColor1}
\textbf{\ Author(s)\ } & \textbf{App.} & \textbf{\ Algorithm\ } & \\ [0.5cm]
\hline
\textbf{Author(s)} & \textbf{App.} & \textbf{Algorithm} & \\ [0.5cm]
\hline
\end{tabular}
\label{tabSummary}
\end{table}
\end{document}

• Thank you for your answer. If a column is left aligned, then I believe, I must set the spacing for all of the rows manually, Am I right? If you change \begin{tabular}{| c | c | c | N } to \begin{tabular}{| l | c | c | N } then the second row is not alight with the first row of the first column. Jan 25 '15 at 18:44
• @NESHOM you could use >{\hspace{1em}l} probably. Jan 25 '15 at 18:51

I think it's easier to define a new column type C

\newcolumntype{C}{>{\hspace{-\tabcolsep}}c}


and use it instead of c to obtain what you want, so you don't have to manually specify the spacing.

MWE

\documentclass[11pt,onecolumn]{article}
\usepackage{array}
\usepackage{color, colortbl}
\definecolor{mColor1}{rgb}{0.9,0.9,0.9}
\begin{document}
\newcolumntype{N}{@{}>{\columncolor{red}[0pt][0pt]}m{0pt}@{}}
\newcolumntype{C}{>{\hspace{-\tabcolsep}}c}
\begin{table}[h!]
\scriptsize
\caption{Summary}
\centering
\begin{tabular}{| c | C | c | N }
\hline
\rowcolor{mColor1}
\textbf{Author(s)} & \textbf{App.} & \textbf{Algorithm} & \\ [0.5cm]
\hline
\textbf{Author(s)} & \textbf{App.} & \textbf{Algorithm} & \\ [0.5cm]
\hline
\end{tabular}
\label{tabSummary}
\end{table}
\end{document}


Output

If you want to remove the spacing on the other side, as well, define it as

\newcolumntype{C}{>{\hspace{-\tabcolsep}}c@{}}


and you will get

• @NESHOM You're welcome. Isn't it simpler this way? Jan 26 '15 at 5:57
• sorry for the delay. Yes, generally it is easier, however, since I have already defined specific column types it makes it more complicated in my case to include this as well. thanks again. Jan 27 '15 at 16:52