1

I would like to create a table with different \vline and \hline width. But, when I use \cline in this table it draws wrong lines in places, where \setlength used in header of tabular. How can I fix it?

\begin{table}
    \centering
    \caption {text} \label{tab:lb3}
    \begin{tabular}
        {@{\setlength{\arrayrulewidth}{0.2em}\vline~}c|c|c|c@{~\setlength{\arrayrulewidth}{0.2em}\vline~}c|c|c@{~\setlength{\arrayrulewidth}{0.2em}\vline~}c|c|c@{~\setlength{\arrayrulewidth}{0.2em}\vline~}c|c|c@{~\setlength{\arrayrulewidth}{0.2em}\vline}} 
        \specialrule{0.2em}{0em}{0em} 
        1 & 1 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\

        \specialrule{0.2em}{0em}{0em} 
        0 & 0 & 0 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & \multicolumn{3}{c@{~\setlength{\arrayrulewidth}{0.2em}\vline}}{\multirow{3}*{A}} \\
        \cline {1-10}
        0 & 0 & 0 & 1 & 0 & 1 & 0 & 0 & 0 & 0 & \multicolumn{3}{c@{~\setlength{\arrayrulewidth}{0.2em}\vline}}{} \\
        \cline{1-9}
        0 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 0 & \multicolumn{3}{c@{~\setlength{\arrayrulewidth}{0.2em}\vline}}{} \\
        \specialrule{0.2em}{0em}{0em}
    \end{tabular}
\end{table}

enter image description here

2 Answers 2

1

The problem comes from your definition of the thick vertical lines. Here is a correct (and shorter) code:

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{multirow, array, caption}
\usepackage{booktabs}

\begin{document}

\begin{table}
\centering
\caption {text} \label{tab:lb3}
\begin{tabular}
    {!{\vrule width 0.2em}c|*4{c|c|c|c!{\vrule width 0.2em}}}
    \specialrule{0.2em}{0em}{0em}
    1 & 1 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    \specialrule{0.2em}{0em}{0em}
    0 & 0 & 0 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & \multicolumn{3}{c@{~\setlength{\arrayrulewidth}{0.2em}\vline}}{\multirow{3}*{A}} \\
    \cline {1-10}
    0 & 0 & 0 & 1 & 0 & 1 & 0 & 0 & 0 & 0 & \multicolumn{3}{c@{~\setlength{\arrayrulewidth}{0.2em}\vline}}{} \\
    \cline{1-9}
    0 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 0 & \multicolumn{3}{c@{~\setlength{\arrayrulewidth}{0.2em}\vline}}{} \\
    \specialrule{0.2em}{0em}{0em}
\end{tabular}
\end{table}

\end{document} 

enter image description here

0

For information, here is a way to create that table with {NiceTabular} of nicematrix.

\documentclass[11pt]{article}
\usepackage{caption}
\usepackage{nicematrix,tikz}

\NiceMatrixOptions
  {
    custom-line = 
     {
       letter = I , 
       total-width = 1mm ,
       tikz = { line width = 1mm }
     } ,
    custom-line = 
     {
       command = BoldLine ,
       total-width = 1mm ,
       tikz = { line width = 1mm , shorten < = -1mm }
     }
  }

\begin{document}

\begin{table}
\centering
\caption {text} \label{tab:lb3}
\begin{NiceTabular}{Ic|c|c|c|cIc|c|c|cIc|c|c|cI}
\BoldLine
1 & 1 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
\BoldLine
0 & 0 & 0 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & \Block{3-3}{A} \\
\Hline
0 & 0 & 0 & 1 & 0 & 1 & 0 & 0 & 0 & 0 \\
\Hline
0 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 0 \\
\BoldLine
\end{NiceTabular}
\end{table}

\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 .