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

closed as unclear what you're asking by Paul Gessler, Torbjørn T., Joseph Wright Feb 7 at 22:36

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

2  
Please add what's necessary to make the code a compilable example. –  egreg May 1 '14 at 16:05

Browse other questions tagged or ask your own question.