我想使用该包创建一条与页边距长度相同的水平虚线arydshln
。我读过这但使用时\hdashline[1pt/2pt]
出现错误。我应该如何\hdashline
在描述环境中实现才能获得相同的结果。(它需要在描述环境中)
我的代码是:
\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}
我意识到我可以使用\hdashrule[0.5ex][c]{\linewidth}{1pt}{2pt}
但这并不覆盖从边距到边距的页面。
答案1
dashrule
您可以通过以下软件包和简单的方法获取它\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}
答案2
使用\leaders
和\hfill
您可以自己创建虚线。我们必须自己跳到左边距,因为否则线条将从描述文本的缩进宽度开始(因此我们使用\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}