Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to make a name and address fill-in-the-blank in a neat rectangle with a lined space where the information should be filled in. At first I came up with this:

\begin{tabular}{ll}
\multicolumn{2}{l}{NAME\underline{\hspace{15em}}\\
\multicolumn{2}{l}{ADDRESS\underline{\hspace{15em}}} \\
\multicolumn{2}{l}{CITY\underline{\hspace{15em}}} \\
STATE\underline{\hspace{3em}} & ZIP\underline{\hspace{8em}}
\end{tabular}

But this yields a ragged right edge and tinkering with the \hspace{} parameters is a non-starter. I tried this:

\begin{tabular}{ll}
\multicolumn{2}{l}{NAME\underline{\hspace{15em}}\\
\multicolumn{2}{l}{ADDRESS\underline{\h fill}} \\
\multicolumn{2}{l}{CITY\underline{\hfill}} \\
STATE\underline{\hspace{3em}} & ZIP\underline{\hfill}
\end{tabular}

But I get no underlines at all with the \hfills. I don't want to simply make this a tabular with \hlines because that will result in underlined field names or gaps between the field names and the underlining.

share|improve this question

migrated from stackoverflow.com Jul 22 '13 at 13:02

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

1 Answer 1

up vote 1 down vote accepted

It is far easier to leave the guess-work to TeX. In the example below I've fixed the tabular to a single paragraph column of width 20em. Rules are inserted using leaders (via \hrulefill):

enter image description here

\documentclass{article}
\begin{document}
\noindent
\begin{tabular}{@{}p{20em}@{}}
  NAME~\hrulefill \\
  ADDRESS~\hrulefill \\
  CITY~\hrulefill \\
  STATE~\hrulefill\quad ZIP~\hrulefill\hrulefill
\end{tabular}
\end{document}​

The rule associated with ZIP is twice that of STATE, as suggested by the double \hrulefill. The total width of the table is 20em, since padding on either end has been removed with @{}.

share|improve this answer

Your Answer

 
discard

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

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