## LaTeX forum ⇒ General ⇒ Line

LaTeX specific issues not fitting into one of the other forums of this category.
Jchen066
Posts: 13
Joined: Tue Aug 28, 2018 12:50 am

### Line

Hi Guys,

Anyone can help me with the code to insert dash line in the document? and how to change space between the line and the style of the line, and the color

Thanks
Sam
Attachments
Line.PNG (10.58 KiB) Viewed 8049 times

Stefan Kottwitz
Posts: 9223
Joined: Mon Mar 10, 2008 9:44 pm
Hi Sam,

you could use the dashrule package. For example:

\documentclass{article}\usepackage{dashrule}\begin{document}text \hdashrule[0.75ex]{\textwidth}{1pt}{1ex} text\end{document}

Click the link above to see the manual with explanation of the options. You can use the usual color commands if you like, such as
\textcolor{red}{\hdashrule[0.75ex]{\textwidth}{1pt}{1ex}}

if you load the color or xcolor package.

Stefan

Jchen066
Posts: 13
Joined: Tue Aug 28, 2018 12:50 am
Stefan Kottwitz wrote:Hi Sam,

you could use the dashrule package. For example:

\documentclass{article}\usepackage{dashrule}\begin{document}text \hdashrule[0.75ex]{\textwidth}{1pt}{1ex} text\end{document}

Click the link above to see the manual with explanation of the options. You can use the usual color commands if you like, such as
\textcolor{red}{\hdashrule[0.75ex]{\textwidth}{1pt}{1ex}}

if you load the color or xcolor package.

Stefan

Thanks Stefan..

This is useful.

is there a way to auto fill the dash line for the rest or entire A4 page?

Stefan Kottwitz
Posts: 9223
Joined: Mon Mar 10, 2008 9:44 pm
Perhaps like this:

\documentclass{article}\usepackage{dashrule}\usepackage{xcolor}\newlength{\mypageheight}\newcommand\lines[3][1pt]{%  \setlength{\mypageheight}{#3}%  \loop%  \addtolength{\mypageheight}{-#2}%  \ifdim\mypageheight>0pt%  \textcolor{red}{\hdashrule{\textwidth}{#1}{#2}}%  \repeat%}\begin{document}\noindent text \noindent text \noindent\lines[1pt]{1ex}{0.68\textheight} \end{document}

Stefan