In LaTeX, how would I make a long underscore?

For example,

Name _______  Signature _______
  • 7
    Those should be lines (rules) and not underscores.
    – Caramdir
    Aug 3, 2011 at 4:22
  • 2
    possible duplicate of How can i add a "field" for handwritten text?
    – Caramdir
    Aug 3, 2011 at 4:22
  • 3
    @Caramdir Oddly though, the simple solutions like mine and Jake's don't appear there.
    – Alan Munn
    Aug 3, 2011 at 4:34
  • 6
    @Neil I think the way you've posed the question is nice and simple and captures what many people have a need for; the other question is really quite a bit more complicated, so I think we shouldn't close this one. (I'd also wait a bit before accepting either answer.)
    – Alan Munn
    Aug 3, 2011 at 4:39
  • 2
    @RyanReich: Oh geez :( I really didn't mean to be discourteous. To be fair, I had already upvoted your answer and the other one, but looking back, I thought the underline solution produced a rule that was below the text and that seems better to me now. I thought since all three top answers had 10k+ rep, you wouldn't even notice! If you think reaccepting yours is more courteous, I'd be happy to.
    – Neil G
    Jun 12, 2013 at 22:49

7 Answers 7


You can just \underline a \hspace:


Name \underline{\hspace{3cm}}
Signature \underline{\hspace{3cm}}


underlined spaces

  • 5
    Is this better than just using a rule? If so, how?
    – Seamus
    Aug 3, 2011 at 10:39
  • 4
    @Seamus -- using \hspace isn't necessarily "better" than just using a rule, but if you are placing the rule after a word, the \underline will place it lower than the baseline, which looks better in most cases. so it saves a bit of decision making. Aug 3, 2011 at 12:54
  • 2
    @Seamus: It also uses the standard line thickness, so you don't run the risk of making the line slightly too thick or thin.
    – Jake
    Aug 3, 2011 at 23:13
  • 4
    Use #em instead of #cm in order to make the length of the underscore depend on the font’s width. Dec 30, 2014 at 17:38

You can use \rule:

\rule[<raise height>]{<width>}{<height>}

For example \rule{2in}{.5pt} will give you the sort of thing you want.

The optional argument can be used to raise (positive value) or lower (negative value) the rule. Sometimes lowering it slightly looks better.

  • This is a good solution if you want fine control over the dimensions.
    – Neil G
    Aug 3, 2011 at 18:54

As I learned from the exam class's documentation, you can do this:


which allows you to control how much space the entire construction takes up, rather than just the underlined part.


A code such as


in your preamble allows you to say


instead of your complicated construction.


If you want a line (or rule) at the baseline of a specific length (and width), you can just use \rule{<len>}{<width>}. You can also adjust the vertical displacement (or depth) by adding an optional argument: \rule[<depth>]{<len>}{<width>}.

Here's a mock-up using an example:

enter image description here

\newcommand{\uline}[1]{\rule[0pt]{#1}{0.4pt}}% Fill this blank
Assume $A \subset B$.
We want to show $A \subset (A \cap B)$ and \uline{2cm}.
The first fact is true since: $A \subset B \Rightarrow$
if $x \in A$ then \uline{2cm} $\Rightarrow$
if $x \in A$ then $x \in A and B$.
The second fact is true by \uline{2cm}.

Conversly, assume \uline{2cm}.
By the first property again, $B \supset$ \uline{2cm},
so we have \uline{4cm}.

I've defined \uline to take a single argument, fixing the others passed to \rule (width is 0.4pt and depth is 0pt). You can modify this as required, depending on the preference.

  • I'm confused - the answer does not modify \rule anymore, but it still seems like it did. Could somebody mark the update? Mar 26, 2013 at 12:11
  • 1
    @Blaisorblade: Yes, I'll flag the comments as obsolete and request a moderator to remove them. You can see the original entries as part of the post history/revisions.
    – Werner
    Mar 26, 2013 at 14:21

In ConTeXt you can use the command \thinrules. The optional parameter n outputs a particular amount of lines. Example:


Some text \thinrules[n=1]
Some text \thinrules[n=2]


The result:



You can also use the soul package. This has the added benefit that the underline can be of a different color, and also should be able to work across paragraph boundaries (except that there appears to be a bug, so had to add the \mbox below for now.



    Signature \UnderlineText[blue]{\mbox{\hspace{5cm}}}
  • 3
    If all you want is a coloured line, you don't need the soul package. Instead, you can just use the \color command from the xcolor package: \color{red}{\underline{\hspace{3cm}}}
    – Jake
    Aug 3, 2011 at 5:31
  • @Jake: Good point. I have been using the \UnderlineText to obtain an underline of a different coloring than the text, but since in this case there is no text that is not really an issue. Hopefully, once the related problem is solved, this solution will be of some use as the \ul will handle line boundaries. Aug 3, 2011 at 5:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .