\magnification=\magstep1
\input nice
%%\input amiga	% amiga.tex is in the formatfile
\hsize = 5 in
\vsize = 7.7 in
\voffset = 0.4in

\def\mynum#1{\ifnum #1<10 0\the#1\else \the#1\fi}
\def\mymonth#1{\ifcase#1 \or January \or February \or March \or April
   \or May \or June \or July \or August
   \or September \or Oktober
   \or November \or December \fi}

\def \TeXPrt {\TeX Prt}

\book
\contentslevel=3
\contfill={\dotfill}
\contskip=7pt
\let\scstyle=\bf
\font\subsubsectiontitlefont=cmr10 scaled \magstep1

\titlepage
\vskip 1in
\title{\TeXPrt}
\removelastskip
\smallskip
\title{A front-end for printing DVI files}
\bigskip
\release{Version 2.00}
\smallskip
\release {\mymonth{\month} \mynum{\day}, \mynum{\year}}
\bigskip
\author{by}
\author{Richard B\"odi}
\vfill
\abstract{
   \TeXPrt{} is a GUI driven front end for DVI printer drivers.
   It is highly configurable and can be used with various DVI
   printer drivers such as DVIPrint (PasTeX by Georg He\ss{}mann),
   DVILJP (AmigaTeX) and many others. \TeXPrt{} allows you to
   easily select the pages you want to print (whole document,
   from page \# to page \#, odd pages, even pages), the number of
   copies, landscape or portrait printing mode, horizontal and vertical
   offsets, reverse printing of the pages, and four more user definable
   options. DVI printer drivers are defined by (ASCII) specification
   files. \TeXPrt{} has an ARexx port and interprets 18 commands.
}
\vskip 0.5in
\endtitlepage



\medskip
\plainsection{Contents}
\medskip
\makecontents
%%\newpage

\section{Copyright}

\TeXPrt{} is a ``freely distributable copyrighted software'',
i\thinspace e.\thinspace everyone may copy and use it, but the
copyright remains by myself (Richard B\"odi).

\TeXPrt{} may not be sold commercially without permission.
It may not be part of any PD series except Fred Fish's AmigaLibDisks.
Permission to modify the software is granted, but not the right to
distribute the modified code or only part of the files.

Thanks go to Georg He\ss{}mann for writing the PasTeX implementation
(I really enjoy it), Michael Balzer for designing ARexxBox (saved me a lot of time),
and Jan van den Baard for the GetFile BOOPSI gadget of the GadToolsBox
program (nice thingy). Last not least I want to thank Fred Fish for
the continuing release of his library disks. I'm afraid that the people at Commodore
don't have any idea of what Fred has done in the past to promote the Amiga. For me,
the quality of Fred's library disks has been one important reason for buying
an Amiga. And I never have repented it.


\section{Introduction}
\TeXPrt{} is a front end for DVI printer drivers, i.\thinspace e.\thinspace
it allows the user to control DVI printer drivers via a graphical user
interface. \TeXPrt{} supports the selection of the pages (whole document,
from page \# to page \#, odd pages, even pages), the number of
copies, landscape or portrait printing mode, horizontal and vertical
offsets, reverse printing of the pages, and provides four more user definable
options.

\section{Running \TeXPrt}

The \TeXPrt{} program can either be executed in a shell using parameters
or from Workbench using ToolTypes. When launched from Worbench, a DVI file
can be selected by first selecting the \TeXPrt{} icon, holding the SHIFT key,
and double clicking the desired DVI file. Having started \TeXPrt{}, the program
first looks for DVI driver specification files located in a subdrawer named
{\bf TeXDrivers}. If this drawer is empty or contains no valid specification file,
the program exits with an error message. For more information on DVI driver specification
files see the appropriate chapter below.

\subsection{Running \TeXPrt{} from the CLI}
\medskip
\settabs\+{\bf Format}:  {\tt TeXPrt} & \cr
\+ {\bf Format}: {\tt TeXPrt} & {\tt [SCREEN<PubScreen>] [SHELL<Device>]} \cr
\+ & {\tt [APPICON<Name of AppIcon>]} \cr
\+ & {\tt [XPOS<x position of AppIcon>]} \cr
\+ & {\tt [YPOS<y position of AppIcon>] [FILE<DVI file>]} \cr
\smallskip
\noindent {\bf Pattern}: {\tt TeXPrt SCREEN/K, SHELL/K, APPICON/K, XPOS/K, YPOS/K, FILE/K}
\medskip
Description of the command line options:
\smallskip
\staggered{\tt APPICON\ }
\key{\tt SCREEN}
   Specifies the name of the public screen on which \TeXPrt{} should open its
   window. Default is the default public screen.\hfill\break
   Example: {\tt SCREEN=ShowDVI-PubScr} opens the \TeXPrt{} window on the ShowDVI
   previewer screen (ShowDVI is the previewer of the PasTeX implementation).
\key{\tt SHELL}
   Specifies the shell from which the DVI printer driver should be launched.\hfill\break
   Example: {\tt SHELL=newwsh CNC:20/340/660/150/TeXPrt-Output} invokes the DVI
   printer driver from WShell using the CNC: device (a CNC: shell window
   has a scrollbar on the left). The default setting is
   {\tt newshell CON:0/0/640/150/TeXPrint-Output}.\hfill\break
   Note that you must not specify the SCREEN parameter in the shell! This is done
   by the SCREEN command. So don't use {\tt SHELL=CON://400/50/Title/SCREENShowDVI-PubScr},
   e.\thinspace g., use {\tt SCREEN=ShowDVI-PubScr SHELL=CON://400/50/Title} instead.
\key{\tt APPICON}
   Name of the AppIcon icon file (which must reside in the same directory as the
   \TeXPrt{} program). If no name is specified, no AppIcon will be generated.
\key{\tt XPOS}
   The x position of the AppIcon.
\key{\tt YPOS}
   The y position of the AppIcon.
\key{\tt FILE}
   The DVI file which should be printed.
\endstaggered

\subsection{Running \TeXPrt{} from Workbench}

When running \TeXPrt{} from Worbench a DVI file
can be selected by first clicking the \TeXPrt{} icon, holding the SHIFT key,
and double clicking the desired DVI file. The parameters are specified
by ToolTypes which can be edited by the Workbench's Info command.

\subsubsection{SCREEN Tooltype}
   Specifies the name of the public screen on which \TeXPrt{} should open its
   window. Default screen is the default public screen. If the specified
   public screen is not available, the \TeXPrt{} window will open on the default
   public screen.

\subsubsection{SHELL Tooltype}
   Specifies the shell from which the DVI printer driver should be launched.
   Note that you must not specify the SCREEN parameter in the shell! This is done
   by the SCREEN command. So don't use {\tt SHELL=CON://400/50/Title/SCREENShowDVI-PubScr},
   e.\thinspace g., use {\tt SCREEN=ShowDVI-PubScr SHELL=CON://400/50/Title} instead.

\subsubsection{APPICON Tooltype}
   Name of the AppIcon icon file (which must reside in the same directory as the
   \TeXPrt{} program). If no name is specified, no AppIcon will be generated.

\subsubsection{XPOS Tooltype}
   The x position of the AppIcon. This entry is ignored if no AppIcon
   icon file has been specified.

\subsubsection{YPOS Tooltype}
   The y position of the AppIcon. This entry is ignored if no AppIcon
   icon file has been specified.

\section{Selecting a DVI file}
A DVI file can be selected in six different ways.
\smallskip
\item{$\bullet$} During startup from a shell using the FILE keyword.
\item{$\bullet$} During startup from Workbench by
first selecting the \TeXPrt{} icon, holding the SHIFT key,
and double clicking the desired DVI file.
\item{$\bullet$} During runtime by selecting the string gadget named "DVI file"
and typing the name of the DVI file.
\item{$\bullet$} During runtime by pushing the GetFile gadget on the right of the
"DVI file" string gadget. The ASL file requester will appear and you may choose
your DVI file.
\item{$\bullet$} If \TeXPrt{} opens its window on the Workbench screen,
icons can be dragged into \TeXPrt's window. The name of the dragged icon
(including its path) is copied into the "DVI file" string gadget.
\item{$\bullet$} If you specified an AppIcon icon file, \TeXPrt{} creates an AppIcon
from that icon file, where other icons can be dragged onto. The name of the dragged icon
(including its path) is copied into the "DVI file" string gadget.

\section{The DVI driver specification file}
The information about the available DVI printer drivers is stored
in DVI driver specification files located in a subdrawer named {\bf TeXDrivers}.
During startup \TeXPrt{} scans this directory and looks for these
specification files. For every valid specification file an entry in the
Drivers menu is created.
If the TeXDrivers drawer is empty or contains no valid specification file,
the program exits with an error message.
An example specification file for the DVIPrint printer driver (PasTeX)
is given below. All entries are separated by a semicolon. While reading a
specification file, every double quote will be substituted by a white space.
This is important, because some DVI drivers take their arguments without a space
(-f1 -t10, e.g.), while others expect one (-f 1 -t 10, e.g.). Two consecutive
double quotes indicate that the corresponding command is not supported
by the printer driver (see Copies in the example below, e.g.) or that
no command switch is necessary (see Device in the example below).
If a command is not supported by the printer driver, \TeXPrt{} tries
to disable the appropriate gadget on its window. Note, however, that
disabling a gadtools MX-gadget is not supported by Kickstart 2.04, but is
supported by Kickstart 3.0 and up. \TeXPrt{} will use this
Kickstart 3.0 feature when executed under Kickstart 3.0.
\smallskip

{\tt
TeXPrt printer driver spec file \hfill\break
Name ; DVIPrint \hfill\break
Node ; Typesetting:Pastex/bin/DVIPrint \hfill\break
PageSel (DOCUMENT/FROMTO) ; DOCUMENT ; -f",-t","" \hfill\break
Copies ; 1 ; "" \hfill\break
PageType (ALL/ODD/EVEN) ; ALL ; "",-1,-2 \hfill\break
Reverse (ON/OFF) ; OFF ; -r \hfill\break
Orientation (PORTRAIT/LANDSCAPE) ; PORTRAIT ; "",-g \hfill\break
HOffset ; 0 ; -h" ; mm \hfill\break
VOffset ; 0 ; -v" ; mm \hfill\break
AdjHOffset ; 18 \hfill\break
AdjVOffset ; 16 \hfill\break
Option1 (ON/OFF) ; OFF ; DRAft ; Draft \hfill\break
Option2 (ON/OFF) ; ON ; -o ; Optimize \hfill\break
Option3 (ON/OFF) ; ON ; -T ; Fast \hfill\break
Option4 (ON/OFF) ; OFF ; -i ; IFF-ILBM \hfill\break
Device ; "" ; "" \hfill\break }
\medskip
The first line is used to indicate that this is a DVI driver specification file
(needed while scanning the {\bf TeXDrivers} drawer).\hfill\break
{\bf Name} specifies the string which will appear in the Drivers menu.\hfill\break
{\bf Node} contains the filename of the printer driver including the full path.
The path can be omitted if the printer driver is accessible via a global path.\hfill\break
The first entry after {\bf PageSel (DOCUMENT/FROMTO)} specifies the default setting when
this spec file is read by \TeXPrt. The second entry contains the parameters
(actually 3 parameters separated by a comma) of the printer driver to specify
from which page (-f) upto which page (-t) should be printed. The third parameter which is
not used (marked by "") in the file above determines the number of pages that should
be printed. Some printer driver use such kind of parameter instead of specifying
the last printed page directly (see the AmigaTeX spec file that comes with
this program). Note that
parameter strings may not contain any white space (use a double quote instead).\hfill\break
The {\bf Copies} keyword determines the number of copies that should be printed.
Note that, although the DVIPrint printer driver does not support printing multiple
copies of one file, this feature is emulated by \TeXPrt{} by repeatedly launching the
printer driver with the same DVI file. \hfill\break
{\bf PageType (ALL/ODD/EVEN)} sets the
type of pages that should be printed. Again the first entry specifies the default
setting while the second contains the parameter string (in the example above
there is no parameter for specifying ALL pages). \hfill\break
The {\bf Reverse (ON/OFF)} keyword
sets the default and parameter string for printing the pages in reverse order.\hfill\break
{\bf Orientation (PORTRAIT/LANDSCAPE)} determines the orientation of the printout.\hfill\break
{\bf HOffset} and {\bf VOffset} specify the horizontal and vertical offset of the
printout. The last entry of these lines specify the unit measures of the offsets.
These strings will be displayed on the right side of the HOffset and VOffset
string gadgets, respectively. Moreover, they will be appended to the command line
(for example, {\bf HOffset ; -5 ; -h" ; mm} produces the command line {\bf -h -5mm}).\hfill\break
{\bf AdjHOffset} and {\bf AdjVOffset} are used to preadjust the horizontal and
vertical offsets. This is necessary, because on different printers the margins
may be different too. \TeXPrt{} simply adds AdjHOffset to HOffset and
AdjVOffset to VOffset and these sums are used as offsets when the printer driver
is called.\hfill\break
The next four lines {\bf Option\# (ON/OFF)} define user configurable boolean gadgets.
The first two entries set up the default state of the boolean gadget and the
parameter string. The last entry is used as a label for the gadget. \hfill\break
The last line of the spec file which starts with {\bf Device} determines the
output device (for example, par:) and the parameter string.

\section{The "texprint" environment variable}

To determine which printer driver should be preloaded when starting
\TeXPrt{}, the environment variable {\tt TEXPRINT} is used.\hfill\break
Example: {\tt\ \ \ setenv TEXPRINT "DVIPrint"} sets the DVIPrint driver
as the default driver.\hfill\break
If the environment variable {\tt TEXPRINT}\ is not set or if the specified
printer driver cannot be found in the {\bf TeXDrivers} directory, the first
entry which has been scanned is preloaded.

\section{Menu description}
The \TeXPrt{} program has two menus, namely the Config menu and the Drivers menu.

\subsection{The Config menu}
\staggered{\tt Save As \quad}
\key{\tt Save}
   Saves the current settings of the GUI to the current
   printer driver specification file.
\key{\tt Save As}
   Saves the current settings of the GUI to a user
   selectable file. This allows you to easily create new specification file.
   For example, you can define more than one specification file for a single
   printer driver containing different default values.
\key{\tt About}
   Displays the program version, a brief description of the program and
   my address.
\key{\tt Quit}
   What do you think?
\endstaggered

\subsection{The Drivers menu}
Contains the names of all DVI printer driver specification files found in the
{\bf TeXDrivers} drawer. Note that the number of spec files is limited
by the vertical size of the screen on which the \TeXPrt{} program will open its window.
The maximum length of the driver names is 64, although it may happen that
the menu cannot be created with large names of less than 64 characters.
In both cases \TeXPrt{} will exit and report that the menu structure could
not have been built. So make sure that neither there are too many
spec files in the {\bf TeXDrivers} drawer nor that the driver names are too long.

\section{ARexx}
\TeXPrt{} has built in an ARexx port for receiving messages.
The name of the port is {\bf TeXPrtPort}.

\subsection{The TexPrtInit.tpr and TexPrtPrint.tpr macro files}
There are two ARexx command files named {\bf TexPrtInit.tpr}
and {\bf TexPrtPrint.tpr}. The first one of these is executed during startup
in the case where \TeXPrt{} detects that a message port named {\bf TeXPrtPort}
is already open. The TexPrtPrint.tpr which I have included simply pops to front
the public screen and \TeXPrt's window. The second
file TexPrtPrint.tpr is executed when you have confirmed the printout.
If ARexx is running on your machine this is all what is done when the printout
is confirmed. So if you really want to launch the printer driver in this case,
you must send \TeXPrt{} the
command {\tt PRINT} via ARexx. I have chosen this mechanism for flexibility reasons.
For example, the TexPrtPrint.tpr ARexx macro that comes with this archive
looks if the ShowDVI previewer is running, and if so, it requests the current
DVI file from the ShowDVI program and sends it to \TeXPrt{}. After that
it sends a {\tt PRINT} command to \TeXPrt{} to launch the printer driver.
If ARexx is not running or if you don't have ARexx (which I can't believe),
the printer driver is launched directly without using ARexx.

\subsection{ARexx commands}
There are 18 commands which \TeXPrt{} can interpret:
\medskip

\noindent{\tt CONFIG SAVE/S,SAVEAS/K} \par
   CONFIG SAVE saves the current setting of the GUI to the current selected
   printer driver spec file. CONFIG SAVEAS $<$filename$>$ saves the current setting
   of the GUI to the giver filename.
\smallskip
\noindent{\tt COPIES NUMBER/A/N} \par
   COPIES $<$nn$>$ places the number nn of copies into the "\# of Copies" string gadget.
\smallskip
\noindent{\tt DRIVER NUMBER/A/N} \par
   DRIVER $<$nn$>$ selects the driver number nn (given in the same order as they appear
   in the Drivers menu). Numbering begins with 1, not with 0.
\smallskip
\noindent{\tt DVIFILE FILE/A} \par
   DVIFILE $<$filename$>$ selects the name of the DVI file which should be printed.
\smallskip
\noindent{\tt FROM\_TO DOCUMENT/S,FROM/N/K,TO/N/K} \par
   FROM\_TO DOCUMENT selects printing of the whole document.
   FROM\_TO FROM $<$nn$>$ sets the start of printing to page nn.
   FROM\_TO TO $<$nn$>$ sets the end of printing to page nn.
\smallskip
\noindent{\tt HOFFSET MM/A/N} \par
   HOFFSET $<$nn$>$ sets the horizontal offset to the value nn.
\smallskip
\noindent{\tt OPTION1 ON/S,OFF/S} \par
\noindent{\tt OPTION2 ON/S,OFF/S} \par
\noindent{\tt OPTION3 ON/S,OFF/S} \par
\noindent{\tt OPTION4 ON/S,OFF/S} \par
   OPTION\# ON selects the appropriate command, OPTION\# OFF deselects it.
\smallskip
\noindent{\tt ORIENTATION PORTRAIT/S,LANDSCAPE/S} \par
   ORIENTATION PORTRAIT sets portrait printing mode,
   ORIENTATION LANDSCAPE sets landscape printing mode.
\smallskip
\noindent{\tt PAGES ALL/S,EVEN/S,ODD/S} \par
   PAGES ALL sets the mode of printing to all pages,
   PAGES EVEN prints only even pages, PAGES ODD only odd pages.
\smallskip
\noindent{\tt PRINT} \par
   PRINT launches the specified printer driver with a set of parameters
   given by the values of the corresponding gadgets on \TeXPrt's window.
   \smallskip
\noindent{\tt QUIT FORCE/S} \par
   QUIT pops up the exit confirment requester. QUIT FORCE quits the program
   immediately.
\smallskip
\noindent{\tt REVERSE ON/S,OFF/S} \par
   REVERSE ON enables reverse printing of the pages, REVERSE OFF disables it.
\smallskip
\noindent{\tt TOBACK} \par
   Brings to front the public screen on which \TeXPrt{} resides and also pops
   to front \TeXPrt's window on that screen.
\smallskip
\noindent{\tt TOFRONT} \par
   Pushes to back \TeXPrt's window.
\smallskip
\noindent{\tt VOFFSET MM/A/N} \par
   VOFFSET $<$nn$>$ sets the vertical offset to the value nn.

\section{Required software and hardware}
$\bullet$ An Amiga, of course. \hfill\break
$\bullet$ A printer, if available. \hfill\break
$\bullet$ Kickstart 2.04 or higher. \hfill\break
$\bullet$ ARexx (optional). \hfill\break
$\bullet$ A proper environment variable (optional). \hfill\break
$\bullet$ A DVI printer driver. \hfill\break
$\bullet$ A DVI file to print. \hfill\break
$\bullet$ A \TeX nician (optional). \hfill\break

\vskip 3cm

If you have any remarks (if you like the program or if not) or suggestions
for improvements feel free to contact me:
\bigskip

Richard A. B\"odi \par
Mathematisches Institut \par
Universit\"at T\"ubingen \par
Auf der Morgenstelle 10 \par
72076 T\"ubingen \par
GERMANY \par
\medskip
e-mail (Internet) : mmisa01@mailserv.zdv.uni-tuebingen.de\par

\bye
