# extra line in table latex

I want to make a table in LaTeX and I wrote the following program:

\documentclass[]{article}
\usepackage{graphicx}
\usepackage{color}
\begin{document}

\begin {center}
\begin {tabular}{| l | l | l | l | l | l |}
\cline{2-6}
& \multicolumn{5}{ |c| }{$\eta_{\infty}$} \\  \cline{2-6}
&  i=1,f=6 & i=1,f=3 & i=3,f=5& i=4,f=2& i=6,f=3 \\ \hline
$k,l=0,0$  & \textcolor{blue}{0.1811} & \textcolor{blue}{0.1811}&       \textcolor{blue}{0.1811}& \textcolor{blue}{0.1811}& \textcolor{blue}{0.1811} \\ \hline
$k,l=1,2$  &0.3788 &0.3788 &0.2898 &0.2220 &0.2898 \\ \hline
$k,l=1,3$  &0.3788 &\textcolor{red}{0.9393} &0.2898 &0.2898 &0.2220  \\ \hline
$k,l=1,4$  &0.3788 &0.3788 &0.2898 &0.3788 &0.2898  \\ \hline
$k,l=1,5$  &0.3788 &0.3788 &0.2220 &0.2898 &0.2898 \\ \hline
$k,l=1,6$  &\textcolor{red}{0.9393} &0.3788 &0.2898 &0.2898 &0.3788 \\ \hline
$k,l=2,3$  &0.2898 &0.2220 &0.3788 &0.2220 &0.2220 \\ \hline
$k,l=2,4$  &0.2898 &0.2898 &0.2898 &\textcolor{red}{0.9393} &0.2898 \\ \hline
$k,l=2,5$  &0.2898 &0.2898 &0.2220 &0.2220 &0.2898 \\ \hline
$k,l=2,6$  &0.2220 &0.2898 &0.2898 &0.2220 &0.3788\\ \hline
$k,l=3,4$  &0.2898 &0.2220 &0.3788 &0.3788 &0.2220  \\ \hline
$k,l=3,5$  &0.2898 &0.2220 &\textcolor{red}{0.9393} &0.2898 &0.2220  \\ \hline
$k,l=3,6$  &0.2220 &0.2220 &0.3788 &0.2898 &\textcolor{red}{0.9393}  \\ \hline
$k,l=4,5$  &0.2898 &0.2898 &0.2220 &0.3788 &0.2898  \\ \hline
$k,l=4,6$  &0.2220 &0.2898 &0.2898 &0.3788 &0.3788 \\ \hline
$k,l=5,6$  &0.2220 &0.2898 &0.2220 &0.2898 &0.3788  \\ \hline

\end {tabular}\\
Table 2: System efficiency for different k,l and i,f.
\end {center}
\end{document}


Some of the cells have an extra vertical line in the first column, how can I omit it? Thank you for your soon answering!

• You have used the word "omit" in your question. So, put \omit before first & in the table. The beginning of the second line of the table is somewhat more complicated. Put the \omit\hfill\strut\vrule\kern-.2pt here. – wipet Dec 13 '14 at 22:00
• @wipet these are tex primitives and not guaranteed to be the correct width rule or space, or the right size strut. Why not recommend the latex constructs that do use the class specified table parameters? – David Carlisle Dec 13 '14 at 22:29
• @DavidCarlisle I know and I agree. I was inspired only by OP's word "omit" to show TeX primitives. Your argument is the reason why I didn't put my comment as a whole answer. – wipet Dec 14 '14 at 5:55
• The column headings would look nicer if you added a space after the commas: & i=1, f=6 & i=1, f=3 & and so on. – user10274 Dec 14 '14 at 14:01

\documentclass[]{article}
\usepackage{graphicx}
\usepackage{color}
\begin{document}

\begin {table}\centering
\begin {tabular}{| l | l | l | l | l | l |}
\cline{2-6}
\multicolumn{1}{c|}{}&\multicolumn{5}{c| }{$\eta_{\infty}$} \\  \cline{2-6}
\multicolumn{1}{c|}{}&  i=1,f=6 & i=1,f=3 & i=3,f=5& i=4,f=2& i=6,f=3 \\ \hline
$k,l=0,0$  & \textcolor{blue}{0.1811} & \textcolor{blue}{0.1811}&       \textcolor{blue}{0.1811}& \textcolor{blue}{0.1811}& \textcolor{blue}{0.1811} \\ \hline
$k,l=1,2$  &0.3788 &0.3788 &0.2898 &0.2220 &0.2898 \\ \hline
$k,l=1,3$  &0.3788 &\textcolor{red}{0.9393} &0.2898 &0.2898 &0.2220  \\ \hline
$k,l=1,4$  &0.3788 &0.3788 &0.2898 &0.3788 &0.2898  \\ \hline
$k,l=1,5$  &0.3788 &0.3788 &0.2220 &0.2898 &0.2898 \\ \hline
$k,l=1,6$  &\textcolor{red}{0.9393} &0.3788 &0.2898 &0.2898 &0.3788 \\ \hline
$k,l=2,3$  &0.2898 &0.2220 &0.3788 &0.2220 &0.2220 \\ \hline
$k,l=2,4$  &0.2898 &0.2898 &0.2898 &\textcolor{red}{0.9393} &0.2898 \\ \hline
$k,l=2,5$  &0.2898 &0.2898 &0.2220 &0.2220 &0.2898 \\ \hline
$k,l=2,6$  &0.2220 &0.2898 &0.2898 &0.2220 &0.3788\\ \hline
$k,l=3,4$  &0.2898 &0.2220 &0.3788 &0.3788 &0.2220  \\ \hline
$k,l=3,5$  &0.2898 &0.2220 &\textcolor{red}{0.9393} &0.2898 &0.2220  \\ \hline
$k,l=3,6$  &0.2220 &0.2220 &0.3788 &0.2898 &\textcolor{red}{0.9393}  \\ \hline
$k,l=4,5$  &0.2898 &0.2898 &0.2220 &0.3788 &0.2898  \\ \hline
$k,l=4,6$  &0.2220 &0.2898 &0.2898 &0.3788 &0.3788 \\ \hline
$k,l=5,6$  &0.2220 &0.2898 &0.2220 &0.2898 &0.3788  \\ \hline
\end {tabular}

\caption{System efficiency for different $k,l$ and $i,f$.}
\end {table}
\end{document}


In addition to David Carlisle's solution, I would rather suppress all vertical lines, and use the booktabs and cellspace package. This package ensures minimal vertical spacings at the top and bottom of cells in columns with a specifier prefixed with S. I also used a table environment, and a\caption command, so that you can have cross references to this table:

\documentclass[]{article}
\usepackage{graphicx}
\usepackage{array}
\usepackage{color}
\usepackage{cellspace, booktabs}
\setlength\cellspacetoplimit{4pt}
\setlength\cellspacebottomlimit{4pt}

\begin{document}

\begin{table}
\centering
\begin {tabular}{Sl*{5}{Sc}}
& \multicolumn{5}{Sc }{$\eta_{\infty}$} \\
\cmidrule[\heavyrulewidth]{2-6}
& i=1,f=6 & i=1,f=3 & i=3,f=5& i=4,f=2& i=6,f=3 \\
\midrule
$k,l=0,0$ & \textcolor{blue}{0.1811} & \textcolor{blue}{0.1811}& \textcolor{blue}{0.1811}& \textcolor{blue}{0.1811}& \textcolor{blue}{0.1811} \\
$k,l=1,2$ &0.3788 &0.3788 &0.2898 &0.2220 &0.2898 \\
$k,l=1,3$ &0.3788 &\textcolor{red}{0.9393} &0.2898 &0.2898 &0.2220 \\
$k,l=1,4$ &0.3788 &0.3788 &0.2898 &0.3788 &0.2898 \\
$k,l=1,5$ &0.3788 &0.3788 &0.2220 &0.2898 &0.2898 \\
$k,l=1,6$ &\textcolor{red}{0.9393} &0.3788 &0.2898 &0.2898 &0.3788 \\
$k,l=2,3$ &0.2898 &0.2220 &0.3788 &0.2220 &0.2220 \\
$k,l=2,4$ &0.2898 &0.2898 &0.2898 &\textcolor{red}{0.9393} &0.2898 \\
$k,l=2,5$ &0.2898 &0.2898 &0.2220 &0.2220 &0.2898 \\
$k,l=2,6$ &0.2220 &0.2898 &0.2898 &0.2220 &0.3788\\
$k,l=3,4$ &0.2898 &0.2220 &0.3788 &0.3788 &0.2220 \\
$k,l=3,5$ &0.2898 &0.2220 &\textcolor{red}{0.9393} &0.2898 &0.2220 \\
$k,l=3,6$ &0.2220 &0.2220 &0.3788 &0.2898 &\textcolor{red}{0.9393} \\
$k,l=4,5$ &0.2898 &0.2898 &0.2220 &0.3788 &0.2898 \\
$k,l=4,6$ &0.2220 &0.2898 &0.2898 &0.3788 &0.3788 \\
$k,l=5,6$ &0.2220 &0.2898 &0.2220 &0.2898 &0.3788 \\
\bottomrule
\end {tabular}
\caption{System efficiency for different $k,l$ and i,f.}\label{effi}
\end {table}


Here's a solution that re-organizes the material in the second header row to make it conform to the form of the first column. It also uses the S column type (of the siunitx package) to align the numeric data points in columns 2 thru 6 on the decimal marker. (I've changed some of the numbers, so that they have either two or three digits after the decimal marker, in order to highlight the effect of this setting.) I further suggest getting rid of all vertical rules and most horizontal rules; trust me, they won't be missed.

\documentclass{article}
\usepackage{color,siunitx,booktabs}
\begin{document}
\begin{table}
\begin{tabular*}{\textwidth}{ @{} @{\extracolsep{\fill}} l *{5}{S[table-format=1.4]} @{} }
\toprule
& \multicolumn{5}{ c@{} }{$\eta_{\infty}$} \\
\cmidrule(l){2-6}
& {$i,f=1,6$}& {$i,f=1,3$}& {$i,f=3,5$}& {$i,f=4,2$}& {$i,f=6,3$} \\
\midrule
$k,l=0,0$  & \color{blue}0.1811& \color{blue}0.1811&       \color{blue}0.1811& \color{blue}0.1811& \color{blue}0.1811 \\
$k,l=1,2$  &0.38 &0.38 &0.2898 &0.222 &0.2898 \\
$k,l=1,3$  &0.38 &\color{red}0.9393&0.2898 &0.2898 &0.222  \\
$k,l=1,4$  &0.38 &0.38 &0.2898 &0.38 &0.2898  \\
$k,l=1,5$  &0.38 &0.38 &0.222 &0.2898 &0.2898 \\
$k,l=1,6$  &\color{red}0.9393&0.38 &0.2898 &0.2898 &0.38 \\
$k,l=2,3$  &0.2898 &0.222 &0.38 &0.222 &0.222 \\
$k,l=2,4$  &0.2898 &0.2898 &0.2898 &\color{red}0.9393&0.2898 \\
$k,l=2,5$  &0.2898 &0.2898 &0.222 &0.222 &0.2898 \\
$k,l=2,6$  &0.222 &0.2898 &0.2898 &0.222 &0.38\\
$k,l=3,4$  &0.2898 &0.222 &0.38 &0.38 &0.222  \\
$k,l=3,5$  &0.2898 &0.222 &\color{red}0.9393&0.2898 &0.222  \\
$k,l=3,6$  &0.222 &0.222 &0.38 &0.2898 &\color{red}0.9393  \\
$k,l=4,5$  &0.2898 &0.2898 &0.222 &0.38 &0.2898  \\
$k,l=4,6$  &0.222 &0.2898 &0.2898 &0.38 &0.38 \\
$k,l=5,6$  &0.222 &0.2898 &0.222 &0.2898 &0.38  \\
\bottomrule
\end{tabular*}
\caption{System efficiency for various combinations of $k,l$ and $i,f$.}
\end{table}
\end{document}

• Just for my own knowledge; Is it a standard way to show two variables' values such way: i,f=1,6`? – Enthusiastic Engineer Dec 14 '14 at 8:00
• @EnthusiasticStudent - I honestly don't know what a "standard" way might be in the present context. I do think, though, that the terminology used in the header row should be consistent with that used in the first column. – Mico Dec 14 '14 at 8:28
• Yes, I also prefer them to be consistent. Thanks. – Enthusiastic Engineer Dec 14 '14 at 10:12