\documentstyle[select]{article} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% Copyright (C) 1992 by Zden\v{e}k Wagner. All rights reserved. %% %% IMPORTANT NOTICE %% %% You are NOT ALLOWED to delete this notice. You are NOT ALLOWED to take %% money for the distribution or use of this file (or a changed version) %% except for a nominal charge for copying etc. %% %% If you change or add something, you are obliged to comment it in such a %% way that anyone could restore the original version. %% %% Error Reports and suggestions for improvements to: %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \typeout{--- >>>FillForm.TeX<<< --- Copyright (C) 1992 by Z.Wagner} \typeout{.........................................................} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % This file is used to fill in forms, questionnaires, etc. with \LaTeX. % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % At the very beginning of the file, we define the page layout options so % % that the whole page is available. No headers, footers, side margins and % % similar stuff are allowed. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \oddsidemargin -1in \evensidemargin -1in \textwidth 21cm \textheight 31cm \marginparwidth 0pt \marginparsep 0pt \topmargin -1in \headsep 0pt \footskip 0pt \headheight 0pt \footheight 0pt \parindent 0pt \pagestyle{empty} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % The following macro is called from SELECT.STY. (Please, try FAIRYSEL.TEX, % if you want to see an example, how to use SELECT.STY.) The description % inside this comment is used for beginners who would like to change this % file to suit their personal needs. TeXperts would understand this simple % code without my explanations. % % You need to do only two things to make this file work for you. First, you % might like to change \unitlength to some other unit. It is not advisable to % use large units as 1cm or 1in or even larger because you would be unable to % control positionning. The second think, which might require modification, % is the definition of the {picture} environment. The form of the command % applicable to this file is: % % \begin{picture}(W,H)(0,-Y) % % Here, W and H are the available width and height of the paper, % respectively (expressed in terms of \unitlength). Assuming that the area of % height T on the top of the paper is not available (due to printer hardware) % when feeding it manually, then Y = H + T. For STAR LC 24--10, H = 260mm, % T = 20mm, thence using \unitlength of 1mm we get % % \begin{picture}(210,260)(0,-280) % % You may measure the available space used by your printer by printing % TESTPAGE.TEX, which, I hope, is widely available. % % Now you want to commence filling-in your form. You can print only one % page per file. The name of the fill-in document is transferred between % \LaTeX passes using the mechanism of SELECT.STY. You have to delete % FILLFORM.SEL if you want to work with other document. The fill-in document, % however, remains on the hard disk. If you enter the name of the existing % document, it is loaded from the disk and doesn't allow interactive input. % This enables you to prepare and preview several pages of fill-in documents, % preview them and then print them. % % As mentioned above, the input is interactive within the first pass. The % input is stored in the file of the specified name and then processed. If you % are not satisfied with what you entered, you may edit the file without the % necessity of re-typing all entries. % % The first question, you are asked, is the request for the name of the % fill-in document. Please notice that the macrocode adds the `default' % extension `.frm'. You may specify path (but use `/' as separators, not % MS--DOS's `\'!) but extension must not appear in your entry. If the file % exists, it is loaded. If not, interactive questions are asked. % % Take the form to be filled in and your ruler. you must supply `Left % distance', which is the distance of the lower left corner of the input % field from the left edge of the paper (of course in \unitlength), `Upper % distance', which is the distance of the lower left corner of the input % field from the upper edge of the paper, `Width', which is the width of the % input field, and `Height', which is the height of the input field. % Afterwards, the file requests the alignment. The text is always aligned % with the bottom of the input field. As default, it is centered. You can % enter `l' for left or `r' for right alignment, respectively. Entering the % text needs some precautions. Your interactive input is written to the file % and then processed using standard \input command. Therefore, all control % sequences (those words starting with `\') must be preceded by `\string', % otherwise \TeX would run out of memory. I this case, you do not need Wizard % as suggested in the error message. You just need to use \string, e.g. % \string\today for date. Remember that \TeX eats up all spaces after the % control sequence. Thence `\string\it John Wilkiesbood' will produce % `undefined control sequence \itJohn' when the frm-file is processed. To % prevent such errors, you must enter `\string\it{}John Wilkiesbood'. Anyway, % once you make such an error, the easiest way to recover is to edit the % frm-file and re-\LaTeX FILLFORM.TEX. % % Type `y' if there are more items to be input or `n' if everything is % done. Afterwards, the file is closed and then input and processed. Just % before inputting your file, FILLFORM.SEL asks the question: % % Show frames? (y/n) % % If you answer `y', all entries will be framed. Thence you can verify in % preview that all entries fit inside the space available. When everything is % O.K., rerun FILLFORM.TEX without frames. % % If there is something wrong in your fill-in document, edit the frm-file % and then rerun FILLFORM.TEX. Your document will automatically be loaded. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\selection{% \typein[\fillin]{Enter the name of the fill-in document} \writeline{\string\def\string\y{y}} \writeline{\string\typein[\string\frames]{Show frames? (y/n)}} \writeline{\string\ifx \string\y\string\frames \string\let\string\formbox=\string\framebox \string\else} \writeline{\string\let\string\formbox=\string\makebox \string\fi} \writeline{\string\input{\fillin.frm}} \openin1 \fillin.frm \ifeof1 \typeout{No file \fillin.frm} \newwrite\form\relax \immediate\openout\form=\fillin.frm\relax \immediate\write\form{\string\setlength{\string\unitlength}{1mm}} \immediate\write\form{\string\begin{picture}(210,260)(0,-280)} \newcount\nextctr \nextctr=1 \def\next{y} \def\no{n} \loop \ifnum \nextctr > 0 \typein[\x]{Left distance} \typein[\y]{Upper distance} \typein[\w]{Width} \typein[\h]{Height} \typein[\pos]{Position} \typein[\text]{Text} \immediate\write\form{\string\put(\x,-\y) {\string\formbox(\w,\h)[b\pos]{\text}}} \typein[\next]{Next item? (y/n)} \ifx\no\next \nextctr=0 \fi \repeat \immediate\write\form{\string\end{picture}} \immediate\closeout\form \else \closein1\relax \fi } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Now we begin the document, make selection (which calls \selection defined % above) and finish. There's nothing else to be done. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document} \makeselection \end{document}