29

I want to draw a double cline in a table where the first column is multirow With double \hline I can draw a full double horizontal line but double \cline{i-j} seems to have the same effect with single \cline. Is there any other special command to do that?

Thank you

5 Answers 5

12

AFAIK the \cline does not add vertical space by itself, therefore the two are just printed over each other. The booktabs package, which I can recommend greatly in general for all tables, defines therefore the \morecmidrules macro:

% \cline is now \cmidrule
\cmidrule{1-2}\morecmidrules\cmidrule{1-2}

However, the booktabs manual says that double lines are evil and should not be used at all....

5
  • Thanks, good hint but now I have a different problem. The vertical lines-borders of the table are broken. Please see the image: img189.imageshack.us/img189/8383/brokentable.png
    – Vasilis
    Feb 3, 2011 at 0:17
  • 1
    @Vasilis: Mmm, I can't tell how to fix that. All what I know is that vertical lines are also considered as evil by the booktabs manual ;-) My advice is to avoid them and most horizontal lines. Only do a \toprule on top and a \bottomrule at the bottom, plus a single \cmidrule where you wanted the double rule. This design is new to most people which know tables only from M$ Word, but believe me, it looks better! Feb 3, 2011 at 0:33
  • 2
    @Vasilis. As Martin says, the table you've linked to should not have vertical lines.
    – Joseph Wright
    Feb 3, 2011 at 6:47
  • Indeed it looks better without vertical lines.
    – Vasilis
    Feb 3, 2011 at 14:35
  • There is however a tradition that double horizontal lines mean summation. So I guess yes they are evil but sometimes tradition is tradition... :)
    – jonalv
    Aug 4, 2017 at 8:04
24

use package hhline, available with any TeX distribution:

\documentclass[a4paper]{article}
\usepackage{hhline}
\begin{document}

\begin{tabular}{ccc}\hhline{=~~}
 foo & bar & baz  \\\hhline{~=~}
 foo & bar & baz  \\\hhline{~~=} 
\end{tabular}

\end{document}

enter image description here

2
  • Simple, and works great! But is there a way to let the vertical lines reach the additional hline? See this example: dl.dropboxusercontent.com/u/78851488/Bild1.png I want the horizontal double line at the bottom to look like the vertical double line in the top part of the picture. May 24, 2016 at 12:07
  • read the manual of the package hhline. There is an example
    – user2478
    May 24, 2016 at 17:58
8

Put

\noalign{\vskip\doublerulesep
         \vskip-\arrayrulewidth}

between \clines.

4
  • That almost works perfectly, except that I have a vertical line on the very left which I would want to stay contiguous (because that is a merged cell).
    – Albert
    Aug 17, 2020 at 15:39
  • Is not it the same as for double \hline? (If so, you are barking at a wrong tree…) Nov 14, 2020 at 3:18
  • Maybe it was not clear what I meant. I added an own answer which shows this, and my solution.
    – Albert
    Jan 4, 2021 at 19:21
  • 1
    This makes the gap very small. The same spacing as for double \hline is achieved by: \noalign{\vskip\arrayrulewidth \vskip\doublerulesep}. The \arrayrulewidth is the width of the line and the \doublerulesep is the size of the gap between the two lines. Jan 25, 2021 at 16:28
1

The solution by Ilya Zakharevich:

... \\ \cline{2-4}
\noalign{\vskip\doublerulesep
         \vskip-\arrayrulewidth} \cline{2-4}
...

results in this for me: noalign ilya var1

Note that I have a vertical line on the very left which I would want to stay contiguous, so this is not so nice.

So my solution:

... \\ \cline{2-4}
\noalign{\vskip-2\tabcolsep \vskip-3\arrayrulewidth \vskip\doublerulesep}
\\ \cline{2-4}
...

This adds another row (\\) and then tries to reduce the space of the row (I probably messed up the calculation...).

var2

I came up with another variant:

... \\ \cline{2-4}
\multicolumn{4}{|c}{\phantom{x}}
\vspace{-2\tabcolsep}\vspace{-3\arrayrulewidth}\vspace{\doublerulesep}
\\ \cline{2-4}
...

Which results in: var3

0

In the environment {NiceTabular} of nicematrix, you have a command \Hline which draws horizontal rules excepted in the blocks (created by the command \Block). With \Hline\Hline, you draw a double horizontal rule which potentially do not extend on the whole array.

With Albert's example:

\documentclass{article}

\usepackage{nicematrix}

\begin{document}

\begin{NiceTabular}{|c|c|c|c|}
\hline
$T_{\omega}$ ([sec]) & $T_s$ ([sec]) & Distribution & WER[\%] \\
\hline\hline
\Block{6-1}{}
40 (0.4)  & \Block{4-1}{} 5 (0.05) & Uniform & 13.9 \\
\Hline
          &          & Triangle & 13.8 \\
\Hline
          &          & Hamming & 13.8 \\
\Hline
          &          & Gauss $\sigma = 0.4$ & 13.8 \\
\Hline\Hline
          & \Block{2-1}{}4 (0.04) & Uniform & 13.7 \\
\Hline
          &          & Triangle & 13.7 \\
\hline\hline
\Block{3-1}{}
100 (1.0) & \Block{3-1}{}5 (0.05) & Uniform & 13.6 \\
\Hline
          &          & Hamming & 1.7 \\
\Hline
          &          & Gauss $\sigma = 0.4$ & 13.7 \\
\Hline
\end{NiceTabular}

\end{document}

You need several compilations (because nicematrix uses PGF/Tikz nodes under the hood).

Output of the above code

You must log in to answer this question.

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