[Tex/LaTex] Dotted line instead of \hline in table environment

arydshlntables

I am trying to get a dotted line in the table instead of \hline, but I can't get the output.

arydshln and dashrule packages are available to get the dashed line, but I can't find any packages to get a dotted line in table.

Is any package available for this style?

Best Answer

The package arydshln by Hiroshi Nakashima provides dashed lines, but they can be changed to look like dots, somehow, by reducing the dash length and increasing the gap a little bit (both default to 4pt)

Change the lengths \dashlinedash, \dashlinegap accordingly and \arrayrulewidth eventually.

\documentclass{book}

\usepackage{arydshln}

\setlength{\dashlinedash}{0.2pt}
\setlength{\dashlinegap}{4.5pt}
\setlength{\arrayrulewidth}{0.2pt}

\begin{document}
\begin{tabular}{ll}
\hline
& \\
This is a & nice table \\
& \\
\hdashline
& \\
\end{tabular}


% Another combination of values
\setlength\dashlinedash{0.2pt}
\setlength\dashlinegap{1.5pt}
\setlength\arrayrulewidth{0.3pt}

\begin{tabular}{ll}
\hline
This is yet & another nice table \\
\hdashline
\end{tabular}


\end{document}  

enter image description here

Edit: In a previous version I had\usepackage{array} -- this package is not needed, so I removed it from the code.