Go to the first, previous, next, last section, table of contents.


Screen Previewers for MiKTeX

This chapter was contributed by John Jones and Tom Trotter.

Comments, corrections and suggestions for improvements welcomed:

  John Jones      jj@ASU.edu
  Tom Trotter     trotter@ASU.edu

  Department of Mathematics
  Arizona State University
  Tempe, Arizona 85287
  USA

MiKTeX is distributed with Yap, a freely distributable screen previewer which will be satisfactory for many users. But some people may prefer to supplement the basic MiKTeX installation with somewhat more flexible screen previewers. This HOWTO describes the procedures for setting up two alternative screen previewers:

  1. Dviwin (Hippocrates Sendoukas).
  2. Ghostscript (Aladdin Enterprises), and GSview graphical interface (Russell Lang).

The immediate question is "Why two? Why not just one good one?" The answer is simple. Dviwin is particularly good for previewing TeX and LaTeX text files and can handle a variety of graphics specials *except* for postscript figures. On the other hand, Ghostscript displays postscript figures very well, although its resolution on text is not as good as dviwin. It is also somewhat slower. This HOWTO also includes some remarks on the configuration of dvips, as this step is essential to the production of files which can be viewed with Ghostscript.

NOTE: Throughout this HOWTO, we assume that you already have MiKTeX installed on your computer and that the root directory for MiKTeX is "c:\texmf". Also, we assume that you have the file "unzip.exe" in your path. Finally, we assume that the root directory for your operating system is "c:\windows". If you are using Windows NT, this root directory is more likely to be something like "c:\winnt" or "c:\winnt40". If this is the case, you must modify the commands and the paths in the batch files given below to make the appropriate changes.

Dviwin

The current version is Dviwin 2.9.

Get the file:

ftp://ftp.cdrom.com/pub/tex/ctan/dviware/dviwin/dviwin29.zip

and save it to a scratch directory on your hard disk, say

c:\archive\dviwin29

You can get this file by anonymous ftp or with your web browser.

Installing Dviwin

  1. Make the following directories:
    mkdir c:\texmf\dviwin29
    mkdir c:\texmf\dviwin29\bin
    mkdir c:\texmf\dviwin29\doc
    mkdir c:\texmf\dviwin29\filters
    
  2. Go to the Dviwin scratch directory and extract the files.
    cd c:\archive\dviwin29
    unzip dviwin29.zip
    unzip dviwin32.zip
    
  3. It's a good idea to pause and read some of the documentation. In particular, see the README file which you can open with your text editor or Wordpad. Also, use Explorer to open the file dviwin2.hlp.
  4. Now that you're ready to resume the installation...
    copy *2.exe c:\texmf\dviwin29\bin
    copy *.str c:\texmf\dviwin29\bin
    copy *.hlp c:\texmf\dviwin29\bin
    copy miscwin2.dll c:\texmf\dviwin29\bin
    copy graphio2.dll c:\texmf\dviwin29\bin
    copy README c:\texmf\dviwin29\doc
    copy *2.flt c:\texmf\dviwin29\filters
    
  5. IMPORTANT: You can store the Dviwin help files anywhere if you only access them with Explorer. But if you want to access the Help files from the "Help" menu in Dviwin, they must be somewhere in your path. We recommend adding `c:\texmf\dviwin29\bin' to your path rather than separating the help files from the rest of the Dviwin files. If you place the help files in your path and click on the Help menu in Dviwin, you will get "dviwin.hlp", not "dviwin2.hlp." You can access "dviwin2.hlp" via the File menu. Alternatively, if you want Dviwin to open "dviwin2.hlp", then rename dviwin.hlp to olddvi.hlp and then rename dviwin2.hlp to dviwin.hlp.
  6. As outlined in Dviwin's README file, the previewer has the ability to display graphics files in a variety of formats. We consider this step optional, but if you want the full spectrum of options, then it is necessary to add the following section to your c:\windows\win.ini file, using your favorite text editor:
    [NT Graphic Import Filters]
    PC Paintbrush(.PCX)=c:\texmf\dviwin29\filters\pcxin2.flt,PCX
    Microsoft Paint(.MSP)=c:\texmf\dviwin29\filters\mspin2.flt,MSP
    Bitmaps(.BMP)=c:\texmf\dviwin29\filters\bmpin2.flt,BMP
    Bitmaps(.DIB)=c:\texmf\dviwin29\filters\bmpin2.flt,DIB
    Bitmaps(.RLE)=c:\texmf\dviwin29\filters\bmpin2.flt,RLE
    Compuserve GIF(.GIF)=c:\texmf\dviwin29\filters\gifin2.flt,GIF
    X Pixmaps(.XPM)=c:\texmf\dviwin29\filters\xpmin2.flt,XPM
    
  7. Use Explorer to create a shortcut to c:\texmf\dviwin29\dviwin2.exe and put it on your desktop, or wherever you prefer to keep links of this type. Using the properties item in the menu, set the "target" for the shortcut to be
    c:\texmf\dviwin29\bin\dviwin2.exe -1
    
    Now you can preview a file by clicking on the shortcut. When Dviwin appears, you can select a file using the "File" menu, which is at the top left corner.
  8. If you like to invoke a screen previewer from the command line, create a batch file, say "preview.bat" using a text editor, and place this file somwhere in your path, for example, in c:\texmf\miktex\bin. The file should contain two lines:
    @ECHO OFF
    start c:\texmf\dviwin29\bin\dviwin2.exe -1 %1
    
    When you are processing a file, say "jobname.tex" and you create "jobname.dvi", you can then preview this file by typing "preview jobname" or "preview jobname.dvi" on the command line. If you just type "preview", then Dviwin is started and you then select a file using the "File" menu. There may be some problems in using such a batch file when your jobname has spaces or more that one dot. In this case, you should use the shortcut.

Configuring Dviwin

  1. Start the previewer by clicking on the shortcut or by typing "preview" if you have created the batch file described above.
  2. First, you must tell Dviwin where to find fonts. Pull down the Options menu to "Font Directory." Following the standard setup for MiKTeX, we recommend typing the following line in the box:
    c:\texmf\fonts\pk\ljfive\tmp\dpi$r;c:\texmf\fonts\pk\cx\tmp\dpi$r
    
    Note that we are assuming that you will just leave the fonts in the "tmp" directory and not move them up one level higher in the directory tree.
  3. This section is based on recommendations provided by John Young. Go to directory `c:\texmf\dviwin29\bin'. Use your text editor to create a file called `genpk.bat'. This file should contain the following lines:
    @ECHO OFF
    REM =========================================================
    REM Filename:  genpk.bat
    REM =========================================================
    REM This batch file uses the maketexpk.exe program (with
    REM metafont) to create missing fonts when the Dviwin
    REM screen previewer is used.  First the resolution determines
    REM the mode passed to metafont.
    REM =========================================================
    set mode=ljfive
    if %3==300 set mode=cx
    if %3==600 set mode=ljfivemp
    REM =========================================================
    REM You may need to edit these lines or add
    REM additional lines to set the correct METAFONT
    REM for your particular printer.
    REM =========================================================
    c:\texmf\miktex\bin\maketexpk.exe %1 %2 %3 magstep(%4) %mode%
    set mode=
    REM EOF        
    
  4. As commented on in the file `genpk.bat', the building of fonts is dependent on the mode parameter which is passed to metafont. You may want to edit the file genpk.bat to use modes which correspond to your printer. See the file
    c:\texmf\metafont\misc\modes.mf 
    
    to find the mode for your particular printer. We find that Dviwin works best at the resolutions of 300 and 600. The display quality using the ibmvga mode at 110 is not on the same level.
  5. Pull down the Options Menu to "Missing Fonts." Mark the tick "Execute command" and insert the following line in the Cmd box:
    c:\texmf\dviwin29\bin\genpk.bat $f $x $X $m
    
  6. As these instructions provide, you can now invoke Dviwin at the resolutions 300 and 600. As a general rule, displaying at 600 will provide sharper resolution, but depending on the size and quality of your monitor, you may have difficulty getting a page to fit on your screen, even with the zoom set to 6. On a 21" Viewsonic 21PS, a full page of text will almost fit on the screen when the resolution is set to 600, but it is necessary to use the arrow keys to see the last line or two. A full page at 300 fits nicely on the screen with the zoom set to 4.

Dvips

The current version is Dvips 5.74.

Configuring Dvips

Edit the file c:\texmf\dvips\init\config.ps as follows:

  1. Set the resolution and mode for your printer. If you are using a 300dpi HP Lasejet, there is nothing to do here, as this is the default. We are using an HP Laserjet 5MP, so we change the second and third lines. Currently, these lines are:
    D 300
    M cx
    
    We replace them by:
    D 600
    M ljfive
    
    As above, the actual edits you make to config.ps will depend on you printer (see modes.mf).
  2. The config.ps file included with MiKTeX uses the A4 paper size as the default. The fifth and sixth lines read:
    @ A4size 210mm 297mm
    @+ %% PaperSize: A4
    
    In the US, you will want to replace those lines with a single line:
    @ letterSize 8.5in 11in
    

GhostScript and GSview

The current versions are Ghostscript 4.03 and GSview 2.1.

Get the following four files:

ftp://ftp.cs.wisc.edu/ghost/aladdin/gs403fn1.zip
ftp://ftp.cs.wisc.edu/ghost/aladdin/gs403ini.zip
ftp://ftp.cs.wisc.edu/ghost/aladdin/gs403w32.zip
ftp://ftp.cs.wisc.edu/ghost/rjl/gsview21.zip

and save them to a scratch directory on your hard disk, say:

c:\archive\ghost

For lots of information on Ghostscript and related programs, see

http://www.cs.wisc.edu/~ghost/index.html

Information about downloading and installing the most recent versions of the software can always be found there.

Installing GhostScript/GSview

To install the system for Windows 95/NT, type:

cd c:\archive\ghost
unzip gsview21.zip
setup.exe

Almost everything will be taken care of by the setup program. When in doubt on a yes/no question, answer yes. The most meaningful decision you will have to make is where to put the actual installation. The default is `c:\GStools'.

We recommend making a shortcut to the previewer. The target for this shortcut will be:

c:\GStools\gsview\gsview32.exe  

There are a few more setup questions asked the first time gsview is run, but they are pretty simple (again, "yes" is a pretty safe answer).

Now to preview a postscript file using GSView21, you click on the shortcut, and use the File menu to select the particular file.

If you like to work on the command line, create a batch file, say `gsview.bat' with your text editor and place this file in `c:\texmf\miktex\bin'. The file should contain two lines:

@ECHO OFF
start c:\GStools\gsview\gsview32.exe %1.ps

Now to view the postcript file `jobname.ps', you type

gsview jobname

on the command line.

Printing

There are several ways to print from MiKTeX and the previewers discussed above.

Printing using dvips

With a postscript printer, we recommend using dvips since it offers the fastest printing. For example, if you have processed a file, say `jobname.tex' with tex or latex and produced a file `jobname.dvi', which you have previewed and now want to print, you can type:

dvips jobname
print jobname.ps

to produce a `jobname.ps' file which is then sent to your printer. This can also be accomplished in one step. You can give the single command

dvips -o lpt1 jobname

Or, you could create the batch file `pdvi.bat' and put it in your path.

@ECHO OFF
REM =========================================================
REM Filename:  pdvi.bat
REM=========================================================
dvips -o lpt1 %1 %2 %3 %4 %5

Then, use the command

pdvi jobname

This final approach may save the most keystrokes if you use dvips for both printing and for creating `.ps' files to be viewed through GSview.

In all cases, if your printer is connected to a different port (e.g., `COM2'), then you should replace `lpt1' by the name of the correct port.

Printing using Dviwin.

Dviwin can be used to send dvi files to your printer. It works fairly well with a wide variety of printers. If you click on the `print' command in the file menu, then Dviwin will send the dvi file to your printer. Our experience is that this is fairly slow, although the output is high quality.

One can also have dviwin use dvips for printing. This is typically faster (and saves a trip back to the command line). Open a test file with Dviwin. Drag down the `File' menu and click on `Print'. You will get a dialogue window with `Print' in the titlebar. One of the options listed in this window is a box for `External print'. In this box, you can type:

c:\texmf\miktex\dvips.exe -o lpt1 -p$1 -l$2 $b

This will pipe the dvi file through dvips and then on to your printer (again assuming your printer is connected to the port `lpt1').

Printing using GSview

If you are previewing a file with GSview, then you can also send the file to your printer. Curiously, this can also be done even if you don't have a postscript printer.


Go to the first, previous, next, last section, table of contents.