TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have used the \hrulefill command to create a horizontal rule, along with some other commands. In each case I have the rules extended up to the margin.

I want the rule width to be controllable, i.e. I want them to span the entire page. How can this be done? The existing help on Internet looks pretty scarce. Thanks for your help.

share|improve this question

migrated from stackoverflow.com Jun 1 '11 at 1:18

This question came from our site for professional and enthusiast programmers.

To get horizontal lines of any fixed length you can use the \rule command. To get a horizontal line spanning the whole page width you can use a \makebox command and then a \rule with a width equal to \paperwidth:



Below is a Line spanning the entire width of the page


Below is a 2cm long line


Below is a 4cm long line


Below is a 8cm long line



Output: enter image description here Rules in LaTeX are 0.4pt "thick", by default.

share|improve this answer

Another option is this one, which makes a horizontal line stretch the entire page. I prefer this one, because it's short, easy to remember and exactly what I need. I hope this works for you too.

share|improve this answer
+1 It helped me to get a gray horizontal line: \textcolor[RGB]{220,220,220}{\rule{\linewidth}{0.2pt}} – Paul Vargas Apr 13 '15 at 6:22

I used the \line command: \line(x slope, y slope){length}.

share|improve this answer

\underline{\hspace{ x in}} gives you a line of length x inches.

share|improve this answer
Welcome to TeX.SX! Don't be so chatty! ;-) I don't think that this answers the (old) question – Christian Hupfer Sep 26 '14 at 14:07
\noindent\rule{4cm}{0.4pt} & \hspace{0.05in}\noindent\rule{4cm}{0.4pt} & \hspace{0.05in}\noindent\rule{4cm}{0.4pt} \\
      \footnotesize{XYZ} & \hspace{0.05in}\footnotesize{ABC} & \hspace{0.05in}\footnotesize{QWE} \\
   \footnotesize{\textbf{Name 1}}& \hspace{0.05in}\footnotesize{\textbf{Name 2}} & \hspace{0.05in}\footnotesize{\textbf{Name 3}}]


share|improve this answer
Welcome to TeX.SX! I'm not sure how this fits into the question. – egreg Jan 17 at 21:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.