Lines can be drawin in LaTeX using the \line function. This takes an x-slope, y-slope and length like so:
\line(x-slope,y-slope){length}
To draw a horizontal line (or horizontal rule), set the x-slope to 1 and the y-slope to zero.
Depending on the margins which have been set, a length of 450 will draw a line which is the width of the page (minus the margins).
If you’re looking for a clean line to divide the page, try the following:
\begin{center}
\line(1,0){250}
\end{center}
[...] line in a presentation for a in-lecture “fill-in-the-blank”. I found the link http://timmurphy.org/2009/08/15/drawing-horizontal-lines-in-latex/. Basically, all you have to do [...]
Hello Tim. Thank you for this tip. I get an error when I try your snippet in a LaTeX article documentclass I’m creating. Does the \line command need to be called within a picture block? Or perhaps I need to include a particular package with \usepackage?
Works great. Thanks!
Thanks! Works great.
Thanks!
Thanks.
It works great.
I just wanted to create line for putting signature.
[...] Latex ????? ???? ?? ??????? ???? ???? line ????? ???. ??? ???? ?? ??????? ??????? ?? ????? ????? ????? [...]
Hi, this is great, thanks. Do you know how to get a double horizonal line please? Just to tart it up a bit… Thanks!
Hi Kristofer,
No picture environment or packages required. Here’s an example of an entire document with a line in it:
\documentclass{article}\begin{document}
\line(1,0){250}
\end{document}
Excellent solution! Also works within a math environment
Thank you?
And what if I want to change the color and the thickness of the line? Which additional commands can I use?
Thank you in advance
Katarina
Hi Katarina,
To change the line thickness you can use something like
\linethickness{2mm}before the\linecommand.To change the color, see this post.
-T
Hi Fiona,
You can create yourself a definition for this (note: the blank lines matter here!):
\def\doubleline{\vspace{-0.9em}\hspace{\fill}\line(1,0){240}\hspace{\fill}
\vspace{-0.9em}\hspace{\fill}\line(1,0){250}\hspace{\fill}
}You can then put this in your document by adding
\doubleline(the first\vspacein the definition may or may not be needed, depending on what you’re doing).