TransWikia.com

Line over multiple rows

TeX - LaTeX Asked on January 24, 2021

enter image description here

Does anyone know, how to create something like this? I think it could work with tables, but I do not know if the lines will align that perfectly.

2 Answers

Here is a version using arydshln:

enter image description here

documentclass{article}
usepackage{arydshln}

begin{document}

begin{tabular}{llllll}
A: & 0 & multicolumn{1}{l:}{1} & 1 & 0 & 0 
B: & 0 & multicolumn{1}{l:}{1} & 0 & 1 & 0 
cdashline{4-4}
C: & 1 & 1 & multicolumn{1}{l:}{0} & 0 & 1 
cdashline{4-4}
D: & 1 & multicolumn{1}{l:}{0} & 0 & 1 & 0 
cdashline{4-4}
E: & 1 & 1 & multicolumn{1}{l:}{1} & 0 & 1 
end{tabular}

bigskip

setlength{dashlinedash}{2pt}
setlength{dashlinegap}{0.5pt}
begin{tabular}{llllll}
A: & 0 & multicolumn{1}{l:}{1} & 1 & 0 & 0 
B: & 0 & multicolumn{1}{l:}{1} & 0 & 1 & 0 
cdashline{4-4}
C: & 1 & 1 & multicolumn{1}{l:}{0} & 0 & 1 
cdashline{4-4}
D: & 1 & multicolumn{1}{l:}{0} & 0 & 1 & 0 
cdashline{4-4}
E: & 1 & 1 & multicolumn{1}{l:}{1} & 0 & 1 
end{tabular}

bigskip

setlength{dashlinedash}{1pt}
setlength{dashlinegap}{1pt}
begin{tabular}{llllll}
A: & 0 & multicolumn{1}{l:}{1} & 1 & 0 & 0 
B: & 0 & multicolumn{1}{l:}{1} & 0 & 1 & 0 
cdashline{4-4}
C: & 1 & 1 & multicolumn{1}{l:}{0} & 0 & 1 
cdashline{4-4}
D: & 1 & multicolumn{1}{l:}{0} & 0 & 1 & 0 
cdashline{4-4}
E: & 1 & 1 & multicolumn{1}{l:}{1} & 0 & 1 
end{tabular}

end{document}

Correct answer by leandriis on January 24, 2021

One option is using a NiceTabular from the nicematrix package.

documentclass{article}
usepackage{tikz}
usepackage{nicematrix}
begin{document}
begin{NiceTabular}{lccccc}[code-after={begin{tikzpicture}
draw[dashed] (row-1-|col-4) -- ([yshift=0.2ex]row-3-|col-4) -| ([yshift=0.2ex]row-4-|col-5)
-| (row-6-|col-4);
end{tikzpicture}}]
A: & 0 & 0 & 1 & 0 & 0 
B: & 0 & 1 & 0 & 1 & 0 
C: & 1 & 1 & 0 & 0 & 1 
D: & 1 & 0 & 0 & 1 & 0 
E: & 1 & 1 & 1 & 0 & 1 
end{NiceTabular}
end{document}

enter image description here

Answered by user231225 on January 24, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP