[OS X TeX] Making forms

Victor Ivrii vivrii at gmail.com
Tue Sep 12 07:42:13 EDT 2006


On 9/12/06, Peder Axensten <peder at axensten.se> wrote:
> I'd appreciate suggestions on what to use to produce forms (tick-
> boxes etc.) with LaTeX.
> Preferably, I'd like to be able to both print a nice looking form and
> have a real pdf form that could be used electronically.
>
> Any suggestions are welcome.
>

1) Read hyperref documentation.

2) If you want some automatic calculations read javascript
documentation (since pdf uses javascript for this purpose).

3) There are some pretty sophisticated packages:

http://www.math.uakron.edu/~dpstory/latx2pdf.html

4) Also note that pdftex mailing list would provide much broader audience.

My own form (slightly problematic in javascript Autocalculation: one
needs to make some simple manipulation with Acrobat to activate it)

<This mailing list does not like attachments>

\documentclass[10pt]{article}
\usepackage{bookman}
\pagestyle{empty}
\parindent=0pt

\usepackage{hyperref}

\usepackage{graphicx,color}

\renewcommand{\arraystretch}{1.4}

\usepackage{colortbl}

\usepackage{array}

\definecolor{lightgray}{gray}{.85}

\definecolor{verylightgray}{gray}{.9}

\textheight=10.truein
\voffset=-1.2truein


\begin{document}



\begin{center}



{\bf Department of Mathematics: Expense Report Summary}

\end{center}

\begin{Form}
\begin{tabular*}{\textwidth}{llllll}

\multicolumn{3}{l}{\mbox{\TextField[maxlen=100,align=0,height=15pt,width=150pt,name=s3]{Surname:}}}
&\multicolumn{3}{l}{\mbox{\TextField[maxlen=100,align=0,height=15pt,width=150pt,name=s4]{Given
name:}}}
\\
\multicolumn{6}{l}
{\mbox{\TextField[maxlen=300,align=0,height=15pt,width=300pt,name=s5]{Period
of Travel:}}}
\\
\multicolumn{6}{l}
{\mbox{\TextField[maxlen=300,align=0,height=15pt,width=300pt,name=s7]{Location
\&  Description:}}}
\\
{\mbox{\TextField[maxlen=300,align=0,height=15pt,width=300pt,name=s8]{}}}
\\
\multicolumn{6}{l}{\small
Declaration of the Claimant: I have read the University's Regulation
on Reimbursement}\\
\multicolumn{6}{l}{\small  of Expenses and confirm that I am in
compliance. I have not and will not claim any}\\
\multicolumn{6}{l}{\small  of these expenses from other sources, nor
did I receive other funds in support of this expenditure.}
\\
\multicolumn{6}{l}
{\mbox{\TextField[maxlen=350,align=0,height=15pt,width=350pt,name=s9]{Name
of Grant:}}}
\\
\multicolumn{2}{l}
{\mbox{\TextField[maxlen=300,align=0,height=15pt,width=100pt,name=s10]{Name:}}}
&\multicolumn{2}{l}
{\mbox{\TextField[maxlen=40,align=0,height=15pt,width=40pt,name=s11]{Title:}}}
&\multicolumn{2}{l}
{Signature:\ \hrulefill\hrulefill\hrulefill}\\
Authorized by:\\
\multicolumn{2}{l}
{\mbox{\TextField[maxlen=300,align=0,height=15pt,width=100pt,name=s12]{Name:}}}
&\multicolumn{2}{l}
{\mbox{\TextField[maxlen=40,align=0,height=15pt,width=40pt,name=s13]{Title:}}}
&\multicolumn{2}{l}
{Signature:\ \hrulefill\hrulefill\hrulefill}
\end{tabular*}

\begin{tabular}{|l|r|l|l|}
\hline
Expense categories: &Amount &Tax Code &G/L Acct.\\
\hline
Airfare bought in Canada (to Canada or US)
&{\mbox{\TextField[maxlen=40,keystroke={AFNumber_Keystroke(2, 0, 1, 2,
true);},align=2,height=10pt,width=45pt,name=a1]{}}}
&\cellcolor{verylightgray}i6 &\cellcolor{verylightgray}84\_010
\\
\hline
Airfare other &{\mbox{\TextField[maxlen=40,keystroke={AFNumber_Keystroke(2,
0, 1, 2, true);},align=2,height=10pt,width=45pt,name=a2]{}}}
&\cellcolor{verylightgray}i0 &\cellcolor{verylightgray}84\_010
\\
\hline
Accommodation in Canada
&{\mbox{\TextField[maxlen=40,keystroke={AFNumber_Keystroke(2, 0, 1, 2,
true);},align=2,height=10pt,width=45pt,name=a3]{}}}
&\cellcolor{verylightgray}ie &\cellcolor{verylightgray}84\_020
\\
\hline
Accommodation outside Canada
&{\mbox{\TextField[maxlen=40,keystroke={AFNumber_Keystroke(2, 0, 1, 2,
true);},align=2,height=10pt,width=45pt,name=a4]{}}}
&\cellcolor{verylightgray}i0 &\cellcolor{verylightgray}84\_020
\\
\hline
Allowances per diem in Canada
&{\mbox{\TextField[maxlen=40,keystroke={AFNumber_Keystroke(2, 0, 1, 2,
true);},align=2,height=10pt,width=45pt,name=a5]{}}}
&\cellcolor{verylightgray}i6 &\cellcolor{verylightgray}84\_030
\\
\hline
Allowances per diem outside  Canada
&{\mbox{\TextField[maxlen=40,keystroke={AFNumber_Keystroke(2, 0, 1, 2,
true);},align=2,height=10pt,width=45pt,name=a6]{}}}
&\cellcolor{verylightgray}i0 &\cellcolor{verylightgray}84\_030
\\
\hline
 Allowances kms $\times$
{\mbox{\TextField[maxlen=40,keystroke={AFNumber_Keystroke(2, 0, 1, 2,
true);},align=2,height=10pt,width=45pt,name=b7]{}}}&{\mbox{\TextField[maxlen=40,keystroke={AFNumber_Keystroke(2,
0, 1, 2, true);},align=2,height=10pt,width=45pt,name=a7]{}}}
&\cellcolor{verylightgray}&\cellcolor{verylightgray}84\_040

 \\
\hline
Railway in Canada
&{\mbox{\TextField[maxlen=40,keystroke={AFNumber_Keystroke(2, 0, 1, 2,
true);},align=2,height=10pt,width=45pt,name=a8]{}}}
&\cellcolor{verylightgray}&\cellcolor{verylightgray}84\_050

\\
\hline
Railway outside Canada
&{\mbox{\TextField[maxlen=40,keystroke={AFNumber_Keystroke(2, 0, 1, 2,
true);},align=2,height=10pt,width=45pt,name=a9]{}}}
&\cellcolor{verylightgray}&\cellcolor{verylightgray}84\_050

\\
\hline
 Car rental in Canada
&{\mbox{\TextField[maxlen=40,keystroke={AFNumber_Keystroke(2, 0, 1, 2,
true);},align=2,height=10pt,width=45pt,name=a10]{}}}
&\cellcolor{verylightgray}&\cellcolor{verylightgray}84\_060

\\
\hline
 Car rental outside Canada
&{\mbox{\TextField[maxlen=40,keystroke={AFNumber_Keystroke(2, 0, 1, 2,
true);},align=2,height=10pt,width=45pt,name=a11]{}}}
&\cellcolor{verylightgray}&\cellcolor{verylightgray}84\_060

\\
\hline
 Taxi in Canada
&{\mbox{\TextField[maxlen=40,keystroke={AFNumber_Keystroke(2, 0, 1, 2,
true);},align=2,height=10pt,width=45pt,name=a12]{}}}
&\cellcolor{verylightgray}i6 &\cellcolor{verylightgray}845000

\\
\hline
Taxi outside Canada
&{\mbox{\TextField[maxlen=40,keystroke={AFNumber_Keystroke(2, 0, 1, 2,
true);},align=2,height=10pt,width=45pt,name=a13]{}}}
&\cellcolor{verylightgray}i0 &\cellcolor{verylightgray}845000

\\
\hline
Bus in Canada &{\mbox{\TextField[maxlen=40,keystroke={AFNumber_Keystroke(2,
0, 1, 2, true);},align=2,height=10pt,width=45pt,name=a14]{}}}
&\cellcolor{verylightgray}&\cellcolor{verylightgray}84\_050

\\
\hline
Bus outside Canada
&{\mbox{\TextField[maxlen=40,keystroke={AFNumber_Keystroke(2, 0, 1, 2,
true);},align=2,height=10pt,width=45pt,name=a15]{}}}
&\cellcolor{verylightgray}i0 &\cellcolor{verylightgray}84\_050

\\
\hline
Gasoline in Canada
&{\mbox{\TextField[maxlen=40,keystroke={AFNumber_Keystroke(2, 0, 1, 2,
true);},align=2,height=10pt,width=45pt,name=a16]{}}}
&\cellcolor{verylightgray}&\cellcolor{verylightgray}84\_080

\\
\hline
Gasoline outside Canada
&{\mbox{\TextField[maxlen=40,keystroke={AFNumber_Keystroke(2, 0, 1, 2,
true);},align=2,height=10pt,width=45pt,name=a17]{}}}
&\cellcolor{verylightgray}i0 &\cellcolor{verylightgray}84\_080

\\
\hline
 Research related purchases in Canada
&{\mbox{\TextField[maxlen=40,keystroke={AFNumber_Keystroke(2, 0, 1, 2,
true);},align=2,height=10pt,width=45pt,name=a18]{}}}
&\cellcolor{verylightgray}  &\cellcolor{verylightgray}
\\
\hline
Research related purchases outside Canada
&{\mbox{\TextField[maxlen=40,keystroke={AFNumber_Keystroke(2, 0, 1, 2,
true);},align=2,height=10pt,width=45pt,name=a19]{}}}
&\cellcolor{verylightgray}  &\cellcolor{verylightgray}
\\
\hline
Miscellaneous:
{\mbox{\TextField[maxlen=150,align=0,height=10pt,width=150pt,
name=t21]{}}}
&{\mbox{\TextField[maxlen=40,keystroke={AFNumber_Keystroke(2, 0, 1, 2,
true);},align=2,height=10pt,width=45pt,name=a20]{}}}
&\cellcolor{verylightgray}&\cellcolor{verylightgray}
\\
\hline
{\mbox{\TextField[maxlen=200,align=0,height=10pt,width=200pt,
name=t21]{}}}&{\mbox{\TextField[maxlen=40,keystroke={AFNumber_Keystroke(2,
0, 1, 2, true);},align=2,height=10pt,width=45pt,name=a21]{}}}
&\cellcolor{verylightgray}&\cellcolor{verylightgray}
\\
\hline
{\mbox{\TextField[maxlen=200,align=0,height=10pt,width=200pt,
name=t22]{}}}&{\mbox{\TextField[maxlen=40,keystroke={AFNumber_Keystroke(2,
0, 1, 2, true);},align=2,height=10pt,width=45pt,name=a22]{}}}
&\cellcolor{verylightgray}&\cellcolor{verylightgray}
\\
\hline
Subtotal  &{\mbox{\TextField[maxlen=40,keystroke={AFNumber_Keystroke(2,
0, 1, 2, true);},align=2,height=10pt,width=45pt,name=subtotal,
calculate={AFSimple_Calculate("SUM" , new Array ( "a1", "a2", "a3",
"a4", "a5", "a6", "a7", "a8", "a9", "a10", "a11", "a12", "a13", "a14",
"a15", "a16", "a17", "a18", "a19", "a20", "a21", "a22" ) ;)},
]{}}} &\cellcolor{verylightgray}&\cellcolor{verylightgray}
\\
\hline
 Less accountable advance
&{\mbox{\TextField[maxlen=40,keystroke={AFNumber_Keystroke(2, 0, 1, 2,
true);},align=2,height=10pt,width=45pt,name=advance]{}}}
&\cellcolor{verylightgray}&\cellcolor{verylightgray}

 \\
\hline
Total Refund:  &{\mbox{\TextField[maxlen=40,keystroke={AFNumber_Keystroke(2,
0, 1, 2, true);},align=2,height=10pt,width=45pt,name=total]{}}}
&\cellcolor{verylightgray}&\cellcolor{verylightgray}\\
\hline
\end{tabular}

\begin{tabular*}{\textwidth}{ll}
\rowcolor{verylightgray}
Document Number:\ \underline{\ \ \qquad\qquad\qquad\qquad\qquad}
&Date: \ \underline{\ \ \qquad\qquad\qquad\qquad\qquad}
\end{tabular*}


\end{Form}



\end{document}
------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/




More information about the MacOSX-TeX mailing list