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 have the following code defined in a class file I am writing:

\newlength{\textfieldlength}\newlength{\labellength}\newlength{\testlength}

\newcommand{\textfieldintable}[3]{
\setlength{\textfieldlength}{\linewidth}
\settowidth{\labellength}{#1}
\addtolength{\textfieldlength}{-\labellength-10pt}
\setlength{\testlength}{350pt}

\typeout{\the\labellength}
\typeout{\the\textfieldlength}
\textbf{#1} & 
\TextField[name=#1,charsize=8pt,bordercolor={1 1 1}, height=12pt, width=360pt,value=#2]{#3}
 }

When I use this new command in an external file:

\begin{Form}

\begin{tabular}{ll}
\textfieldintable{Employee Full Name}{Your Name}{}
\end{tabular}

\end{Form}

I get a form field that one can type in, in the second column (in addition to the label in the first column).

However, if I change the code above to:

\TextField[name=#1,charsize=8pt,bordercolor={1 1 1}, height=12pt, width=\the\textfieldlength,value=#2]{#3}

the form field vanishes. The first column of the table still gets the #1 argument as it should. The same thing happens if I use \textfieldlength, \the\labellength, \labellength, or \testlength instead of \the\textfieldlength.

What is going on? Why can't I use a variable as the value for width= key in \TextField?

share|improve this question
1  
Please add what's necessary to make the code a compilable example. –  egreg May 1 at 16:05

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.