1

I need a column type with 2 vertical lines but I want the horizontal line to not go trought it.

The result would be like this :

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage{lipsum}
\usepackage{array}

\begin{document}

\begin{tabular}{| p{5cm} | p{0.1cm} | p{5cm} |}
    \cline{1-1} \cline{3-3}
    \lipsum[1][1] & & \lipsum[1][1]  \\
    \cline{1-1} \cline{3-3}
    \lipsum[1][1] & & \lipsum[1][1]  \\
    \cline{1-1} \cline{3-3}
\end{tabular}

\end{document}

enter image description here

But that way, I can't make the space smaller.

So, I've created this columntype :

\newcolumntype{D}{!{\vrule \hspace{0.1cm} \vrule}}

And this is the result :

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage{lipsum}
\usepackage{array}

\newcolumntype{D}{!{\vrule \hspace{0.1cm} \vrule}}

\begin{document}

\begin{tabular}{| p{5cm} D p{5cm} |}
    \hline
    \lipsum[1][1] & \lipsum[1][1]  \\
    \hline
    \lipsum[1][1] & \lipsum[1][1]  \\
    \hline
\end{tabular}

\end{document}

enter image description here

I have no idea how to create this new column type and code the fact that I was the horizontal line to be interruped ... And the \cline command is not helping here ..

Thanks for the answers and sorry by advance if this question has been already asked ! :)

2

It's possible to achieve this by a combination of cmidrule with NiceTabular.

\documentclass{article}

\usepackage{lipsum}
\usepackage{nicematrix}
\usepackage{booktabs}

\begin{document}

\begin{NiceTabular}{|p{5cm}||p{5cm}|}
    \cmidrule(r{0.25em}){1-1} \cmidrule{2-2}
    \lipsum[1][1] & \lipsum[1][1]  \\
    \cmidrule(r{0.25em}){1-1} \cmidrule{2-2}
    \lipsum[1][1] & \lipsum[1][1]  \\
    \cmidrule(r{0.25em}){1-1} \cmidrule{2-2}
\end{NiceTabular}

\end{document}

output

2
  • 1
    Thanks !! This is very nice !! :)
    – Cla-Jan
    Nov 29 '21 at 13:20
  • You are welcome. BTW, it's better to wait for some time (maybe a day) before accepting an answer as it is quite common to get a better answer later.
    – Imran
    Nov 29 '21 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.