0

Why are the last 4 vertical lines in this table not connected to the top horizontal line?enter image description here

\documentclass[]{article}
\begin{document}
    \begin{tabular}{| c | c | c | c | c |}
        \hline \\
        15&2.5&10&7.5&5\\ 
        \hline 
    \end{tabular}
\end{document}
1
  • Do you really want an empty line as 1st line?
    – Sigur
    Commented Dec 30, 2017 at 12:48

2 Answers 2

4

If you want an empty line in the 1st line you have to change the columns with & before change the line:

\hline &&&&  \\

If you don't want, simply:

\hline 15 & 2.5 & 10 & 7.5 & 5 \\ 

MWE

\documentclass[]{article}
\begin{document}
    \begin{tabular}{| c | c | c | c | c |}
        \hline &&&&  \\
        15&2.5&10&7.5&5\\ 
        \hline 
    \end{tabular}

\medskip

    \begin{tabular}{| c | c | c | c | c |}
        \hline % &&&&  \\
        15&2.5&10&7.5&5\\ 
        \hline 
    \end{tabular}
\end{document}

enter image description here

1

Another version you are probably interested in.

enter image description here

Code:

\documentclass{article}
\usepackage{multirow}
\begin{document}
\begin{table}
\begin{tabular}{|l|l|l|l|l|}  \hline
\multirow{2}{*}{15} & \multirow{2}{*}{2.5} & \multirow{2}{*}{10} & \multirow{2}{*}{7.5} & \multirow{2}{*}{5} \\ 
&&&& \\\hline      
\end{tabular}
\end{table}
\end{document}
1
  • Nice vertical spacing!
    – Will A.
    Commented Dec 31, 2017 at 17:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .