GeneralHow to control the width of the horizontal line in Table

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Zhang
Posts: 2
Joined: Mon Apr 21, 2008 11:01 pm

How to control the width of the horizontal line in Table

Post by Zhang »

Hello all. I really need some help. Is there a way to make the horizontal line thicker? For example:

\begin{table*}
\begin{tabular}{c}
\hspace{16cm} \\
\hline
\vspace{0.25mm} \\
\textbf{\Large TEXT}
\vspace{0.25mm}\\
\hline
\end{tabular}
\end{table*}

In \hline, how to control its width?

In addition, the above code turns out that the upper horizontal line has different distance to the "TEXT" compared with the lower horizontal line. How to make the "TEXT" even between the upper and lower lines. Please help me.

Thanks a lot.

Recommended reading 2024:

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

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

Stefan Kottwitz
Site Admin
Posts: 10348
Joined: Mon Mar 10, 2008 9:44 pm

How to control the width of the horizontal line in Table

Post by Stefan Kottwitz »

Hi Zhang,

welcome to the LaTeX Community board! The booktabs package may be useful for you. Here is an example:

Code: Select all

\documentclass[a4paper,10pt]{article}
\usepackage{booktabs}
\begin{document}
\begin{table*}
\centering
\begin{tabular}{c}
\toprule
\textbf{\Large TEXT\strut} \\
\midrule
more text \\
\bottomrule
\end{tabular}
\end{table*}
\end{document}
Stefan
Zhang
Posts: 2
Joined: Mon Apr 21, 2008 11:01 pm

Re: How to control the width of the horizontal line in Table

Post by Zhang »

Stefan,

Thanks a lot for your suggestion.

It works perfectly for my case after the \toprule and \bottomrule are put in. So the outcome is that the "TEXT" is even distributed between the fully extended thicker horizontal upper and lower lines. For example,
\begin{table*}
\begin{tabular}{c}
\hspace{16cm} \\
%\hline
\vspace{0.25mm} \\
\toprule
\textbf{\Large TEXT\strut}
\vspace{0.25mm}\\
\bottomrule
%\hline
\end{tabular}
\end{table*}

Thanks again. Stefan. :)
kamrul_islam
Posts: 2
Joined: Mon Jun 27, 2011 4:50 am

How to control the width of the horizontal line in Table

Post by kamrul_islam »

toprule and bottomrule are of fixed structures, i.e., it will add some space avobe & below of each line. To avoid that you can declare your own top and bottom rule like :

\newcommand{\mytoprule}{\specialrule{0.1em}{0em}{0em}}
\newcommand{\mybottomrule}{\specialrule{0.1em}{0em}{0em}}

Just use mytoprule and mybottomrule in stead of toprule and bottomrule respectively. Generic form of specialrule is \specialrule{<wd>}{<abovespace>}{<belowspace>}.

There is a better package - ctable. Check that out!
kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

How to control the width of the horizontal line in Table

Post by kaiserkarl13 »

If all you want is a thicker line, you can redefine the array rule thickness:

Code: Select all

\setlength{\arrayrulewidth}{1pt}
However, that will also change the thicknesses of any vertical rules as well.
Post Reply