9

How can I change concrete \hline width? Maybe does anything exist like \hline[2mm]?

PS: \setlength{\arrayrulewidth}{2mm} is inadequate in my situation because it changes all lines width in a table.

2
  • 3
    Use the booktabs package and its \toprule[2mm] or \midrule[2mm] or \bottomrule[2mm] commands instead of \hline, depending on the position of the \hline
    – user31729
    Mar 11, 2015 at 16:51
  • You can use \noalign{\hrule height 2mm}
    – Watson
    Jan 12, 2021 at 20:24

3 Answers 3

7

A small 'showcase' of the booktabs rule width facilities.

In addition, the booktabs package allows the change of the separation of rules with respect to the cells. For this, I refer to the manual.

\documentclass{article}

\usepackage{booktabs}

\usepackage{blindtext}


\begin{document}

\begin{center}
\begin{tabular}{p{12cm}}
\toprule[2mm]
\blindtext \tabularnewline
\midrule[5mm]
\blindtext \tabularnewline
\bottomrule[10mm]
\end{tabular}
\end{center}

\end{document}

enter image description here

2
  • The rule widths are slightly exaggerated ;-)
    – user31729
    Mar 11, 2015 at 17:06
  • 1
    Thank you very much. It works. I was surprised why standard LaTex without usage additional packages has no this simple feature? It's rhetorical question) Mar 11, 2015 at 17:13
6

without booktabs you can do

....\\
\noalign{
\global\dimen1\arrayrulewidth
\global\arrayrulewidth5pt
}\hline
\noalign{
\global\arrayrulewidth\dimen1 
}
4

If you want to use vertical rules (not recommended in general), booktabs is not compatible. But you can do that:

  • either with the boldline package, from the shipunov bundle which defines a \hlineB{num}, a \clineB{c1-c2}{num} commands, and a V{num} intercolumn specifier for vertical rules. Num results in a num × \arrayrulewidth.
  • or with the makecell package, which has a \Xhline{length}and a \Xcline{c1-c2}{length} commands.

Demo:

\documentclass{article}

\usepackage{array, makecell}
\usepackage{boldline}
\usepackage[x11names, table]{xcolor}
\usepackage{colortbl}

\begin{document}

\begin{center}
  \renewcommand\arraystretch{1.5}
  \begin{tabular}{V{2.5}c|c|cV{1.6}}
    \hlineB{3}
    Fiddle & Dee & Dee \\
    \hlineB{2}
  \end{tabular}
  \vskip 3ex
  \begin{tabular}{!{\vrule width2pt}c|c|c!{\vrule width2pt}}
    \Xhline{3pt}
    Fiddle & Dee & Dee \\
    \Xhline{2pt}
  \end{tabular}
\end{center}

\end{document} 

enter image description here

2
  • Is is possible to get \Xhline set a blue ou red line? I' didn't find any parameter to change the default color black.
    – pzorba75
    Jul 29, 2018 at 17:11
  • 1
    Unfortunately, as far as I know, it's not possible. I once tried to patch the code which defines these lines (and the more or less equivalent lines defined in makecell), but it didn't work. A solution is to use the \specialrule command from booktabs, for which you can remove the padding around rules, and which obeys thearrayrulecolor command.
    – Bernard
    Jul 29, 2018 at 17:23

You must log in to answer this question.

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