LaTeX forum ⇒ GeneralLine

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

Postby Jchen066 » Tue Oct 16, 2018 2:02 pm

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
Line.PNG (10.58 KiB) Viewed 8063 times

User avatar
Stefan Kottwitz
Site Admin
Posts: 9242
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Tue Oct 16, 2018 2:09 pm

Hi Sam,

you could use the dashrule package. For example:

  1. \documentclass{article}
  2. \usepackage{dashrule}
  3. \begin{document}
  4. text
  5.  
  6. \hdashrule[0.75ex]{\textwidth}{1pt}{1ex}
  7.  
  8. text
  9. \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
Site admin

Jchen066
Posts: 13
Joined: Tue Aug 28, 2018 12:50 am

Postby Jchen066 » Tue Oct 16, 2018 2:31 pm

Stefan Kottwitz wrote:Hi Sam,

you could use the dashrule package. For example:

  1. \documentclass{article}
  2. \usepackage{dashrule}
  3. \begin{document}
  4. text
  5.  
  6. \hdashrule[0.75ex]{\textwidth}{1pt}{1ex}
  7.  
  8. text
  9. \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?

User avatar
Stefan Kottwitz
Site Admin
Posts: 9242
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Tue Oct 16, 2018 2:55 pm

Perhaps like this:

  1. \documentclass{article}
  2. \usepackage{dashrule}
  3. \usepackage{xcolor}
  4. \newlength{\mypageheight}
  5. \newcommand\lines[3][1pt]{%
  6. \setlength{\mypageheight}{#3}%
  7. \loop%
  8. \addtolength{\mypageheight}{-#2}%
  9. \ifdim\mypageheight>0pt%
  10. \textcolor{red}{\hdashrule{\textwidth}{#1}{#2}}%
  11. \repeat%
  12. }
  13. \begin{document}
  14. \noindent text
  15.  
  16. \noindent text
  17.  
  18. \noindent\lines[1pt]{1ex}{0.68\textheight}
  19.  
  20. \end{document}


Stefan
Site admin

Jchen066
Posts: 13
Joined: Tue Aug 28, 2018 12:50 am

Postby Jchen066 » Sun Oct 21, 2018 12:41 pm

this seems to fill a full page of lines. how do i use the macro to fulfil the line for the rest of the lines (if there is only 5 line's of space left in the current


Return to “General”

Who is online

Users browsing this forum: Baidu [Spider] and 4 guests