2

I want to draw dash line between rows but when I try to arydshln in the text I get an error. Can't I use dash line in the table created with tabu.

    \documentclass{article}

    \usepackage{array}
    \usepackage{multirow}
    \usepackage{longtable}
    \usepackage[tableposition=below]{caption}
    \usepackage{tabu}

    \begin{document}

    \begin{longtabu} to \textwidth {XXX}

    \hline \textbf{Model Ref.} & \textbf{Change Date} & \textbf{Description of Changes}  \\ \hline
    \endfirsthead

    \hline \textbf{Model Ref.} & \textbf{Change Date} & \textbf{Description of Changes}  \\ \hline
    \endhead

    PD-5&01/2005&New Internet Disclosure rules.\\\hline
    PD-4.1&07/2005&Small definition change to consumer loans.\\\hline
    PD-4.1&072005&Small definition change to consumer loans.\\

    \end{longtabu} 

It is working above. But as I said when I try arydshln the text cannot be compiled.

\documentclass{article}

\usepackage{array}
\usepackage{multirow}
\usepackage{longtable}
\usepackage[tableposition=below]{caption}
\usepackage{tabu}
\usepackage{arydshln}

\begin{document}

\begin{longtabu} to \textwidth {XXX}

\hline \textbf{Model Ref.} & \textbf{Change Date} & \textbf{Description of Changes}  \\ \hline
\endfirsthead

\hline \textbf{Model Ref.} & \textbf{Change Date} & \textbf{Description of Changes}  \\ \hline
\endhead

PD-5&01/2005&New Internet Disclosure rules.\\\hdashline
PD-4.1&07/2005&Small definition change to consumer loans.\\\hdashline
PD-4.1&072005&Small definition change to consumer loans.\\

\end{longtabu} 

Thank you.

nebtune
  • 43

1 Answers1

3

Dashed lines work fine with ltablex, which brings the functionalities of longtable to tabularx (and loads both packages). I also added some padding to the horizontal lines with package booktabs:

\documentclass{article}

\usepackage{array}
\usepackage{multirow}
\usepackage{ltablex, booktabs}
\renewcommand{\tabularxcolumn}[1]{>{\raggedright\arraybackslash}m{#1}}
\usepackage{arydshln}
\usepackage[tableposition=below]{caption}
\newcommand{\myhdashline}{%
\addlinespace
\hdashline
\addlinespace}

\begin{document}

\setlength{\defaultaddspace}{0.5ex}
\begin{tabularx}{\textwidth}{*{2}{>{\hsize=0.6\hsize}X}>{\hsize=1.8\hsize}X}
\toprule \textbf{Model Ref.} & \textbf{Change Date} & \textbf{Description of Changes} \\
\midrule
\endfirsthead
\midrule
\textbf{Model Ref.} & \textbf{Change Date} & \textbf{Description of Changes} \\
\midrule
\endhead
\bottomrule
\endfoot
PD-5&01/2005&New Internet Disclosure rules.\\
\myhdashline
PD-4.1&07/2005&Small definition change to consumer loans.\\
\myhdashline
PD-4.1&072005&Small definition change to consumer loans.\
\end{tabularx}

\end{document}

enter image description here

Bernard
  • 271,350
  • that's what I look. Thank you very much. But I want also to arrange columns according to the text in the column. In your example they have equal width I guess. Have can I make shorter first and change date columns while expanding the last column to fit the text? – nebtune Nov 03 '18 at 13:03
  • I've modified the tabularx preamble, playing with \hsize=xx\hsize. The coefficients xx have to satisfy the condition that their sum is equal to the number of X columns. – Bernard Nov 03 '18 at 13:55