2

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.

question
  • 211

2 Answers2

6

One option is using a NiceTabular from the nicematrix package.

\documentclass{article}
\usepackage{tikz}
\usepackage{nicematrix}
\begin{document}
\begin{NiceTabular}{lccccc}
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 \\
\CodeAfter
  \tikz \draw [dashed] (1-|4) -- ([yshift=0.2ex]3-|4) -| ([yshift=0.2ex]4-|5) -| (6-|4);
\end{NiceTabular}
\end{document}

enter image description here

F. Pantigny
  • 40,250
3

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}

leandriis
  • 62,593