GeneralTable horizonal line but not \hline

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Eenzc
Posts: 48
Joined: Thu Jun 26, 2008 2:38 pm

Table horizonal line but not \hline

Post by Eenzc »

Hi I have probably quite a simple question.

I want a horzontal line that spans the last three columns in my table. (The data will be added to the five columns below this header)

Code: Select all

\begin{table} [h]
\begin{center}
\begin{tabular}{|C|r@{}l|r@{}l|r@{}l|r@{}l|}
\hline
Electrode & \multicolumn{2}{C|}{Radius} & \multicolumn{6}{c|}{DOPC $1^{st}$ capacitance peak current } \\
					& & & \multicolumn{2}{C|}{\SI{40}{V.s^{-1}}} & \multicolumn{2}{C|}{\SI{100}{V.s^{-1}}} & \multicolumn{2}{C|}{\SI{200}{V.s^{-1}}} \\
\hline
\end{tabular}
\caption{.}
\label{Table:E1}
\end{center}
\end{table}

The reason for all the "r@{}l" are so I can evenly divide the columns for numbers and units directly above each other.

Also the "C" column has been defined as:

Code: Select all

\newcolumntype{C}{>{\centering\arraybackslash}p{2cm}}
Thanks.

Recommended reading 2024:

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

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

User avatar
Stefan Kottwitz
Site Admin
Posts: 10323
Joined: Mon Mar 10, 2008 9:44 pm

Table horizonal line but not \hline

Post by Stefan Kottwitz »

Hi,

use \cline.

Stefan
LaTeX.org admin
Eenzc
Posts: 48
Joined: Thu Jun 26, 2008 2:38 pm

Table horizonal line but not \hline

Post by Eenzc »

Thanks very much again Stefan,

A new issue has occured

Image

The ^{-1} is a bit too high, how can I increase the table space so that it is not touching the \cline ?

Thanks again.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10323
Joined: Mon Mar 10, 2008 9:44 pm

Table horizonal line but not \hline

Post by Stefan Kottwitz »

You could change the length \extrarowheight, for example:

Code: Select all

\setlength{\extrarowheight}{0.6ex}
Stefan
LaTeX.org admin
Ted
Posts: 94
Joined: Sat Jun 23, 2007 4:11 pm

Table horizonal line but not \hline

Post by Ted »

Stefan_K wrote:use \cline
The booktabs package is a nice alternative too.
Its package documentation gives information about \toprule, \midrule, \bottomrule, and \cmidrule, which is similar to \cline but also allows you to shorten the lines at their edges to put some small separation between midrules.

Historically, there have been conventions for making tables for publications that were put in place due to technological constraints, but now people still cling to them because they've grown up being used to those types of tables. booktabs makes it easier to make such tables in LaTeX. In particular, many people have (nearly religious) issues with vertical rules in tables, and so you need to provide your column separation in some other way. booktabs lets you make nice looking tables without vertical rues (or with vertical rules if you really wish).
-- Ted [home/blog]
Eenzc
Posts: 48
Joined: Thu Jun 26, 2008 2:38 pm

Table horizonal line but not \hline

Post by Eenzc »

Stefan_K wrote:You could change the length \extrarowheight, for example:

Code: Select all

\setlength{\extrarowheight}{0.6ex}
Stefan
I don't understand where to apply this, putting it below \cline{4-9} does nothing.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10323
Joined: Mon Mar 10, 2008 9:44 pm

Re: Table horizonal line but not \hline

Post by Stefan Kottwitz »

You could put it before the tabular environment. Or if you just want to change the height of a single cell/line you could insert a \rule with a certain heigth but 0 width, invisible, into the cell.

Stefan
LaTeX.org admin
piticu
Posts: 3
Joined: Sat Aug 02, 2008 1:30 am

Table horizonal line but not \hline

Post by piticu »

Ted wrote:
Stefan_K wrote:use \cline
The booktabs package is a nice alternative too.
Strongly suggest the booktab package too.
Eenzc wrote:I don't understand where to apply this, putting it below \cline{4-9} does nothing.
The preamble of your document will be a nice spot for that command.
Post Reply