Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In a normal table, you can use the \hline command to draw a horizontal line. I am trying to make this line a dashed horizontal line.

I have found the package dashrule via this answer, but this only works for \rule situations; i.e. it can't be directly used as a line in a table, and LaTeX won't compile it. Conversely, I've tried wrapping the \hdashrule in a multicolumn:

\multicolumn{5}{|c|}{\hdashrule{130mm}{1pt}{4pt}} \\

However, the padding around the table cell breaks the flow of the table, and the horizontal rule is not aligned with the other \hlines of the table. (It also means that the rule width must be specified manually.)

Is there any way to make a \hline dashed without resorting to tables-in-tables? Can you force a single table cell to have no vertical or horizontal margins and padding?

share|improve this question
    
Maybe you can help on this question: tex.stackexchange.com/questions/171518/…? –  Idear Apr 14 at 23:24

1 Answer 1

The arydshln package offers you the \hdashline and \cdashline commands which are the dashed counterparts of \hline and \cline, respectively. A little example (including also a vertical dashed line):

\documentclass{report}
\usepackage{arydshln}

\begin{document}

\begin{tabular}{c:cc}
   column1a & column2a & column3a \\
   column1b & column2b   & column3b\\ \hdashline
   column1c & column2c & column3c \\ \cdashline{1-2}
   column1d & column2d & column3d \\
\end{tabular}

\end{document}

You can also specify how wide the dashes should be by specifying a ratio. For a dotted line write

\hdashline[0.5pt/5pt]
share|improve this answer
    
It seems like that \usepackage{arydshln} is not compatible with \usepackage{tabularx}. They cannot coexist. Is there any resolution for this? –  Idear Apr 14 at 22:46
    
Maybe you can help on this question: tex.stackexchange.com/questions/171518/…? –  Idear Apr 14 at 23:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.