0

Can someone show me the necessary code to get an underlined textfield in latex? I want the solution to be as simple as possible so that I can customize it as needed.

Ideally, I would prefer something like,

\TextField[name=box1,baseline=true]{text (not underlined)}

I have tried the solution here (which does not work): underlined text field in a fillable form

as well as this solution (which I cannot figure out how to change simply): creating fillable PDFs

If someone could provide a simple method for underlining the fillable area, or can explain how to make the first solution work for pdflatex, it would help me a lot.

ahle6481
  • 111
  • Do you want the text inside the \TextField to be underlined, or the \TextField itself to be underlined? I'm assuming the former... – Werner Aug 29 '16 at 23:56
  • Welcome! Please provide a compilable minimal example rather than a code fragment as it will be much easier to help and much more likely you'll get a solution you consider simple which is, frankly, a relative term. – cfr Aug 30 '16 at 02:35

2 Answers2

1

Try this:

\let\oldTextField\TextField
\renewcommand{\TextField}[2][] {
        \vbox{\hbox{\oldTextField[#1]{#2}}\kern2pt\hrule}
}

If you DON'T want a box, try adding borderwidth=0 after #1. Don't forget the ,.

This does not work well with multiline textfields.
I did put this answer together from the links you provided (I had issues with the solutions as well).

0

The simplest way to do this is to use the borderstyle=U option.

\TextField[name=box1,borderstyle=U]{text (not underlined)}

But, it should better align if you write:

\mbox{text (not underlined)~\TextField[name=box1,borderstyle=U]{}}
perror
  • 754
  • 1
  • 8
  • 21