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.

Is there a way to make an underlined text field in a fillable form?

I am using the hyperref package to make a fillable form but I would also like to give the option of printing out the form and filling it by hand. For the later, a line is helpful to serve as guide for the pen.

This

\TextField[name=firstname,width=5cm,charsize=11pt]{First Name}

gives an empty box and I cannot find an easy way to underline this box.

share|improve this question
    
Welcome to TeX.SX. –  Claudio Fiandrino Mar 9 '13 at 13:01
add comment

1 Answer

The printing of the field is controlled by \MakeTextField whose default definition is equivalent to

\newcommand{MakeTextField}[2]{\vbox to #2{\hbox to #1{\hfill}\vfill}}

Replacing the inside \hfill with an \hrulefill produces a horizontal line, but because of the placing of the \vfill these will be at the top of the box. Moving the placement of \vfill gives a line at the bottom via

\renewcommand{\MakeTextField}[2]{{\vbox to #2{\vfill\hbox to #1{\hrulefill}}}}

You will probably want to adjust the colour to black (rather than the gray I get as default):

Sample output

\documentclass{article}

\usepackage{hyperref,xcolor}

\renewcommand{\MakeTextField}[2]{{\vbox to #2{\vfill\hbox to #1{\hrulefill}}}}

\begin{document}
\begin{Form}
  \TextField[name=firstname,width=5cm,charsize=11pt,color=black]{First Name}
\end{Form}
\end{document}
share|improve this answer
    
Thanks, that solved it. –  latexform Mar 10 '13 at 7:40
add comment

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.