0

I want to create a horizontal dashline with the length of page margin using the arydshln package. I've read this but when using \hdashline[1pt/2pt] I get an error. How should I implement \hdashline inside the description environment to get the same result. (It needs to be inside the description environement)

My code is:

\documentclass{article}
\usepackage{lipsum,comment,arydshln}
\author{something}
\title{something}
\begin{document}
    \maketitle
    \begin{description}
        \item[something] \lipsum[20]
        \noindent\makebox[\linewidth]{\rule{\textwidth}{1pt}}
        \begin{comment}
            need a dashline here but I don't know how to implement \hdashline[1pt/2pt] here. Moreover, I need the line to cover the page from margin to margin. This doesn't achieve this
        \end{comment}
        \item[something] \lipsum[20]
    \end{description}
    \lipsum[20]
\end{document}

I've realized that I can use \hdashrule[0.5ex][c]{\linewidth}{1pt}{2pt} But this doesn't cover the page from margin to margin.

Al_Fh
  • 452

2 Answers2

3

You can obtain it with the dashrule package and a simple \makebox:

\documentclass{article}
\usepackage{lipsum,comment, dashrule}
\author{someone}
\title{something}

\begin{document}

    \maketitle
    \begin{description}
        \item[something] \lipsum[20]
        \vspace{-1ex}\makebox[\linewidth][r]{\hdashrule[1ex][x]{\textwidth}{0.4pt}{1pt 2pt}}
        \item[something else] \lipsum[20]
    \end{description}
    \lipsum[20]

\end{document} 

enter image description here

Bernard
  • 271,350
2

Using \leaders and \hfill you can create a dashed line yourself. We have to skip to the left margin ourself because else the line would start at the indented width of the description text (hence we use \hskip\itemindent):

\documentclass{article}
\usepackage{lipsum,comment,arydshln}
\author{something}
\title{something}
\newcommand*\descriptiondashsep
  {%
    \par\noindent
    \hskip\itemindent
    {\leaders\hbox{\rule{2pt}{.4pt}\hskip1pt}\hfill\hskip-1pt}%
    \null
  }
\begin{document}
\maketitle
\begin{description}
  \item[something] \lipsum[20]
  %\noindent\makebox[\linewidth]{\rule{\textwidth}{1pt}}
  \descriptiondashsep
  % need a dashline here but I don't know how to implement \hdashline[1pt/2pt]
  % here. Moreover, I need the line to cover the page from margin to margin.
  % This doesn't achieve this
  \item[something] \lipsum[20]
\end{description}
\lipsum[20]
\end{document}

enter image description here

Skillmon
  • 60,462