To print dictionary data, you must first define the layout of your print output in format files that you edit with a text editor. In the format print file you define the entry fields to be printed and how to arrange them in the printout. For general information on printing, seeÂ Printing a dictionary.
Sample format files
OpenTM2Â provides several sample format files. The following contains an introduction to format file statements.
The print program assumes a page size with a default of 72 lines per page. To modify this layout you can insert printer-specific characters in the format files according to the syntax provided.
This format file prints each headword and its translation. It uses the following format statements to achieve this:
Part of FORMAT1.FRM
<entryprt> ======================= <var name=Translation> </entryprt>
Between <entryprt> and </entryprt> you specify which entry fields you want to be printed for each entry. The names following var name= must be the same names that are defined as entry field names in the dictionary you want to print. To see which entry field names are in a dictionary, selectÂ Propertiesâ€¦Â from theÂ FileÂ menu when the “Dictionary List” window is active and the respective dictionary selected.
<var name=Translation> means that the translation for the headword is printed. If there is more than one translation, only the first translation is printed.
Nontagged information that you type between the <entryprt> and </entryprt> tags is printed for each iteration. In the example above, the ========== is used as a separator line between the entries on your printout.
The following is an example of what your dictionary printout would look like. Assume that the dictionary is English-German and the sample format FORMAT1.FRM has been used for formatting. Two entries (rule and run) are extracted.
======================= rule regieren ======================= run laufen
This format file prints the templates for each entry without formatting. A template is all entry field information on all levels (entry level, homonym level, sense level, and target level) relating to one specific translation of a headword. The following is an illustration of a dictionary entry.
FORMAT2.FRM looks as follows:
Part of FORMAT2.FRM
<entryprt> ======================= <var name =Headword> <repeat name=Headword> <var name='Part of Speech'> <var name=Translation> <var name=Abbrev./Fullform> </repeat> </entryprt>
<var name=Headword> means that the headword is printed. <repeat…> means that the Part of Speech, the Translation, and the Abbrev./Fullform entry fields are printed until a different headword is found. If the fields for Part of Speech, Translation, or Abbrev./Fullform in the dictionary are not filled, an empty line is printed.
The following sample shows how your dictionary printout would look. Assume that the dictionary is English-German and the sample format FORMAT2.FRM has been used for formatting. Two entries (rule and run) are extracted.
======================= rule verb regieren rule noun Regel ======================= run verb laufen run noun Lauf
This format file prints all templates for each entry.
It is designed to be formatted with BookMasterÂ (R)Â outsideÂ OpenTM2before you print it. If you print the file without BookMasterÂ (R), you see a mixture of dictionary entry data and BookMasterÂ (R)Â tags. Formatting with BookMasterÂ (R)Â produces a printout resembling entries in printed dictionaries.
The tags used in this format file are described inÂ Tags for defining the format of a dictionary printout. You must use them in the same sequence as listed there.
This format file prints a dictionary extract with the following structure:
- A front page showing the title of the printed dictionary, the date, and the author.
- The major part containing the dictionary entries with the fields specified by you. The sample contains the fields Translation, Part of Speech, Subject Code, and Context.
- A header section for each page with the name of the dictionary and the first headword on each page.
- The bottom of each page displaying the current page number.
FORMAT4.FRM contains comments on most of the tags used. It is recommended that you read these comments to understand the results the tags produced on the printout.
If you want to see the results of such a printout, print dictionary DICTPRT, which is contained in sample folder SAMPLPRT.
Note:Â You must first import SAMPLPRT intoÂ OpenTM2.
Defining your own format file
To print a dictionary or an extract from it, you can use one of the format files provided byÂ OpenTM2. You find them on the drive where you installedÂ OpenTM2in the subdirectory \eqf\prtform.
These format files provide a predefined layout for printing dictionary information. They serve as sample files. You must replace all the generic information they contain with your personal data, such as your address, and your name. It is useful to select a format file that contains entry fields that match those of the dictionary you want to print.
To get an idea of how the printout will turn out when using one of these format files, read the explanation that is given after the <comment> tag in each file. However, if you want to print a dictionary with a layout other than those provided, you can define your own format file. You do this as follows:
- Copy one of the format files provided or create a new file. It must be in ASCII format.
- Give it the extension frm (for example, myform.frm).
- Edit this file with a text editor of your choice. You can use any of the tags given inÂ Tags for defining the format of a dictionary printoutÂ to create an individual layout.
- Place this file in the subdirectory \eqf\prtform on the drive where you installedÂ OpenTM2.
- Use the new file name as format file name in the “Print Dictionary” window.
The selected dictionary is printed on the printer that is defined as LPT1 in your operating system (default setting).
The following is an example of an individual format file and how it looks on the printout.
<comment> This is my private format file. It prints entries from dictionary MYDICT in the following way. The front page gives administrative information about the printout, such as title, date, and my name. Then two entries of MYDICT follow. These entries contain the fields I specified: Part of Speech, Translation, Synonym, and Context. Each page has the dictionary name MYDICT in its header section. The page number is printed at the bottom of each page. </comment> <set sysname=$page_length value='61'> <set sysname=$page_eject value=' '> <dictfront> Title: Dictionary <var sysname=$Dictname> Date: <var sysname=$Date format=dd.mm.yyyy> Author: Betty Miller </dictfront> <pagehead> <var sysname=$Dictname $Min=45 $Right> <var name=headword $first_on_page> ================================================================= </pagehead> <entryprt> The term "<var name=Headword>" has the following meaning: <repeat name=Headword> Part of Speech: <var name='Part of Speech'> <repeat name='Part of Speech'> Translation: <var name=Translation> Synonym: <var name=Synonym> Context: <var name=Context> </repeat> </repeat> </entryprt> <pagefoot> ================================================================= - <var sysname=$Page_No> - </pagefoot>
If you used this format file when printing dictionary MYDICT, you would get a printout with the following information on its title page:
Title: Dictionary MYDICT Date: 04/01/94 Author: Betty Miller
After the title page, the entries found are printed in the following way:
MYDICT assist ================================================================= The term "assist" has the following meaning: Part of Speech: verb Translation: helfen Synonym: Context: Translation: assistieren Synonym: Context: to assist sb The term "access" has the following meaning/s: Part of Speech: noun Translation: Zugriff Synonym: Context: Translation: Zutritt Synonym: Context: Part of Speech: verb Translation: zugreifen Synonym: Context: ================================================================= - 1 -
Tags for defining the format of a dictionary printout
Each data element to be printed is defined between a start and an end tag (except for <set> and <var>). The end tag always starts with â€œ</â€. If you use any multiword terms as entry-field names, for example, Part of Speech, you must enclose them in single quotes (for example: <var name=’Part of Speech’>). You may type these tags in either uppercase or in lowercase letters. Some of the tags have attributes (<set…>, <repeat…>, <var…>).
You can control the layout of your printout by placing the variables at the appropriate position. The printing of a text or a data element starts where the opening pointed bracket (<) has been placed.
|Start tag, end tag||Meaning|
|<description>,</description>||Here you can describe what your printout contains. These tags are optional and have no effect on the layout of your printout. This description is shown in the “Print Dictionary” window.|
|<dictfront>,</dictfront>||Contains administrative information related to the printed dictionary, such as the name of the dictionary and the date of printing. This information is printed once at the beginning of your printout before any entries are printed. These tags are optional.|
|<pagehead>,</pagehead>||Here you can specify the information that you want to be printed on the top of each printed page. These tags are optional.|
|<entryprt>,</entryprt>||Here specify the structure and contents of the entries you want to be printed. These tags are mandatory.|
|<pagefoot>,</pagefoot>||Here you can specify the information that you want to be printed at the bottom of each printed page. These tags are optional.|
|<dictback>,</dictback>||Contains information related to the printed dictionary. This information is printed at the end of your printout after all entries have been printed. These tags are optional.|
Within the format files the tags must follow the same sequence as specified here. To modify the layout of your printout, you can use the following additional tags:
|Start tag, end tag||Meaning|
|<comment>,</comment>||Here you can specify information that you do not want to appear on your printout. These tags are optional. They can occur anywhere within a format file, but not between another start and end tag.|
|<set…>||This tag lets you specify the length of a line and the length of a page of your printout. It can occur anywhere within a format file, but not between another start and end tag. For more information, seeÂ The <set…> attributes.|
|<repeat…>,</repeat>||The information specified here is repeated until all information belonging to the specified entry field is printed. These tags are optional and can only occur between <entryprt> and </entryprt>. For more information, seeÂ The <repeat…> attributes.|
|<var…>||This tag can have the attribute â€œname=â€. It can occur only between the <pagehead>, <pagefoot>, and <entryprt> tags and their end tags.If it has the attribute â€œsysname=$…â€ it can occur only between the <dictfront>, <pagehead>, <entryprt>, <pagefoot>, and <dictback> tags and their corresponding end tags. For more information, seeÂ The <var…> attributes.|
The <set…> attributes
- Specifies the length of a single line on your printout. If you do not use this attribute, 80 characters per line are printed. This attribute must be used together with the value attribute, for example:
<set sysname=$line_length value='70'>
- Specifies the number of lines that are to be printed per page. If you do not use this attribute, 72 lines per page are printed. If your printer prints less than 72 lines per page, you must specify the correct number here. This attribute must be used together with the value attribute, for example:
<set sysname=$page_length value='62'>
- Specifies which page number is to be printed on the first page of your printout. If you do not use this attribute, the starting page number is 1. This attribute must be used together with the value attribute, for example:
<set sysname=$page_no value='7'>
- Specifies a character string that is inserted when the printer is supposed to make a page eject. You must specify the value that is used by your printer, otherwise no page eject is made. Refer to your printer manual for the page eject character that is used by your printer (for example the â™€ character = ASCII character 12). If you do not use this attribute, no character is used. An automatic page eject is done within the <dictfront> and <dictback> section. This attribute must be used together with the value attribute, for example:
<set sysname=$page_eject value='â™€'>
- This attribute is mandatory. It must be used in combination with the attributes listed here for the <set…> tag. You use it to specify the line length, the page length, the page number, and the page eject string.
The <repeat…> attributes
- Specifies that the information between <repeat…> and </repeat> is repeated as long as the contents of theÂ xxxÂ entry field is the same while processing the templates of an entry.
- Specifies that the information between <repeat…> and </repeat> is repeated as long as the contents of all fields of the specified level is the same. For a description of the individual levels, refer toDictionary entry structure.
The <var…> attributes
- Specifies which entry field (xxx) of a dictionary entry is to be printed. It can be used together with one of the following attributes:
- Prints the content of the specified entry field when a page is started. This lets you put the headword in the pagehead section. For example:
<var name=headword $first_on_page>
- Prints the contents of the specified entry field when a page is finished. This lets you put the headword in the pagefoot section. For example:
<var name=headword $last_on_page>
- Makes a reset within one entry going from the end of one template to the beginning of the same template again. This lets you process the same template again, printing different information. For example:
<var name=headword $same_entry_again>
- Does not print the contents of the specified entry field. You can use it in combination with $same_entry_again when only a reset is needed, but no information is to be printed. For example:
<var name=headword $no_display>
- Specifies the name of the file your printout is to be written to.
- Specifies the name of the dictionary that you selected for printing.
- Prints the current date at the specified position.
- Prints the current time at the specified position.
Specifies the format of the date and time information. This attribute is mandatory for sysname=$date and sysname=$time. For example:
<var sysname=$date format='dd.mm.yy'> or <var sysname=$time format='hh:mm:ss'>
- Prints the current page number.
- Makes a page eject at this position.
- Specifies the maximum number of characters that is to be printed from the information in the specified entry field. If the information exceeds the specified number of characters, the rest is not printed.
- Specifies the minimum number of characters to be printed from the information in the specified entry field. This tag lets you define a minimum amount of space for an entry field. You may want to use it if you wish to print the contents of entry fields in two columns. If the information in the entry field is less than the specified number of characters, the rest is filled with blank characters.If both $max and $min are specified, the value for $min must be lower or equal to the value of $max.
- The printed text of the specified entry field is justified at the left edge. This attribute only works in combination with the $min attribute. For example:
<var sysname=$dictname $min=45 $left>
- The printed text of the specified entry field is justified at the right edge. This attribute only works in combination with the $min attribute. For example:
<var sysname=$dictname $min=45 $right>