Yap User's Guide

Revision 0.18 (Yap 0.95b)

March 1999

Christian Schenk cschenk@snafu.de">cschenk@snafu.de


Table of Contents


Copyright (C) 1998, 1999 Christian Schenk

Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.

Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.

Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Free Software Foundation.

What is Yap?

You use Yap(1) to view a DVI file compiled by TeX. Yap tries hard to follow the WYSIWYG-principle: what you see (on screen) is what you get (when you take the paper out of the tray).

This document will explain

You can conclude from the version number 0.95b, that Yap is still under development. You can get the newest development version from the MiKTeX Project Page at http://www.snafu.de/~cschenk/miktex/.

How to open a DVI file

You can open a DVI file

Printing DVI Documents

There are two different methods to send a DVI document to the printer:

  1. By means of the standard print command (`File|Print...').
  2. By means of Dvips (`File|Print PostScript...').

If your DVI document contains PostScript specials (e.g. EPS inclusions), than you can't use the standard print command.

The Dvips interface also works in conjunction with non-PostScript printers, provided that you have GhostScript installed on your workstation.

Standard Print Command

The command `File|Print...' opens the standard Print Setup dialog box.

Printing using Dvips

The command `File|Print PostScript...' opens the Print PostScript dialog box.

Print PostScript Dialog Box

This dialog box allows you select various Dvips options.

Printer

Check this button if you want to pipe the Dvips output through the GhostScript interpreter (gswin32c.exe). GhostScript will be invoked with the following options:

-sDEVICE=mswinpr2
Causes GhostScript to open the standard Print Setup dialog box. There you must set the orientation to `Portrait'.
-dBATCH
Causes GhostScript to quit when the document has been printed.
-dNOPAUSE
Disables the prompt and the pause at the end of each page.
-dSAFER
Disables unsafe operators.

PS File

Check this button if you want to send the Dvips output to a PostScript printer or if you want to save the output in a PostScript file. Enter a printer port (such as `lpt1') or a filename.

Print range

Select the pages that you want to print.

Extra Dvips options

You can enter additional Dvips options here.

Reconfirm command line

Check this button if you want to inspect the Dvips command line.

Forward and Inverse Search

Yap is capable of searching the DVI file for so called source specials. This feature can help you to optimize the edit-compile-view cycle:

How to enrich your document with source specials

TeX inserts source specials into the DVI file, if you specify the command-line switch `--src-specials'. You simply can say

tex --src-specials mybook.tex

and the TeX compiler will insert one source special at the beginning of each paragraph.

You can control the frequency of embedded source specials by specifying where to insert the specials into the DVI file:

tex --src-specials=where mybook.tex

The where argument must be a comma-separated value list. Legal values are:

cr
Causes TeX to insert one source special at the end of each table row.
display
Causes TeX to insert one source special at the beginning of each display.
hbox
Causes TeX to insert one source special at the beginning of each hbox.
math
Causes TeX to insert one source special upon entry to math mode.
par
Causes TeX to insert one source special at the beginning of each paragraph.
vbox
Causes TeX to insert one source special at the beginning of each vbox.

How to search forward

Forward search is initiated by specifying --find-src-special on the Yap command-line (see section Command line switches).

But initiating forward search from the command-line is rather invonvenient. It makes more sense to initiate forward search out of the text editor. The editor must be capable of starting Yap with a correct --find-src-special directive. Two popular text editors which are capable to initiate forward search are GNU Emacs and WinEdt.

Configuring Emacs

You will need the Emacs packages Auc-TeX, which provides an enhanced TeX environment.

The following code should be added to your `.emacs':

(setq TeX-command-list
      '(("TeX" "tex --src \"\\nonstopmode\\input %t\""
         TeX-run-TeX nil t)
	("LaTeX" "%l --src \"\\nonstopmode\\input{%t}\""
         TeX-run-LaTeX nil t)
	("View" "yap -1 -s \"%n %t\" %d"
         TeX-run-discard nil nil)
	("BibTeX" "bibtex %s" TeX-run-BibTeX nil nil)
	("Index" "makeindex %s" TeX-run-command nil t)))

`TeX' (resp. `LaTeX') creates a DVI file which contains source file information.

`View' starts Yap (if it is not already running) and moves the focus to the corresponding DVI location.

Initiating Inverse Search

Provided that the DVI document contains source file information (see section How to enrich your document with source specials), you can initiate inverse search by double-clicking inside the Yap document window.

Graphics Inclusions

Yap supports the following graphics formats:

EMF
Enhanced Metafiles (*.emf).
WMF
Windows Metafiles (*.wmf).
BMP
Device-independant Bitmap (*.bmp).
EPS
Encapsulated PostScript (*.eps); requires GhostScript.
GIF, PNG, TIFF, ...
All graphics formats that are supported by the netpbm graphics suite.

Windows Metafiles

Yap has built-in support for Windows Metafiles (WMF) and Enhanced Metafiles (EMF).

Example

You can use the `graphicx' package to include WMF/EMF files. For example, the following LaTeX code will include the WMF file drawing.wmf:

\usepackage{graphicx}
\DeclareGraphicsRule{.wmf}{bmp}{}{}% declare WMF filename extension
\begin{document}
\includegraphics[width=2in,height=1in]{drawing.wmf}
\end{document}

Windows Bitmap (BMP) Files

Yap has built-in support for Windows Bitmap Files.

Example

You can use the `graphicx' package to include BMP files. For example, the following LaTeX code will include the BMP file picture.bmp:

\usepackage{graphicx}
\begin{document}
\includegraphics[width=2in,height=1in]{picture.bmp}
\end{document}

Encapsulated PostScript

Yap displays EPS figures with the help of GhostScript, which must be installed on your computer.

Example

You can use the `graphicx' package to include EPS files. For example, the following LaTeX code will include the EPS file drawing.eps:

\usepackage{graphicx}
\begin{document}
\includegraphics{drawing.eps}
\end{document}

Other Graphics Formats

Yap can convert almost any graphics file into an equivalent Windows Bitmap (BMP) file, provided that a suitable filter program is available. The BMP file will then be displayed instead of the original file.

Many filters are included in the netpbm graphics suite, which can be downloaded from the CTAN directory systems/win32/miktex/util.

Example

You can use the `graphicx' package to include graphics files. For example, the following LaTeX code will include the GIF file picture.gif:

\usepackage{graphicx}
\DeclareGraphicsRule{.gif}{bmp}{}{}% declare GIF filename extension
\begin{document}
\includegraphics[width=2in,height=1in]{picture.gif}
\end{document}

Specifying filters

New filters have to be specified in the [Graphics] section of the MiKTeX configuration file (`miktex.ini'). A filter specification has the syntax `.xxx.bmp=command', where

The command line must contain the following place-holders

`%i'
The name of the input file which has to be converted.
`%o'
The name of the output (BMP) file.

Example

The following specification defines a GIF filter:

[Graphics]
.gif.bmp=giftopnm %i | ppmtobmp -windows > %o

This filter works as follows:

  1. giftopnm is used to convert the .gif file into a portable bitmap, which is written to a pipe (`|')
  2. ppmtobmp is used to convert the portable bitmap, which is read from the pipe, into the final BMP file.

Yap Tools

Yap provides several tools for browsing the DVI document.

Browsing Source Specials

The command `Tools|Source Specials...' opens the the Source Specials windows.

Source Specials Window

This window lists all source specials found in the current DVI document.

Goto

This button brings into view the portion of the DVI document which contains the selected source special

Edit Source

This button invokes an editor to edit the TeX source corresponding to the selected source special.

Close

This button closes the window.

Hand Tool

The hand tool allows you to scroll the page by moving the cursor while the left mouse button is pressed. You select the Hand Tool with the command `Tools|Hand Tool' or by clicking the corresponding button in the toolbar.

Magnifying Glasses

The Magnifying Glass allows you to view a small part of the unshrunk page. You select this tool with the command `Tools|Magnifying Glass' or by clicking the corresponding button in the toolbar.

You can choose between three sizes:

  1. Pressing the left mouse button activates the small magnifying glass.
  2. Pressing the left mouse button in combination with the Shift key activates the medium sized magnifying glass.
  3. Pressing the left mouse button in combination with the Control key activates the large magnifying glass.

The three magnifying glasses are fully customizable (see section Magnifying Glass Propery Page).

You can specify the power of the magnifying glass by entering a numerical prefix argument. The argument is interpreted as a shrink factor for the text inside the magnifying glass. A shrink factor of 1 (the default) results in a maximum magnification.

Keyboard Map

Numerical Prefix

0
1
2
3
4
5
6
7
8
9
Adds a digit to the numerical prefix.
BACK
Removes the last digit from the numerical prefix.
-
Negates the numerical prefix.

Zooming

prefix++
Zooms in (unshrinks the page).
prefix+-
Zooms out (shrinks the page).

Navigation

prefix+g
Opens the Goto Page dialog box if no prefix argument was entered. Otherwise goes to the specified page.
prefix+PgUp
prefix+b
prefix+p
prefix+h
prefix+Backspace
prefix+Del
Goes to previous page.
prefix+PgDn
prefix+f
prefix+n
Goes to the next page.
Ctrl+Home
Goes to the first page.
Ctrl+End
Goes to the last page.

Scrolling

End
Scrolls the window to the bottom of the page.
Home
^
Scrolls the window to the top of the page.
Left
Scrolls the windows left a little bit.
Shift+Left
l
Scrolls the window left.
Right
Scrolls the window right a little bit.
Shift+Right
r
Scrolls the window right.
Space
Scrolls the window down. Goes to the next page, if at the bottom of the current page.
Up
Scrolls the windows up a little bit.
Shift+Up
u
Scrolls the window up.
Down
Scrolls the windows down a little bit.
Shift+Down
d
Scrolls the window down.

Misc

?
Show the keyboard map.
e
Start a text editor to edit the TeX source under the mouse cursure (i. e. perform an inverse search).
F
Ctrl+O
Open a new DVI Document.
Ctrl+P
Send the DVI document to the printer.
q
Ctrl+c
Ctrl+d
Quit the application.

Customizing Yap

Options Dialog Box

User Interface Property Page

The User Interface property page allows you to customize the Look & Feel of Yap.

Maintain vertical position

Select this checkbox to cause Yap to keep the vertical scroll position at a change of page.

Maintain horizontal position

Select this checkbox to cause Yap to keep the horizontal scroll position at a change of page.

Magnifying Glass Propery Page

This property page allows you to customize the three magnifying glasses.

Hide mouse cursor

Check this button if the mouse cursor should not be visible while a magnifying glass is opened.

Width Enter the width (in screen pixels) of the rectangular magnifying glass window.

Height

Enter the height (in screen pixels) of the rectangular magnifying glass window.

Shrink Factor

Specify the shrink factor to be used in the magnifying glass window. The shrink factor specifies the power of the magnifying glass. A shrink factor of 1 results in a maximum magnification.

Display Property Page

The Display property page allows you to change various display settings.

Mode

Specify the METAFONT mode for the display.

The Mode list field contains a list of known METAFONT modes. This information is needed, when new PK fonts are to be generated. In principle, it doesn't matter what mode name you select here. But it's recommended, that you use the same mode name as for the printer, since this reduces the invocations of the font-generator.

Shrink Factor

Specify the default shrink factor.

Paper Size

Specify the paper type.

Orientation

Specify the orientation of the paper.

Printer Property Page

The Printer property page allows yoy to change various printer settings.

Mode

Specify the METAFONT mode for the printer.

The Mode list field contains a list of known METAFONT modes. This information is needed, when new PK fonts are to be generated. You must select a mode, that matches your printer resolution.

x-shift, y-shift

Specify the the print offset.

For some old printer models it may be necessary to adjust the the print offset (i.e. the position, where printing begins). x-shift/y-shift gives the amount of pixels, an output page has to be shifted right/down.

Inverse Search Property Page

Command

Specify the command line which Yap shall execute after a successful inverse search operation (see section Initiating Inverse Search).

The command may contain the following placeholders:

%f
Expands to the name of the source file.
%l
Expands to the line number in the source file.

Examples

Enter something like this, if you use Emacs as a TeX editor:

c:\emacs-20.3\bin\gnuclientw.exe -F +%l %f

Enter something like this, if you are using the WinEdt TeX shell:

"c:\Program Files\WinEdt\winedt.exe" "[Open('%f');SelLine(%l,8)]"

GhostScript Property Page

This property page allows you to configure PostScript support.

Disable PostScript interpretation

Check this button, if you want Yap to ignore all PostScript specials.

Draft mode (no anti-aliasing)

Check this button to disable anti-aliasing for PostScript graphics. This speeds up the interpretation of PostScript specials at the expense of output quality.

Security Property Page

This property page allows you to permit or forbid the execution of embedded shell commands.

Never execute any shell commands

Check this button to prevent the execution of embedded shell commands.

Ask for permission to execute shell command

Check this button if you want to be warned about any embedded shell commands. You can then choose whether or not to execute the command.

Execute only secure shell commands

Check this button to allow secure commands. Enter a comma-separated list of command names in the edit box.

Execute all shell commands

Check this button to execute embedded shell commands unconditionally.

Advanced Property Page

This property page allows you to set advanced options.

Keep Logbook

Check this button to cause Yap to record events into the logbook.

Show Source Specials

Check this button to cause Yap to show all source specials.

Telling Yap About PostScript Fonts

Yap consults several font mapping files when a missing PK font has to be generated from a PostScript Type 1 font:

`dvips\config\config.ps'
Yap first consults the Dvips configuration file.
`miktex\config\miktex.map'
Yap then consults the MiKTeX font mapping file.

The Logbook

Yap records certain events in a logbook. The command `View|Logbook...' opens the logbook.

Close

Press this button to close the logbook.

Copy

Press this button to copy the logbook to the Windows Clipboard.

Erase

Press this button to erase the logbook.

Command line switches

The general Yap command line syntax is

yap [options] [dvifile]

The following options are recognized:

--find-src-special srcspecial
-s srcspecial
Initiate a forward search (see section Forward and Inverse Search). The syntax for srcspecial is `NNFILENAME' (i.e. line number followed by source file name). See the example below.
--goto-hyper-label label
Jump to a HyperTeX label. The label must have been inserted as an html: special.
--single-instance
-1
Use an already opened Yap application window (if one exists). This flag prevents multiple Yap applications instances.
--unregister
Remove Yap related settings from the Windows Registry

Example

You want Yap to do a forward search to the DVI location corresponding to line 41 of the source file mydoc.tex. The name of the DVI file is mydoc.dvi. The forward search is initiated like this:

yap -s 41mydoc.tex mydoc.dvi

If you already have an open Yap application instance, and you don't want to start another instance, then add the -1 flag:

yap -1 -s 41mydoc.tex mydoc.dvi

Specials

PostScript Specials

\special{! string}
Insert literal PostScript into user dictionary.
\special{" string}
Insert literal PostScript.
\special{ps: string}
Insert literal PostScript, with no protection.
\special{ps::[begin] string}
Start inserting literal PostScript.
\special{ps:: string}
Send literal PostScript to GhostScript.
\special{ps::[end] string}
End sending literal PostScript.
\special{ps: plotfile filename}
Send file contents into GhostScript.
\special{header=filename}
Insert file contents into GhostScript's user dictionary.
\special{PSfile="filename"}
\special{psfile=filename}
Insert graphics file.

HyperTeX Specials

\special{html:<a href="hrefstring">}
Start a hyper reference
\special{html:<a name="namestring">}
Start a hyper label.
\special{html:</a>}
End a hyperref/label.

emTeX Specials

\special{em:graph filename}
\special{em:graph filename, width, height}
Insert graphics file.

DviWin Specials

\special{anisoscale filename, width, height}
Insert graphics file.
{src: linenumber filename}
Insert source file information.

Yap Copyright

The following copyright notice applies to the Yap program. The copyright and copying permissions for this manual appear near the beginning of this document.

Copyright (C) 1996, 97, 98 Christian Schenk.

Yap is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
   
Yap is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.
   
You should have received a copy of the GNU General Public License along
with Yap; if not, write to the Free Software Foundation, 59 Temple Place
- Suite 330, Boston, MA 02111-1307, USA.

Troubleshooting

Cannot locate GhostScript DLL

The GhostScript interpreter (gsdll32.dll) could not be located.

Remedy: Install GhostScript 5.50 and make sure that the GhostScript directory (usually `c:\gstools\gs5.50') is included in the PATH variable.

More information: PostScript specials are rendered with the help of GhostScript, a free PostScript interpreter.

Cannot locate GhostScript Executable

The GhostScript executable (gswin32.exe) could not be located.

Remedy: Install GhostScript 5.50 and make sure that the GhostScript directory (usually `c:\gstools\gs5.50') is included in the PATH variable.

More information: PostScript specials are printed with the help of GhostScript, a free PostScript interpreter.

Cannot create font

Yap was not able to create a missing font.

Remedy: Install the font source file(s).

More information: The logbook (`View|Logbook...') should state the name of the missing file.

No source specials found

The DVI file contains no source specials.

Remedy: Use the `--src' option the next time you compile your TeX source file (see section How to enrich your document with source specials).

Cannot open TeX source file

Yap cannot open the TeX source file because the current DVI page contains no source file information.

Remedy: Use the `--src' option the next time you compile your TeX source file (see section How to enrich your document with source specials).

Index

Jump to: b - c - d - e - f - g - h - i - m - n - o - p - s - t - w - x - y - z

b

  • Bitmap files (BMP)
  • Bitmap Files (BMP)
  • BMP, BMP
  • c

  • Command line, Command line, Command line
  • d

  • Drag & Drop
  • Dvips, Dvips, Dvips
  • e

  • Embedded shell commands
  • EMF
  • Encapsulated PostScript
  • Enhanced Metafiles (EMF)
  • EPS, EPS
  • f

  • Forward search, Forward search, Forward search
  • g

  • GhostScript, GhostScript, GhostScript, GhostScript
  • GhostScript, anti-aliasing
  • GhostScript, draft mode
  • GIF
  • graphicx
  • h

  • Hand tool
  • i

  • Inverse Search
  • Inverse search, Inverse search
  • m

  • Magnifying glass, activating
  • Magnifying glass, customizing
  • Magnifying glass, selecting
  • Metafiles (WMF)
  • METAFONT mode, METAFONT mode
  • MRU Files
  • n

  • Navigation
  • Numerical prefix, Numerical prefix
  • o

  • Orientation, Orientation
  • p

  • Paper size, Paper size
  • PNG
  • PostScript, PostScript, PostScript, PostScript
  • Print range
  • Printing
  • s

  • Scrolling, Scrolling
  • Security
  • Shrink factor, Shrink factor, Shrink factor, Shrink factor
  • Source specials, Source specials, Source specials
  • t

  • TIFF
  • Type 1 fonts
  • w

  • Windows Registry
  • WinEdt, WinEdt, WinEdt
  • WMF
  • x

  • x-shift
  • y

  • y-shift
  • z

  • Zooming, Zooming

  • Footnotes

    (1)

    Yet Another Previewer

    (2)

    Most Recently Used (File)


    This document was generated on 12 April 1999 using texi2html 1.56k.