I am writing this question after seeing this one as I had no idea that you could make forms like that in TeX.

Playing a bit with the code in that example I came across two issues I could not find how to change with the \TextField[parameters]{label}environment.

How to set the number of lines in a multiline environment and how to move the label at the top rather than the bottom of the multiline box.

According to the manual the option for the multiline environment is just a boolean parameter

multiline boolean false whether text box is multiline

and the label appears at the bottom rather than the top.

  1. To specify the height of a multiline text fielf, use the optional argument height, such as

  2. For vertical alignment, you could use \height which gives he height of a box, together with \raisebox, such as

    \renewcommand*{\LayoutTextField}[2]{\makebox[6em][l]{#1: }%
  3. You could even adjust the default height of a multiline text field, like


Here's a complete example for this, re-using the code of the linked question:

\renewcommand*{\LayoutTextField}[2]{\makebox[6em][l]{#1: }%
%\renewcommand*{\LayoutTextField}[2]{% or this or similar ...
  %\raisebox{-\height}{\makebox[6em][l]{#1: }}\raisebox{-\height}{#2}}
\def\LayoutChoiceField#1#2{\makebox[6em][l]{#1: }#2}
  backgroundcolor={.85 .85 .85}]{Name}\vskip1ex

  backgroundcolor={.85 .85 .85},]{Affiliation}\vskip1ex

  backgroundcolor={.85 .85 .85}]{Are you a}{Student, Academic}\\

  width=\longline,borderwidth=0,backgroundcolor={.85 .85 .85}]{Comments}\\

enter image description here

  • Is there a particular reason that the same code does not provide the same results with XeLatex? Everything appears to be misaligned again. I am using Xelatex for the fontspec package as I am trying to use a system font not available to pdftex – o4tlulz Jun 16 '12 at 10:05
  • @o4tlulz Interesting! I noticed that too. However, it works fine with LuaLaTeX. Could you use that? – Stefan Kottwitz Jun 16 '12 at 17:51
  • I have a question, when I use backgroundcolor, it changes the background color when I click on the field, but as soon I filled the field and press enter, the default background color comes back. Any idea why ? – joseldsm Oct 30 '18 at 10:38
  • it works perfectly for me until a few \textfield. After i do like 4 they start to group together in pairs so it just messes with the spacing between the text fields – Jettie Baker Aug 28 '19 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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