5

In the code below, I was able to produce dashed grey vertical lines of a certain width. I want to replace the solid line by a dashed one. I tried to add : using the arydshln package, but it leads to error.

\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{tabularx}
\usepackage{lscape}
\usepackage{geometry}
\usepackage{colortbl}
\usepackage{tcolorbox}

\geometry{left=2mm,right=2mm} \geometry{top=3mm,bottom=3mm} \newcolumntype{?}{!{\color{gray}\vrule width 0.5pt}}

\begin{document}

\begin{table} \caption{Caption} \begin{tabularx}{0.4\textwidth}{>{\hsize=\hsize}X?>{\hsize=\hsize}X} \hline\[0.2pt] A & B\ D & E\ \end{tabularx} \label{table1} \end{table}

\end{document}

Anthony
  • 239

2 Answers2

1

enter image description here

\documentclass{article}
\usepackage{tabularx}
\usepackage[table]{xcolor}
\usepackage{arydshln}

\begin{document}

\begin{table} \caption{Caption} \arrayrulecolor{gray} \begin{tabularx}{0.4\textwidth}{X:X} \arrayrulecolor{black} \hline\[0.2pt] A & B\ D & E\ \end{tabularx} \label{table1} \end{table}

\end{document}

leandriis
  • 62,593
1

enter image description here

\documentclass{article}
\usepackage{nicematrix,tikz}

\begin{document} \tikzset {
dashed 1/.style = { red , dash pattern = on 2pt off 3pt , line width = 1 pt } , dashed 2/.style = { blue , dash pattern = on 1pt off 1pt , line width = 2pt } }

\begin{NiceTabular}{wc{2cm}wc{2cm}} \hline A & B\ D & E\ \CodeAfter \begin{tikzpicture} \draw [dashed 1] (row-1-|col-2) -- (row-3-|col-2) ; \draw [dashed 2] (row-1-|col-3) -- (row-3-|col-3) ; \draw [dashed 1] (row-2-|col-1) -- (row-2-|col-3) ; \draw [dashed 2] (row-3-|col-1) -- (row-3-|col-3) ; \end{tikzpicture} \end{NiceTabular} \end{document}

js bibra
  • 21,280