3

I'm using two \hline for horizontal line and \begin{tabular}{c | c c c c c} option for vertical line. This is some part of my table:

enter image description here

I want vertical line on top of double horizontal lines. How can I do that?

1
  • What you want is not clear to me. Could you post a minimal (non)working example?
    – Bernard
    Apr 6, 2015 at 13:34

3 Answers 3

1

I know there is a package that can do this (which I cannot recall), but here it is hardwired as \dhline, which must be defined based on the point size of the document (since I don't know the macros that define the rule thicknesses and vertical skips inside tabular)

\documentclass[11pt]{article}
%\def\dhline{\\[-10.2pt]\hline\\[-14.2pt]\hline\\[-10.pt]}% for 10pt
\def\dhline{\\[-11.6pt]\hline\\[-16.0pt]\hline\\[-11.6pt]}% for 11pt
%\def\dhline{\\[-12.5pt]\hline\\[-16.8pt]\hline\\[-12.6pt]}% for 12pt
\begin{document}
\tabcolsep=2pt
hline:
\begin{tabular}{c|c}
\hline
&\\
\hline
\hline
&\\
\hline
\hline
&\\
\hline
\end{tabular}
dhline:
\begin{tabular}{c|c}
\hline
&\\
\dhline
&\\
\dhline
&\\
\hline
\end{tabular}
\end{document}

enter image description here

And here is an example showing actual content in such tabulars:

enter image description here

1

Use hhline

\documentclass[margin=2mm]{standalone}
\usepackage{hhline}
\begin{document}
  \begin{tabular}{c | c }
   & \\ \hline
   & \\ \hhline{=|=}
   & \\ \hhline{=|=}
   & \\ \hhline{=|=}
   & \\ \hhline{=|=}
   & \\ \hline
  \end{tabular}
\end{document}

enter image description here

Response to the comment.

It is only the viewer artefact. Zoom in and things will be clear. There are no segments of line.

enter image description here

2
  • Thank you for answer. There is a problem in this structure. When we use something like this : \hhline{=|=====}, There are segments of lines. You can see this in above picture. Apr 6, 2015 at 15:28
  • @user2991243 There are no segments of lines. Zoom in and you will see. It is only a pdf viewer issue. See the edit.
    – user11232
    Apr 6, 2015 at 23:12
1

With {NiceTabular} of nicematrix, the vertical rules cross the \hline\hline.

\documentclass[margin=2mm]{standalone}
\usepackage{nicematrix}

\begin{document}
\begin{NiceTabular}{c|c}
 & \\ \hline
 & \\ \hline\hline
 & \\ \hline\hline
 & \\ \hline\hline
 & \\ \hline\hline
 & \\ \hline
\end{NiceTabular}
\end{document}

Output of the above code

You must log in to answer this question.

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