Text under a line
Or a \shortstack
that's lowered by -\baselineskip
using \raisebox
:
\documentclass{article}
\begin{document}
How now \raisebox{-\baselineskip}{\shortstack{\underline{\hspace{3cm}}\\(brown cow)}}?
\end{document}
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.
Code/Example:
\documentclass[]{article}
\usepackage[]{amsmath}
% THIS IS MY NEWLY DEFINED COMMAND
\newcommand\tline[2]{$\underset{\text{#1}}{\text{\underline{\hspace{#2}}}}$}
\begin{document}
Name: \tline{(full name)}{1in}
\end{document}
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
\newsavebox\mybox
\newlength\mylen
\newlength\fieldlen
\newcommand\tlinefill[2]{\noindent #1\sbox\mybox{#1}%
\settowidth\mylen{\usebox\mybox}%
\setlength\fieldlen{\linewidth}%
\addtolength\fieldlen{-\mylen}%
$\underset{\text{#2}}{\text{\underline{\hspace{\fieldlen}}}}$}
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:
Note that the lipsum
text is there just to show the line width.
Another possibility is to use \underset
command from the amsmath package, e.g.
\documentclass{article}
\usepackage{amsmath}
\pagestyle{empty}
\begin{document}
$\underset{\text{name, phone}}{\underline{\hspace{5cm}}}$
\vspace*{2cm}
Name: $\underset{\text{(full name)}}{\underline{\hspace{5cm}}}$
\end{document}