Graphics, Figures & TablesThe vertical line extends too much

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
pemfir
Posts: 23
Joined: Sun Aug 12, 2012 11:30 pm

The vertical line extends too much

Post by pemfir »

I am trying to create a table and the first verticle line is too long and extends outside of the range of the table a bit. How can i remove it ?

Code: Select all

\centering
\footnotesize
\caption{Sample of simulation runs and measured energy consumption.}
\begin{tabular}
{c|ccccc|c} \hline\hline
Run & & & Factors (predictors) & & & Response \\ \hline
 & A & B & C & D & E & Energy (Watts)\\ \hline
1 &(0) &	(0) &	(0) &	(0) & (0) & 120530\\ 
2 & (-1) &	(-1) &	(0) & (0) & (0) & 117570 \\ 
3 & (1) & (-1) & (0) & (0) & (0) & 121010 \\
\vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots \\
\hline \\
\end{tabular}
\label{tb:ex1}
\end{table}[/latex]
Attachments
The first vertical line is too long
The first vertical line is too long
test try.PNG (6.77 KiB) Viewed 9266 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

hugovdberg
Posts: 133
Joined: Sat Feb 25, 2012 6:12 pm

The vertical line extends too much

Post by hugovdberg »

Next time please post a full Infominimal working example, your current code snippet will not compile on its own, and even contains an incomplete environment (\end{table}, but no \begin{table}).

On topic, it's the \\ after your final \hline that causes latex to think there is a single cell on the last row, since there are no & marks the other vertical line is not extended as well.

Code: Select all

\documentclass{article}

\begin{document}
\begin{table}
\centering
\footnotesize
\caption{Sample of simulation runs and measured energy consumption.}
\begin{tabular}
{c|ccccc|c} \hline\hline
Run & & & Factors (predictors) & & & Response \\ \hline
 & A & B & C & D & E & Energy (Watts)\\ \hline
1 &(0) &        (0) &   (0) &   (0) & (0) & 120530\\ 
2 & (-1) &      (-1) &  (0) & (0) & (0) & 117570 \\ 
3 & (1) & (-1) & (0) & (0) & (0) & 121010 \\
\vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots \\
\hline
\end{tabular}
\label{tb:ex1}
\end{table}
\end{document}
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit
Post Reply