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:
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.
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.
mkdir c:\texmf\dviwin29 mkdir c:\texmf\dviwin29\bin mkdir c:\texmf\dviwin29\doc mkdir c:\texmf\dviwin29\filters
cd c:\archive\dviwin29 unzip dviwin29.zip unzip dviwin32.zip
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
[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
c:\texmf\dviwin29\bin\dviwin2.exe -1Now 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.
@ECHO OFF start c:\texmf\dviwin29\bin\dviwin2.exe -1 %1When 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.
c:\texmf\fonts\pk\ljfive\tmp\dpi$r;c:\texmf\fonts\pk\cx\tmp\dpi$rNote 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.
@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
c:\texmf\metafont\misc\modes.mfto 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.
c:\texmf\dviwin29\bin\genpk.bat $f $x $X $m
The current version is Dvips 5.74.
Edit the file c:\texmf\dvips\init\config.ps as follows:
D 300 M cxWe replace them by:
D 600 M ljfiveAs above, the actual edits you make to config.ps will depend on you printer (see modes.mf).
@ A4size 210mm 297mm @+ %% PaperSize: A4In the US, you will want to replace those lines with a single line:
@ letterSize 8.5in 11in
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.
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.
There are several ways to print from MiKTeX and the previewers discussed above.
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.
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').
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.