General ⇒ Line
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- Stefan Kottwitz
- Site Admin
- Posts: 10335
- Joined: Mon Mar 10, 2008 9:44 pm
Line
you could use the

Code: Select all
\documentclass{article}
\usepackage{dashrule}
\begin{document}
text
\hdashrule[0.75ex]{\textwidth}{1pt}{1ex}
text
\end{document}
\textcolor{red}{\hdashrule[0.75ex]{\textwidth}{1pt}{1ex}}
if you load the
color
or xcolor
package.Stefan
Line
Stefan Kottwitz wrote:Hi Sam,
you could use thedashrule package. For example:
Click the link above to see the manual with explanation of the options. You can use the usual color commands if you like, such asCode: Select all
\documentclass{article} \usepackage{dashrule} \begin{document} text \hdashrule[0.75ex]{\textwidth}{1pt}{1ex} text \end{document}
\textcolor{red}{\hdashrule[0.75ex]{\textwidth}{1pt}{1ex}}
if you load thecolor
orxcolor
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
- Site Admin
- Posts: 10335
- Joined: Mon Mar 10, 2008 9:44 pm
Line
Code: Select all
\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}