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}

  1. [...] 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 [...]

  2. 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?

  3. cw says:

    Works great. Thanks!

  4. Zach says:

    Thanks! Works great.

  5. Simon says:

    Thanks! :-D

  6. Jay says:

    Thanks.
    It works great.
    I just wanted to create line for putting signature.

  7. [...] Latex ????? ???? ?? ??????? ???? ???? line ????? ???. ??? ???? ?? ??????? ??????? ?? ????? ????? ????? [...]

  8. Fiona says:

    Hi, this is great, thanks. Do you know how to get a double horizonal line please? Just to tart it up a bit… Thanks!

  9. Tim says:

    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}

  10. teodor says:

    Excellent solution! Also works within a math environment

  11. Katarina says:

    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

  12. Tim says:

    Hi Katarina,

    To change the line thickness you can use something like \linethickness{2mm} before the \line command.

    To change the color, see this post.

    -T

  13. Tim says:

    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 \vspace in the definition may or may not be needed, depending on what you’re doing).