2

My code is here:

\documentclass{article}
\usepackage[linkcolor=black]{hyperref}
\begin{document}
\begin{Form}
\renewcommand*{\LayoutCheckField}[2]{#2 #1}
We want to build up a statistical model to predict tution fees of students. We will use these information to build up the model. Your privacy must be ensured. Please help us for developing the model by giving your information mentioning below-\\\\

\TextField[name=name,align=0]{Name:}\\\\
  \ChoiceMenu[radio,name=year]{Year:}{1st,2nd,3rd,4th,MS}\\\\
  \ChoiceMenu[radio,name=university]{University:}{DU,BUET,DMC,JU,JNU}\\\\
  \TextField[name=dept.]{Department:}  \ChoiceMenu[radio,name=section]{Section:}{Science,Arts,Commerce}\\\\
  \ChoiceMenu[radio,name=hsscsection]{HSC Section:}{Science,Arts,Commerce}\\\\
  \TextField[name=hsscCollege]{HSC College:}\\\\
  \TextField[name=hall]{Hall:}\ChoiceMenu[radio,name=hall]{}{mess,Basha}\\\\
  \TextField[name=homedistict]{Home District:}\\\\
  \ChoiceMenu[radio,name=foccupation]{Father's occupation:}{Farmer,Job holder,Businessman}\\\\
  \ChoiceMenu[radio,name=moccupation]{Mother's occupation:}{Housewife,Job holder}\\\\
  \TextField[name=familymembers]{Family members:}\\\\
  \TextField[name=earningmembers]{No. of earning members:}\\\\
  \TextField[name=birthposition]{Birth Position:}\\\\
  \ChoiceMenu[radio,name=texperi]{Experienc as tutor:}{no,1y,2y,3y,4y,4up}\\\\
  \ChoiceMenu[radio,name=scholarship]{Getting scholarship per month:}{0.00,1-2,2.1-3.0,3.1-4.0,4.1-5.0,5up}\\\\
  \ChoiceMenu[radio,name=takingmoneyhome]{Getting money per month from home:}{0.00,1-2,2.1-3.0,3.1-4.0,4.1-5.0,5up}\\\\
  \TextField[name=tourcount]{Number of tour per year:}\\\\
  \ChoiceMenu[radio,name=meal]{From where taking meal:}{Hall dyning/mess, Hall canteen, hotel,Basha}\\\\
  \ChoiceMenu[radio,name=GF]{Having GF?}{yes,no}\\\\
  \ChoiceMenu[radio,name=smoker]{Smoker?}{yes,no}\\\\
  \ChoiceMenu[radio,name=readd]{Having readdmission?}{yes,no}\\\\
  \ChoiceMenu[radio,name=result]{Result:}{\textless 2.5,<3.00,<3.5,<4.00}\\\\

\end{Form}
\end{document}

This code results:

Underfull \hbox (badness 10000) in paragraph at lines 6--7


Underfull \hbox (badness 10000) in paragraph at lines 6--7

(/usr/local/texlive/2016/texmf-dist/tex/latex/base/omlcmr.fd)
! TeX capacity exceeded, sorry [input stack size=5000].
\font@name ->
             \OML/cmr/m/n/10 
l.29 ...]{Result:}{\textless 2.5,<3.00,<3.5,<4.00}
                                                  \\\\
!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on questionaire.log.

The errors are occurred for using \textless. Now, how can I insert < and >?

  • 1
    \usepackage[T1]{fontenc} should help – user31729 Oct 3 '17 at 6:57
  • @ChristianHupfer I don't like to use T1 because of The default Computer Modern font does not support T1 see LaTeX wikibook chapter 9.5 – alhelal Oct 3 '17 at 8:26
  • 1
    Use another encoding then... – user31729 Oct 3 '17 at 8:27
  • 1
    Use $<2.5$,$<3.00$,$<3.5$,$<4.00$ instead. – Nicola Talbot Oct 3 '17 at 9:11
  • 2
    There is no reason not to use [T1] encoding. You still will get the same look. Try it out. (It is neverless interesting to find out, why \textless loops) – Ulrike Fischer Oct 3 '17 at 9:12
7

As default hyperref use the values not only as label for the fields, but also as export value for the form. This can be problematic if the values contains complicated commands meant for typesetting. In such cases you can set explicit (simpler) export values with a keyval syntax: The difference between the displayed text an the value can be seen if you add a button to show the value of the field (which also the one who would be exported or sent to a script):

\documentclass{article}
\usepackage{hyperref}

\begin{document}

\begin{Form}

\ChoiceMenu[radio,name=result,default=A]{Result:}{\textless 2.5=A,\textless 3.5=B,\textless 4.5=C}

\medskip     
\PushButton[onclick={app.alert("The value is " + this.getField("result").value)}]{Submit}
\end{Form}
\end{document}

enter image description here

  • is your solution better than Nicola Talbot comment? – alhelal Oct 3 '17 at 13:04
  • It is more generic. – Ulrike Fischer Oct 3 '17 at 13:58
  • if you described more your answer, then it might be helpful for beginners including me. – alhelal Oct 3 '17 at 14:01
  • I added an edit. – Ulrike Fischer Oct 3 '17 at 14:33
  • 1
    @GuM The official hyperref documentation is very sketchy as far as PDF forms are concerned, but @NicolaTalbot's freely accessible book contains a nice overview. – diabonas Oct 3 '17 at 17:57

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.