# Horizontal line not working?

I am trying to add a horizontal line in my document.

\documentclass{report}
\begin{document}
\begin{center}
\Huge CV
\end{center}
\line(1,0){250}
\end{document}


For some reason, \line(1,0){250} will generate a line that is unequal on your document. What I mean is that the line will appear to be a lot longer on the right than the left. I am tryng to make it long and even. I also want to try to make it thicker if possible.

-
Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count. This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). –  Martin Schröder Jan 7 '12 at 22:25

You could use the command

\hrule


to get a line that spans the width of the text block. The following, very slight, modification of your MWE

\documentclass{report}
\usepackage{lipsum} % for filler text
\begin{document}
\begin{center}
\Huge CV
\end{center}
\hrule
\bigskip
\lipsum[2] % generate a short paragraph of filler text
\end{document}


generates:

Interestingly, it does not appear to be necessary to place the \hrule (or equivalent) command inside the center environment.

-
It doesn't span at all, it's looks exactly the same as \line(1,0){250} –  Hawk Jan 7 '12 at 18:24
@jak: Please see the added text. I've taken your MWE and (i) added the \hrule command and (ii) taken the lipsum package to add some filler text below the \hrule. I'm afraid I can't seem to reproduce the phenomenon you describe. –  Mico Jan 7 '12 at 19:50

If you want to control precisely the vertical distance from the text CV to the rule, the following is what you need

\begin{center}
\Huge CV

\vspace{12pt}
\nointerlineskip
\rule{250pt}{0.4pt}
\end{center}


With \nointerlineskip we tell TeX not to add any automatic space (that would be there without it, since \rule as well as \line starts a paragraph). So the spacing is exactly 12pt. The width of the rule is determined by the first argument to \rule, its thickness by the second argument.

The vertical spacing is obtained with \vspace.

If you want a rule that spans the entire line width, then say

\rule{\textwidth}{0.4pt}


If you want a rule wider than the text width, but still properly centered, then

\makebox[\textwidth]{\rule{200cm}{0.4pt}}


will do the trick (the length is exaggerated, of course).

-
I know what you mean \rule{length}{thickness}. Everytime I change the thickness it goes back being the same again. The right is always longer than the left no matter what I do. –  Hawk Jan 7 '12 at 18:29
@jak That's quite strange. Do you mean that the part of the rule on the right of CV is longer than the part on the left? –  egreg Jan 7 '12 at 18:32
yes, that is what's happening –  Hawk Jan 7 '12 at 18:36
Please, try and put up an example, because with your code (amended by inserting the rule in the center environment as shown) the rule is perfectly centered. –  egreg Jan 7 '12 at 18:39
What example? Because this is the same code I am giving you. –  Hawk Jan 8 '12 at 20:58

You need to place the line inside the center environment too, to have both items placed correctly:

\documentclass{report}
\begin{document}

\linethickness{5mm}
\begin{center}
\Huge CV

\line(1,0){250}
\end{center}

\end{document}


\line itself does not take any argument that modifies the thickness. But you haven't run out of luck, because the \linethickness{<param>} sets the thickness of all subsequent lines.

EDIT: The solution above works well is you want a line that does not exceed the width of the text. To have a line that elegantly spans the whole text width, you will need to do it a bit differently:

\documentclass{report}
\begin{document}

\begin{center}
\Huge CV
\rule{\linewidth}{2mm}
\end{center}

\end{document}

-
Perhaps using \rule that allows for specifying the thickness? –  egreg Jan 7 '12 at 17:47
@egreg: I edited my answer. It is possible to do that using the \line command too. –  Count Zero Jan 7 '12 at 17:50
I just tried that, but I changed the length from 250 to 500 and it is still longer on the left. –  Hawk Jan 7 '12 at 17:58
@jak: See my edit. The problem is that by explicitly forcing 500 as length, you are off the page. –  Count Zero Jan 7 '12 at 18:19
The macro \line comes from the picture environment and is the wrong type of command to draw a ruler and certainly it needs to be enclosed within the picture environment. The \linethickness can set its thickness, but a previously \unitlength command can mess it up. Rather show the correct usage of a \rule. –  Yiannis Lazarides Jan 7 '12 at 18:20