Text FormattingUnderline text and adjoining blank space?

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
zach
Posts: 10
Joined: Sun Jun 21, 2009 9:43 pm

Underline text and adjoining blank space?

Post by zach »

I'm fairly new to raw LaTeX and have what I think is a fairly basic question. I'd like to know how to underline text and some space afterwards so that the total underline length can be specified. I'm creating a form with names to be underlined and want all the lines to be of uniform length even though the names are of different character length. The closest I can get is the following code:

Code: Select all

\documentclass{book} \begin{document}
\noindent I want there to be 2.5 inches of underline beneath each name, but I don't want the spaces between the name and line like here:
\vspace*{0.4in}
\newline \noindent Zach Doe
\newline \underline{\hspace*{2.5in}}
\vspace*{.2in}
\newline \noindent John Doe
\newline \underline{\hspace*{2.5in}}
\vspace*{.2in}
\newline \noindent Jane Doe
\newline \underline{\hspace*{2.5in}}%
\end{document}
Hopefully my question is clear. Let me know if it isn't. I'd appreciate your help.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Underline text and adjoining blank space?

Post by Stefan Kottwitz »

Hi Zach,

welcome to the board!

You could use \makebox:

Code: Select all

\noindent\underline{\makebox[2.5in][l]{Jane Doe}}
Stefan
LaTeX.org admin
zach
Posts: 10
Joined: Sun Jun 21, 2009 9:43 pm

Re: Underline text and adjoining blank space?

Post by zach »

Stefan,

That works perfectly. I've never used that command before. Thanks!
Post Reply