This code
\documentclass[10pt,a4paper]{article}
\usepackage[showframe,headheight=2in,headsep=0.1in,left=0.8in,right=0.8in,bottom=0.5in]{geometry}
\usepackage{xcolor}
\usepackage{hyperref}
\begin{document}
\begin{Form}
\noindent\textbf{DESCRIPTION OF ACTIVITY}\raisebox{-2pt}{\TextField[name=description,width=4.3in]{~}}
\end{Form}
\end{document}
gives the output
Notice that the text field box did not end at the right margin. This results to ugly alignment of the boxes after typing several lines with text fields. I could have used \hfill
before the text field but that will leave ugly white space between DESCRIPTION… and the text field.
So, to my question: How can I define a width, remwidth, such that I can write
\noindent\textbf{DESCRIPTION OF ACTIVITY}\raisebox{-2pt}{\TextField[name=description,width=remwidth]{}}
so that the text field box stops exactly at the right margin rule?
I would appreciate it very much if the the answer would include an explanation of what is happening at every step.
Edit: October 15, 2012 I edited the question since the problem is really about the \TextField
command and the hyperref
package putting a padding in it as noted in the comments. The other part of my question on defining a width command that I can use elsewhere is actually solved by \linewidth
, which I just learned last night even after 3 years of using LaTeX. The question Difference between \textwidth, \linewidth and \hsize clarified its use for me.
Best Answer
The mandatory argument to
\TextField
is the text that precedes the box. It's sufficient to measure it (and cut out something).The
lipsum
andgeometry
packages are just to provide text and the frame. The 2.22221pt excess has been determined from theOverfull \hbox
message that one gets without it.One can get rid of this adjustment by doing
because the macro that is called by
\TextField
adds one between the text and the box (thanks to Heiko Oberdiek for pointing out this).