Possible Duplicate:
dynamic signature/date line

How can I make text under line in a form like this:

    name, phone


         (full name)



Solution that two users provided works well for fixed-size hspace. It is also easy to make a function from it.

Name: $\underset{\text{(full name)}}{\underline{\hspace{5cm}}}$

However I am wondering if it is possible to use kind of dynamic hspace? Or it is completely different issue?

marked as duplicate by Werner, lockstep, Alan Munn, percusse, Marco Daniel May 17 '12 at 8:47

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Solution which Martin posted here is not present in question you provided – Nik May 13 '12 at 20:15
  • True, it is not exactly the same (minor formatting and alignment), but it is similar in nature, hence the suggestive duplicate. It might be different if you had referenced that (or a similar question) with a specific difference to it saying why the solutions proposed is insufficient, or where you got stuck with reformatting it suit your needs. – Werner May 13 '12 at 20:27
  • Actually I still have troubles, trying to figure out in comments. Will update my question. – Nik May 13 '12 at 20:31
  • 1
    You can create a function of this: \newcommand*{\fullname}[1][5cm]{$\underset{\text{(full name)}}{\underline{\hspace*{\dimexpr#1}}}$} and then use \fullname, or \fullname[7cm] or \fullname[2in], or \fullname[1cm+3in]. Note the optional/square brackets. Default, without brackets, is 5cm. – Werner May 13 '12 at 20:35
  • 1
    @dig, look at my updated answer. – JohnReed May 13 '12 at 20:57

Here is a solution based on (a probably abused) math mode. I defined a new command called \tline to make it more straightforward. The first argument is the text that you want underneath the line and the second argument is the length of the line that you want.






Name: \tline{(full name)}{1in}


Output: sample output

Edit: I modified the code so that the underline will fill the rest of the line. The technique was based off of this answer to another question.

Additional Preamble Code:

% Code based on http://www.latex-community.org/forum/viewtopic.php?f=44&t=10246
\newcommand\tlinefill[2]{\noindent #1\sbox\mybox{#1}%

Using the new command \tlinefill, the line can fill the rest of the line. The first argument is the text that you want in front of the line and the second argument is the text that you want underneath the line. So, \tlinefill{Name: }{(full name)} will produce:

more output

Note that the lipsum text is there just to show the line width.

  • 1
    I just realized that Martin reached pretty much exactly the same solution that I did. The only difference is the definition of a command to make it easily reusable. – JohnReed May 13 '12 at 20:16
  • Yep actually looks similar. Is it possible to use kind of dynamic hspace so that it will grow to the right border of page? – Nik May 13 '12 at 20:26
  • 1
    @dig See my modified answer. – JohnReed May 13 '12 at 20:50

Or a \shortstack that's lowered by -\baselineskip using \raisebox:


How now \raisebox{-\baselineskip}{\shortstack{\underline{\hspace{3cm}}\\(brown cow)}}?

Another possibility is to use \underset command from the amsmath package, e.g.

$\underset{\text{name, phone}}{\underline{\hspace{5cm}}}$

Name: $\underset{\text{(full name)}}{\underline{\hspace{5cm}}}$

enter image description here

  • Is it possible to make \hspace fill all available space from left to right? – Nik May 13 '12 at 19:59
  • For me this is the best solution because it doesn't break lines height like others. – Nik May 13 '12 at 19:59

You can use a tabular environment

Name \begin{tabular}[t]{c}\hline \makebox[4cm][c]{(full name)} \\\end{tabular}


There are probably many ways to do this. One would be to use a tabular environment:

Name: & \underline{\hspace{2in}}\\
& \textsf{(full name)}

You could also use a minipage:

enter image description here

    \small \makebox[#1]{\textbf{#2}}
    \TextLine{name, phone} 

Not the answer you're looking for? Browse other questions tagged or ask your own question.