The formular Package.∗Hans-Christoph [email protected]/06/15This package provides some commands useful for typesetting fields informulars which are intended to be filled either manually or using TEX.% Copyright 2001 Hans-Christoph Wirth ([email protected])%% This program/package may be distributed and/or modified under the% conditions of the LaTeX Project Public License, either version 1.2% of this license or (at your option) any later version.% The latest version of this license is available at% http://www.latex-project.org/lppl.txt% and version 1.2 or later is part of all distributions of LaTeX% version 1999/12/01 or later.%% The quintessence of LPPL is:% - Distribute the package only in its full contents% - If you modify any files, rename them before%% This program/package consists of the files% formular.ins (driver file)% formular.dtx (source and documentation)% formular.sty (actual style file, generated)% formular.dvi (documentation, generated)1 ExamplesWhen typesetting forms there often arises the need for defining fields which con-sists of one or more lines where the customer can write something down manually.To support a unique appearance of those fields we contribute some commandswhich define general fields.1.1 One-line FieldsThe following piece of code declares and uses a simple one-line field namef:∗This file has version number v1.0a – (c) 2001 by Hans-Christoph Wirth, dated 2005/06/15.1\newFRMfield{namef}{15mm}This is \useFRMfield{namef}[John]and \useFRMfield{namef}.The output is the following:This isJohnand .More complicated fields may have a description and a default content.\newFRMfield{namef}{15mm}[Name][nobody]This is \useFRMfield{namef}[John]and \useFRMfield{namef}and \useFRMfield{namef}[]and \useFRMfield{namef}[Fred Long Name]Notice that the field growths with the content:This isJohnNameandnobodyNameandNameandFred Long NameName1.2 Different StylesEach class of fields c an have its own font style. Additionally there is a ruledstyle implemented. In the following we declare two one-line fields with differentappearance:\newFRMfield{placef}{40mm}[Place]\setFRMfontfamily{cmr}\setFRMfontshape{it}\setFRMfontsize{12}\setFRMruledstyle\newFRMfield{sigf}{30mm}[Signature]\useFRMfield{placef}[Sometown], \useFRMfield{sigf}[U. N. Known]SometownPlace,U. N. KnownSignature1.3 Multi-line EnvironmentsThe following piece of code declares and use s two multi-line environments. Noticethat there are two styles: The description of the field may app ear on a separateline or not. Each environment has a description and a minimal number of lines.\setFRMbreakstyle\newFRMenvironment{env1}{Foobar}{2}2\setFRMinlinestyle\newFRMenvironment{env2}{Barfoo}{3}\begin{env1} This is break style \end{env1}\begin{env2} This is inline style \end{env2}This is break styleFoobarThis is inline styleBarfoo1.4 ContainersA container is a collection of fields. The container specifies which fields belong toit, and where the fields are to be printed. The following piece of code declares acontainer which contains three fields.\newFRMcontainer{Grades}{\setFRMruledstyle\newFRMfield{Ma}{30mm}[][////]\newFRMfield{Ph}{30mm}[][////]\newFRMfield{En}{30mm}[english grade][////]}{%\parbox[t]{0.45\linewidth}{\baselineskip18ptMaths \dotfill\ \useFRMfield{Ma}\newlinePhysics \dotfill\ \useFRMfield{Ph}}\hfill\parbox[t]{0.45\linewidth}{%English \dotfill\ \useFRMfield{En}}%}\begin{Grades}\setMa{excellent}\setPh{very good}\end{Grades}Maths . . . . .excellentPhysics . . . . .very goodEnglish . . . . .////english grade2 Command Description2.1 Style ParametersThe commands explained in this section select the ge neral appearance of the fields.A call to a command affects all fields which are declared subsequently (within thesame scope).3The command\setFRMrulewidth\setFRMrulewidth{hdimeni}sets the thickness of the underlining rules to hdimeni (default: 0.1pt). The in-struction \setFRMrulewidth{0pt} makes rules disappear.The command\setFRMrulesep\setFRMrulesep{hdimeni}sets the vertical distance between the font baseline and the underlining rules (de-fault: 2pt).The command\setFRMmargin\setFRMmargin{hdimeni}sets the horizontal indentation of the content of multi-line FRMenvironments (de-fault: 5pt).The command\setFRMbaselineskip\setFRMbaselineskip{hdimeni}sets the baselineskip of the content of multi-line FRMenvironments (default: 18pt).The \setFRMfont. . . commands select the font used for the content, and the corre-\setFRMfontencoding\setFRMfontsize\setFRMfontfamily\setFRMfontseries\setFRMfontshapesponding \setFRMdfont. . . commands select the font of the description of one-linefields. For a description of the me aning of the parameters we refer to command\usefont in standard LATEX2e documentation. Notice that \setFRMfontsize hasonly one parameter, since the baselineskip is selected with a separate command.All above commands can be supplied with an optional parameter specifying a(already declared) field. This enables to change the appearance of fields afterdeclaration. The following example illustrates this:\newFRMfield{foo}{3cm}\setFRMfontsize[foo]{20pt}To this end, there are some more commands which have only effect when thisoptional parameter is supplied:The commands\setFRMcontent\setFRMdescription\setFRMwidth\setFRMcontent[hfieldi]{hcontenti}\setFRMdescription[hfieldi]{hcontenti}set the (default) content and the description of the field, while\setFRMwidth[hfieldi]{hwidthi}changes the (minimal) width.42.2 One-line FieldsA FRMfield consis ts of three ingredients:1. The content of the field. This is a (maybe empty) one-line string.2. A horizontal rule. The length of the rule is at least the minimal width ofthe field, but it grows with the c ontent or the description. It is guaranteedthat the rule exceeds the content at least by the amount which is set with\setFRMmargin.3. The description. This is a (maybe empty) one-line string printed below therule.A FRMfield must be declared as follows:\newFRMfield\newFRMfield{hfield idi}{hwidthi}\newFRMfield{hfield idi}{hwidthi}[hdescriptioni]\newFRMfield{hfield idi}{hwidthi}[hdescriptioni][hdefault contenti]The field is associated with the style setting which is valid at this moment.When a field is declared, it can be used with the command\useFRMfield\useFRMfield{hnamei}\useFRMfield{hnamei}[hcontenti]If the hcontenti is not supplied to \useFRMfield, then the hdefault contenti isprinted.The macro \renewFRMfield is nearly the same as \newFRMfield, but it changes\renewFRMfieldan existing field rather
View Full Document