This site will look much better in a browser that supports web standards, but it is accessible to any browser or Internet device.

Printing from UNIX »

Contents

Introduction

This document lists all printing services which are available for UCI ICS UNIX users. It also briefly describes which text formatting, typesetting, previewing, and related programs are available and how to obtain documentation for them. Although use of the ICS line printer is described, the focus of this document is on the department's laser printers.

Available Printers and Printer Queues

Available Printers

  The department owns a Data Products B600 line printer which is housed in the Academic Computing Services Machine Room (CS 308). This printer can print upper and lower case on normal   (132-column green bar) or diablo   (white, 8-1/2 by 11) paper. Although there are is a separate queue for each type of paper, both queues are actually serviced by the same printer. Jobs sent from instructional machines are normally placed in bins in CS 308, sorted by user name. If your output isn't there, ask the operator.

In addition, the department owns quite a few laser printers.

Printer Queues

  Each printer owned by the department is served by a queue whose name is the same as that of the corresponding printer. The UNIX programs which manipulate the queues are lpr, lpq, and lprm      . They queue jobs, examine the queues, and remove jobs from the queues, respectively. The queues are maintained in arrival order. If there is a problem with your job, either you will be sent mail containing the error message(s) which were produced or, more commonly, the messages will appear on the header page produced by the job.

By default, files spooled with the lpr  command are sent to the queue named lp, which is an alias for the normal lineprinter queue. Files spooled with any Imagen printer command ( itroff, ditroff, dvisp, imprint, and ipr)       are directed to the default Imagen laser printer (see Section 7.3). Files spooled with the command qpr are sent by default to the PS-2000, of which there is currently only one.

You may select which queue your job is sent to by using the -P flag on each of the spooling commands described in this document. This flag is immediately followed by the name of the printer/queue. For example, to send to the diablo forms queue, you would add

-Pdiablo

to your normal lpr  command. See Section 7.3 for information on changing the default printer.

Laser Printer Control and Adding Paper

Normally, you should never need to type any commands on the consoles of the laser printers. If you suspect that something is wrong with a printer, you should find someone in the Support Group to take care of the problem.

You may, however, need to add paper to a printer on occasion. Adding paper to an 8/300   or other small laser printer is quite simple: remove the paper tray on the side of the printer, put in no more than 100 sheets of 20 lb. xerographic bond paper, and replace the tray.

Adding paper to the 3320  is almost as easy. Open its paper hopper on the right and add three reams (1500 sheets) of the xerographic bond paper. The two smaller trays of the 3320  should be filled with the appropriate types of paper (letterhead and ledger). They should be loaded face up, with the top of the paper toward the back of the printer. If new toner or a new cartridge is required, you should have a member of the Support Group take care of the problem.

Adding paper to the two small trays in the PS-2000 is just like adding it to the input trays of small printers, with letterhead paper in the top tray and ledger paper in the middle tray. To add paper to the large input bin, follow the instructions printed on the side of the bin: first press the button to lower the paper elevator, open the door, move the chain to one side, add the paper, re-center the chain over the center rear of the paper, and close the door.

Always remember to fan the paper before adding it to any laser printer. Doing so will help to prevent jamming.

Formatting and Typesetting

UNIX documentation is divided into two parts: ``man pages'' and ``documents.'' Each of the italicized commands listed in this document has a man page available giving information about how the program is used, what flags it takes, etc. UNIX documents, such as the one you are reading now, are longer than the man pages, and they tend to give more complete information and describe how different commands interoperate.

The ICS UNIX systems support a number of programs for text formatting and computer typesetting. The standard UNIX programs nroff  and troff  are available, which perform formatting and typesetting, respectively. Documentation on these programs is available in the standard UNIX documentation, available for copying in the documentation file cabinet outside the copy center. Various macro packages are available for use with these systems. Documentation on these packages is also available in the documentation cabinet outside the copy center . In addition to regular troff , a ``device-independent'' version developed by Brian Kernighan is available which supports graphics through the pic  preprocessor, discussed in Section 6.1 . Two documents on dtroff  are available in the documentation file cabinet outside the copy center: ``Typesetter-Independent Troff,'' by Brian Kernighan, and ``Using Dtroff at UCI,'' by Tim Morgan. Users normally do not execute troff  or dtroff  directly. Instead, they use the commands itroff  and ditroff  (for Imagen printers) and psroff  (for PS printers) which are described in Section 4.4.

Donald Knuth's typesetting system TeX  is also available along with several large macro packages. The primary document is The TeX book,  which is available through the UCI bookstore. The most popular macro package is the LaTeX  system, which also has a manual available through the bookstore: LaTeX: User's Guide and Reference Manual.  An ICS supplement to this manual, ``Using LaTeX at UCI,'' is available in the documentation cabinet outside the copy center . This is the ``local guide'' referred to in the LaTeX manual.  A number of other books and booklets are available on TeX and LaTeX, either through the bookstore or the TeX Users Group.

Printing and Previewing

ASCII Text

You may spool files for printing on the ICS lineprinter using the lpr  command. If you want normal (wide) forms, just type (assuming you have not set the PRINTER environment variable to override the default printer)

% lpr

The command imprint  is used to print ASCII text files on an Imagen printer. Normally it will pipe each file through pr . To disable this feature, use the -n flag. There are numerous other options to print two pages per physical page, to print material wider than 80 columns, to control the page height and offset, etc. Type

% man imprint

for additional information.

To print an ASCII  file on a POSTSCRIPT -only printer, it must first be converted to POSTSCRIPT using one of the commands a2ps, mp  , or mpage . The output from each of these programs is POSTSCRIPT which can then be sent to a POSTSCRIPT printer or directed to a file. A2ps  simply converts the ASCII input into POSTSCRIPT , while mp  generates a banner at the top and bottom of each page, automatically recognizes mail headers, can format its output in quite a few different ways, and can print in landscape mode. Mpage  can print 2, 4, or 8 logical pages of ASCII or POSTSCRIPT per physical page of output. If you have the PRINTER    environment variable set, then mpage  will send its output to that printer unless you override this behavior on the command line.

TeX Output

  Once you have produced a .dvi file containing TeX  output which you would like to print, you use the dvisp  command to spool it to a laser printer. These files cannot be printed on the lineprinter. The dvisp  command takes a -P flag to specify the printer to which to queue the job. The printer defaults as discussed in Section 7.3. The queuing system takes care of converting the .dvi file into the appropriate printing language (ImPress or POSTSCRIPT ) as the file is being sent to the printer.

If your .dvi file references native POSTSCRIPT figures (because you used a macro package like psfig ), then you must convert it to POSTSCRIPT yourself. To do so, use the dvips  command. See its man page for a discussion of its options. The output from dvips  is normally piped into lpr  for spooling to the appropriate printer.

If you are always sending your output to a POSTSCRIPT printer, you may choose to use the built-in fonts provided by the printer instead of the standard TeX fonts. Doing so will reduce the size of your job and cause it to print more quickly. But it will also make your TeX files nonportable, as they can no longer be printed on a non-POSTSCRIPT printer. The built-in fonts have different metrics than TeX's regular fonts, so line and page breaking will occur at different places. The easiest way to make use of the built-in fonts in LaTeX documents is to include the style option `` times'' at the beginning of the document; see Section 6.3 for additional information. Note also that you cannot use /usr/new/dvips with documents which make use of the built-in fonts.

The program dviselect  may be used when you wish to print only a subset of the pages in a .dvi file. It takes arguments specifying ranges of pages to print. Normally, it writes its output to stdout, which is then piped into dvisp  or dvips .

The program dviconcat  can be used to concatenate one or more dvi files. If given multiple files on the command line, dvisp  will automatically invoke dviconcat  to produce one print job, thus reducing the number of header pages produced.

Previewing TeX Output

  The Sun workstations owned by the department may be used to preview typeset output produced by TeX  before printing it . On Sun systems running SunView,  the previewing program is called texsun . This program supports most tpic  graphics commands as well as all the fonts and magnifications available with the laser printers. As with the other previewers, it supports commands to move around the .dvi file either to a specific page or forward or backward a specific number of pages. The commands to perform these operations are described in the texsun man page. Another previewer for SunView, dvipage,  is also available in /usr/public/bin.

Users of the X Window system  can preview TeX  output with the programs xtex , texx , and xdvi . All three programs support tpic , though the support is most complete in xtex , which also has rudimentary support for psfig figures.

If a TeX document uses POSTSCRIPT figures, then the .dvi file cannot be previewed directly. Instead, it should be converted to POSTSCRIPT with dvips , then the resulting POSTSCRIPT file can be previewed using ghostview , the X POSTSCRIPT previewer.

Troff Output

  There are two versions of troff  available in ICS: troff, the standard one provided with UNIX , and dtroff , the Device-Independent version written by Brian Kernighan. Dtroff takes a superset of regular troff's input, including graphical commands generated by the pic  preprocessor described in Section 6.1.

Generally, troff users will use one of the commands itroff  or ditroff  to print on an Imagen printer, or psroff  to print on a POSTSCRIPT -only printer. Itroff and ditroff perform the same troff processing as their base commands do, but in addition, they automatically pipe the output to an lpr  process which will queue the job appropriately. Each command takes a -P flag to override the default (see Section 7.3), and each takes the arguments which its base command takes. The psroff  command uses dtroff  to process its troff input, converts the result to POSTSCRIPT , and (by default) passes that to an lpr  process to spool it for printing.

Just as neqn is the eqn preprocessor for use with nroff, dtbl  and deqn  should be used to preprocess input for ditroff/ psroff  . Another such preprocessor is the pic  processor for graphics (see Section 6.1).

Previewing Troff Output

  Troff output can be previewed under the SunView  windowing environment using the program tseetool . First, the output from itroff  must be directed into a file (rather than sent automatically to a printer) using a command like

% itroff -t -m macro file > outputfile

Then the outputfile can be previewed using the command

% tseetool  

Dtroff output can be previewed under either the SunView  or the X  windowing environment. For SunView, the steps are very similar to those described above; as with troff , the output from the ditroff  command must be stored in a file outputfile, again using the -t flag to direct the output to stdout. The previewing command is then

% suntroff  

X users should instead use the script xditroff,    which performs both the function of dtroff and the previewing function. Thus,

% xditroff -m macro file

would dtroff  and display file.

POSTSCRIPT Files

  If you have files which are already in POSTSCRIPT format, you can send them to a native-POSTSCRIPT printer with a command like

% lpr -P postscript_printer postscript_file

The qpr  command gives you access to special features of the QMS ps2000 POSTSCRIPT printer. (See Section 8.) You can also print POSTSCRIPT files on the Imagen 3320 (see discussion of the UltraScript  option to ipr  in Section 7.1.)

Previewing POSTSCRIPT Files

  Under the X windowing system, POSTSCRIPT files can be viewed with ghostview . This command is available in /usr/gnu/bin; see the on-line manual page for more information.

Listing and Cancelling Print Jobs

The lpq  command may be used to list the contents of the line printer queues. As with lpr , it defaults to listing only the queue named `` lp'', and the -P flag may be used to specify a different print queue.

The ipq  command is used to list one or more Imagen queues. In addition to running the lpq  program, it prints any available status information returned by the printer. For the 3320 , it reports what paper types are mounted in the input hopper and the two smaller trays in addition to the printer's status. All Imagen queues are displayed by the command

% ipq -a

The lprm  command removes jobs from the printer queues. It takes as an argument the job number associated with the job in the output from lpq . Similarly, the iprm  command is used to remove jobs from one of the Imagen queues. Typing

% iprm -a -P8300a

will remove all your jobs from the 8300a queue, for example.

Graphics and Bitmaps

Pic

  In addition to writing a device-independent version of troff , Brian Kernighan created a graphical description language and program called pic . Pic is used as a preprocessor to dtroff , much as dtbl  and deqn  are. The document ``Pic: A Graphics Language for Typesetting,'' available in the documentation cabinet outside the copy center , describes the pic  input language and how it is used in conjunction with dtroff .

The pic  program has been adapted in ICS for use with TeX . This version is called tpic  to distinguish it from the dtroff  version. The complete document for using tpic, also available in the documentation file cabinet outside the copy center, is called ``Tpic: Pic for TeX.''

Tektronix Mode

   The Imagen printers are capable of emulating a Tektronix 4014 display. See Section 7.1 for additional information.

POSTSCRIPT Figures in TeX Documents

   

The Imagen 3320  is capable of printing POSTSCRIPT   documents. See Section 7.1 for information on making use of this feature. The department also owns a number of POSTSCRIPT -only printers. The information in this section applies to those printers as well as the Imagen in UltraScript mode .

It is possible to include POSTSCRIPT files as pictures within a TeX or LaTeX document using the macro package psfig . There is a man page for psfig and a document (available in the documentation cabinet outside the copy center ), called the ``Psfig/TeX 1.1 Users Guide,'' which describes how to use the psfig package in more detail.

When printing a .dvi file which uses psfig, it is necessary to use the dvips  program to convert the .dvi file into POSTSCRIPT and simultaneously include the pictures---you cannot use dvisp . Dvips also supports the output of tpic , and both types of figures may be used within the same document.

Dvips allows TeX and LaTeX to access the built-in ``LaserWriter'' fonts of POSTSCRIPT , which significantly reduces the size and printing time of the resulting POSTSCRIPT file (because the bitmaps of the characters need not be downloaded to the printer), so using this feature is highly recommended when it is known that the .dvi files will always be printed on a POSTSCRIPT printer. There are LaTeX style option files which will do this automatically within a LaTeX document. For example, if you want to use Times Roman instead of Computer Modern Roman, simply include the style option `` times'' in the document header. The ``Psfig Users Guide'' was printed using this option. Other POSTSCRIPT font families available are avantegarde, bookman, chancery, ncs (New Century Schoolbook), and palatino.

Note that TeX/LaTeX documents prepared using POSTSCRIPT fonts or embedded figures will not be printable on a non-POSTSCRIPT printer. The following section describes additional information on how to upload a POSTSCRIPT picture from a Macintosh and convert it for use in a TeX document.

Macintosh POSTSCRIPT Figures

  Most printers in ICS are available to Macintosh users directly from the Mac's printing system. However, if you want to include a Macintosh-generated figure in a TeX document, follow the steps below.

Figures created on the Macintosh are usually in one of three formats: MacPaint, MacDraw (QuickDraw), or POSTSCRIPT . Many programs allow you to to save your file in different formats through options in the ``Save As...'' dialog. If you want to generate a POSTSCRIPT file but that option is not supported by the application program, there are two choices: you can select the ``Destination: POSTSCRIPT File'' option in the Mac's ``Print...'' dialogue, or you can convert the MacPaint or MacDraw file to POSTSCRIPT using UNIX tools as described here:

  1. Create the image on a Mac; save it in the regular format for the program you're using.
  2. Open a separate folder and save the same drawing in the MacPaint format (or POSTSCRIPT or MacDraw).
  3. Transfer the file to the UNIX host:
    1. Start NCSA-Telnet. Use the ``File'' pull-down menu to open a connection; use `` vt100'' as your terminal type. Change to the directory where you want to put the file(s).
    2. On the pull-down menu under ``Network,'' select `` Send FTP Command''.
    3. On the pull-down menu under ``File,'' select `` Set Transfer Directory...'' to specify the folder on the Mac where the MacPaint file is.
    4. At the ftp> prompt, enter binary to transfer files in binary mode.
    5. At the ftp> prompt, enter get macfile, where macfile is the name of the file to be transferred. Giving a second argument to get will give the file that name on the UNIX host. This example will assume that the file was called MacFile.bin.
    6. Enter bye to end the ftp session. Get off the Mac.
  4. If the file is not already in POSTSCRIPT format, you should convert it at this point. For instance, to convert the MacPaint file to POSTSCRIPT , enter the command

    % macptopbm -e 128 MacFile.bin pgmtops > MacFile.ps

    At this point, you may have to edit MacFile.ps to specify the bounding box information if it is not there. This file may then be printed or included in a TeX document.

  5. To include POSTSCRIPT figures in a TeX document, follow the instructions in the psfig user's manual. Basically, you add the line


    input{psfig}

    at the beginning of the document (after the \documentstyle line in a LaTeX document). At the point where you want the figure, enter the line


    centerline{
    psfig{figure=MacFile.ps,width=7.in,clip=}\
    }

(other options to the \psfig macro are discussed in the complete psfig document).

Sun Screendump

  The screendump  program on the Sun workstations copies the entire display screen into a Sun raster bitmap file. This file may be converted to the Imagen-proprietary ImPress   graphical language using the sunimp  program. Generally, its output will be piped into the ipr  command, which is used to queue ImPress   language jobs to an Imagen laser printer. See the appropriate man pages for additional information. Screendump  works under both the SunView  and X  windowing systems.

Sun raster files can be converted to POSTSCRIPT using the pbm  family of programs in the directory /usr/public/bin.

Sending a large bitmap to any printer other than the networked Imagens (3320, 2308a, 2308b), the SPARCprinters, or the PS-2000 will take several minutes to print. It can take even longer, about 20 minutes, to print on an older POSTSCRIPT printer.

X Windows

    The xwd  command will dump an X window  into a file in a predefined format. This window may be redisplayed later using the xwud  program. Such dumped windows may be converted to ImPress   using the bitimp  program. ImPress   files may be printed on any Imagen printer using the ipr  program. By converting the dumped window bitmap to POSTSCRIPT using the pbm  package, it may be included in a TeX document as described in Section 6.3. Another X Window dumping program is xgrabsc . It can generate POSTSCRIPT directly.

As noted above, the screendump  program will work under X Windows  as well as SunView . It always dumps the contents of the entire screen.

Implot

  The implot  program is a version of the standard UNIX command plot  whose output is in the ImPress   language suitable for printing on an Imagen laser printer. Like the output of sunimp , the output of implot  is usually piped into the ipr  command to queue it to one of the laser printers. Input in the plot format can be generated by the graph   program or by a C program using the plot(3) library .

Grapher

   The grapher program, found in /usr/public/bin, will plot a number of (x,y) pairs on a linear, semi-log, or log-log graph. The output can be used as input to either the pic or tpic programs, so that the resulting graphs may be previewed using standard previewers on workstations, or may be incorporated into a ditroff or TeX document. See its man page for further information.

Chart

   The chart program will produce a bar or pie chart for inclusion in a TeX or LaTeX document. It reads an input file consisting of data values and arbitrary text which labels the values. The output is similar to the output from tpic ; it's included in TeX documents in the same way. The chart man page contains further details on using the program.

Picture

    Picture is a piece of commercial software for drawing figures. It runs under both the SunView and X11 windowing environments, but only on Sun 3 and Sun 4 workstations. The output of picture may be converted to pic/ tpic or POSTSCRIPT format for printing or inclusion within a TeX or dtroff document.

Fig/Xfig

     Fig and xfig are public domain programs based loosely on the program MacDraw. They allow interactive editing of pictures in a WYSIWYG fashion under SunView and X Windows, respectively. Files are saved in a standard fig format. From this format, you can use the transfig  package to generate several other formats, including pic/tpic and POSTSCRIPT , which may be printed or included in documents in the usual way. Since fig runs only under SunView, it is found only on Sun workstations, while xfig and transfig are found on all ICS UNIX systems.

Idraw

   Idraw is a public domain software package for doing interactive drawings. Its user interface is also based on that of the program MacDraw. Its output is always a POSTSCRIPT file, so it can be printed or included in documents just as other POSTSCRIPT files are.

Program Listings

There are two programs which may be used to generate ``fancy'' program listings. The first is tgrind  , which produces a TeX  input file for the program. Tgrind  understands several different programming languages, which are listed in its man page. The output from tgrind  may be included in any TeX  or LaTeX  document.

The second program is ilist . It produces an ImPress   file directly from a programming language source file. Ilist  understands C source and header files, FORTRAN 77 source, shell scripts, and Makefiles. For each of these files, it produces output in ImPress   format which can be piped into the ipr  command. Ilist  also understands ImPress   files, decoding them into double column ASCII text. Ilist output relies on special fonts available only in the 3320  printer.

Advanced Imagen Usage

Special Printer Languages

   Imagen laser printers are capable of printing jobs expressed in several different languages  . These languages include the ImPress   typesetting and graphical language which is proprietary to Imagen, Printer   language for ASCII text files, Tektronix   for emulation of a Tektronix 4014 display, UltraScript   for POSTSCRIPT    files, and Daisy   for emulating a daisy printer such as a diablo. Normally you will be using either ImPress   for printing TeX , troff , or dtroff  output, or ``printer'' for printing ASCII files. The appropriate enqueuing commands ( dvisp, itroff, ditroff, and imprint)     take care of the language selection and any necessary conversions automatically.

The ipr  program may be used to queue jobs in ImPress   or in one of the other languages. It defaults to ImPress  , so it is often used for queuing the output of sunimp , bitimp , and implot , described in Sections 6.5 through 6.7. If, however, you wish to print a document in the daisy,   tektronix,   or ultrascript   languages, you may use the ipr  command, using the -L flag to specify the language. These emulation languages are described in the reference manuals for the Imagen printers, which may be borrowed from the Support Group. When generating jobs in daisy mode, be sure that you generate a RETURN-LINEFEED pair rather than just a NEWLINE to terminate lines of text.

Special Printer Features

The Imagen printers and software drivers have a number of special features which can be accessed through the -R flag to the ipr program (or through the same flag to dvisp). The -R flag allows the user to give flags to the ``remote'' driver printers which are run by lpd on the user's behalf. The flags are

-RD
Document control.  This flag may be followed with any legal Imagen document control string. See the Imagen documentation for details.
-Rl
Landscape mode.  This flag may be used with any ImPress document, such as TeX or troff output.
-RT
Top offset.  This flag allows the user to specify the top offset for the entire document, in milli-inches. This value is added to the default 1-inch top margin, so it may be negative to reduce the margin.
-RL
Left offset.  This flag is analogous to the -RT flag; it is followed by an offset to be added to the default 1-inch left margin. The offset is specified in milli-inches.

Selecting a Default Printer

    As described above, there is a default printer queue for all the spooling commands  . For the lpr  command, the default queue is `` lp'', while for the Imagen-related commands ( dvisp, itroff, ditroff, ipr, ipq, and iprm)        the default is `` imagen'', which is currently an alias for the 3320  queue.

If you normally use a printer other than the default, you may override the default by setting the PRINTER    environment variable for lpr  and mpage , and the LPRINTER    environment variable for the Imagen commands and psroff . For example, to make the ``8300a'' printer be the default for all your Imagen commands, put the command

% setenv LPRINTER 8300a

in your .login file. The -P flag may still be used to override this default and specify a particular printer on any given command.

Printing on Special Paper

  There are normally three different paper types ``mounted'' in the three input bins for the 3320  printer  . The large paper hopper is normally loaded with letter paper, while the other two trays hold letterhead and ledger paper. Letterhead paper should only be used for official departmental business. The current contents of the three trays is shown in the status information returned by the ipq  command for the 3320.  You may access the different trays by specifying the paper type indicated by ipq  on the command line when submitting the job. For TeX  output, the dvisp  command should be given the switch -RDinputbin followed by the paper type and surrounded by quotes. For example, to use letterhead paper, type

% dvisp "-RDinputbin letterhead"

The header page will be printed on ``letter'' (plain) paper rather than special paper. The itroff  and ditroff  commands take a similar switch. With the imprint  command, the R is unnecessary; simply type

% imprint "-Dinputbin letterhead"

For the 8/300  printers, you may want to feed irregular or special paper, such as envelopes, by hand. In this case, add the flag

"-RDinputbin manual"

including the double quotation marks to the ditroff, itroff  , or dvisp  commands, or

"-Dinputbin manual"

to the imprint  command. This will cause the printer, upon receiving your job, to wait for you to hand-feed each page.

Finally, it is possible to override the paper type on just the first page. Typically, this would be to print the first page on letterhead and the remaining pages on plain (letter) paper. The document control command to do this is `` inputbinfirst,'' and it otherwise works just like `` inputbin,'' as described above.