XDVI(1)

๐Ÿ“ฆ
version 22.87.06+j1.42 ยท 2 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

๐Ÿ’– XDVI ๐Ÿ’–

okay bestie, sit down, hydrate, because we're doing the XDVI(1) page from the General Commands Manual and she is iconic. this is the whole thing, no skips, no "you get the idea" โ€” we're going all the way. ๐Ÿซถ


โœจ NAME โœจ

xdvi โ€” DVI Previewer for the X Window System. that's the girl. that's her whole brand. ๐Ÿ’…


๐ŸŒธ SYNOPSIS ๐ŸŒธ

xdvi [+[page]] [--help] [-allowshell] [-altfont font] [-anchorposition anchor]
     [-bg color] [-browser WWWbrowser] [-copy] [-cr color]
     [-debug bitmask|string[,string ...]] [-display host:display]
     [-dvipspath path] [-editor command] [-expert] [-expertmode flag]
     [-fg color] [-findstring string] [-font font] [-fullscreen]
     [-gamma g] [-geometry geometry] [-gsalpha] [-gspalette palette] [-h]
     [-help] [-hl color] [-hush] [-hushbell] [-hushchars] [-hushchecksums]
     [-hushstdout] [-icongeometry geometry] [-iconic] [-install]
     [-interpreter path] [-keep] [-l] [-license] [-linkcolor color]
     [-linkstyle 0|1|2|3] [-margins dimen] [-mfmode mode-def[:dpi]]
     [-mgs[n] size] [-mousemode 0|1|2] [-nocolor] [-nofork] [-noghostscript]
     [-nogrey] [-nogssafer] [-noinstall] [-nomakepk] [-nomatchinverted]
     [-noomega] [-noscan] [-notempfile] [-notype1fonts] [-noxi2scrolling]
     [-offsets dimen] [-p pixels] [-paper papertype] [-pause]
     [-pausespecial special-string] [-postscript flag] [-rulecolor color]
     [-rv] [-S density] [-s shrink] [-safer] [-sidemargin dimen]
     [-sourceposition line[:col][ ]filename] [-statusline]
     [-text-encoding encoding] [-thorough] [-topmargin dimen] [-unique]
     [-version] [-visitedlinkcolor color] [-warnspecials]
     [-watchfile secs] [-wheelunit pixels] [-xoffset dimen] [-yoffset dimen]
     [dvi_file]

look at her. a whole wall of options and every single one of them matters. ๐Ÿ’–


๐ŸŒˆ DESCRIPTION ๐ŸŒˆ

Xdvi is a program for previewing dvi files โ€” like, the kind you get from the tex(1) program โ€” under the X window system. that's the whole job. she previews. she slays. โœจ

Xdvi can show the file shrunken by various integer factors, and she's got a little ``magnifying glass'' for viewing parts of the page enlarged (peep the MAGNIFIER section down below ๐Ÿ‘€). this version of xdvi is also referred to as xdvik, because she uses the kpathsea library to locate and generate font files. and on top of all that, she supports these features:

  • hyperlinks in DVI files (section HYPERLINKS),
  • direct rendering of PostScript<tm> Type 1 fonts (section TYPE 1 FONTS),
  • source specials in the DVI file (section SOURCE SPECIALS),
  • string search in DVI files (section STRING SEARCH),
  • saving or printing (parts of) the DVI file (sections PRINT DIALOG and SAVE DIALOG).

no cap, she does all of that. ๐Ÿ’…

Xdvi can be compiled with the Motif toolkit or the Xaw (Athena) toolkit (and variants of it, bestie, variants exist), and the Motif version has a slightly different GUI โ€” those differences get flagged all over this page, so keep your eyes peeled. ๐Ÿ‘‘

Before displaying a page of a DVI file, xdvi will check to see if the file has changed since the last time it was displayed. if it has? she reloads it. this is the whole reason you can preview a million versions of the same file while running xdvi only once โ€” main character efficiency. and since she can't read partial DVI files, xdvik versions starting from 22.74.3 will create a temporary copy of the DVI file being viewed, so the file can be viewed without interruptions. (the -notempfile option can be used to turn this feature off, if you're feeling spicy.)

Xdvi can show PostScript<tm> specials by any of three methods. she'll try first to use Display PostScript<tm>, then NeWS, then she'll try to use Ghostscript to render the images. all of these depend on extra software to work properly, and ngl, some of them may not even be compiled into this copy of xdvi. ๐Ÿ™ˆ

For performance reasons, xdvi does not render PostScript specials in the magnifying glass. she said not today. ๐Ÿ’€

If no file name has been specified on the command line, xdvi will try to open the most recently opened file. if the file history (accessible via the File > Open Recent menu) is empty, or if none of the files in the history are valid DVI files, she'll pop up a file selector for choosing a file name. (in previous versions, which didn't have a file history, the file selector was always used โ€” and if you want that old behaviour back, you can set the X resource noFileArgUseHistory to false. retro vibes, i guess. ๐ŸŽ€)


๐Ÿ’… OPTIONS ๐Ÿ’…

okay so, on top of specifying the dvi file (with or without the .dvi extension), xdvi supports the following command line options. here's the lil rule that trips people up: if the option begins with a + instead of a -, the option is restored to its default value. and by default, all these options can be set via the resource names given in parentheses in each option's description. resource names in parens = the secret handshake. iykyk. โœจ

  • +page โ€” specifies the first page to show. if + is given without a number, the last page is assumed; the first page is the default. ๐Ÿ“
  • -allowshell โ€” (.allowShell) this enables the shell escape in PostScript specials. (for security reasons, shell escapes are disabled by default.) this option should be rarely used โ€” in particular, do not use it just to uncompress files: that function is done automatically if the file name ends in .Z, .gz, or .bz2. and shell escapes are always turned off if the -safer option is used. ๐Ÿ‘‘
  • -altfont font โ€” (.altFont) declares a default font to use when the font in the dvi file cannot be found. this is useful, for example, with PostScript <tm> fonts.
  • -anchorposition anchor โ€” jump to anchor after opening the DVI file. this is only useful when invoking xdvi from other applications.
  • -background color โ€” (.background) determines the color of the background. same as -bg.
  • -bg color โ€” (.background) determines the color of the background. ๐Ÿ’–
  • -browser browser โ€” (.wwwBrowser) defines the web browser used for handling external URLs. the value of this option or resource has the same syntax as the BROWSER environment variable โ€” see the explanation of that variable in the ENVIRONMENT section below for a detailed description. if neither the option nor the X resource wwwBrowser is specified, the environment variables BROWSER and WWWBROWSER (in that order) are used to determine the browser command. if those aren't set either, this default value is used:
xdg-open %s:htmlview %s:firefox -remote -remote "openURL(%s,new-window)":mozilla -remote "openURL(%s,new-window)":netscape -raise -remote "openURL(%s,new-window)":xterm -e w3m %s:xterm -e lynx %s:xterm -e wget %s

that's a lot of fallbacks and honestly? she's prepared. ๐Ÿ’…

  • -copy โ€” (.copy) always use the copy operation when writing characters to the display. this option may be necessary for correct operation on a color display, but overstrike characters will be incorrect. and if greyscale anti-aliasing is in use, the -copy operation will disable the use of colorplanes and make overstrikes come out incorrectly. see also -thorough. ๐Ÿ˜ญ
  • -cr color โ€” (.cursorColor) determines the color of the mouse cursor. the default is the same as the foreground color.
  • -debug bitmask|string[,string ...] โ€” (.debugLevel) if nonzero, prints additional information on standard output. the argument can be either a bitmask specified as a decimal number, or a comma-separated list of strings.

for the bitmask representation, multiple values can be specified by adding the numbers that represent the individual bits; e.g. to debug all file searching and opening commands, use 4032 (= 2048 + 1024 + 512 + 256 + 128 + 64). use -1 to turn on debugging of everything (this will produce huge output ๐Ÿ’€).

for the string representation, use the strings listed in the following table, with a comma to separate the values; e.g. to debug all file searching and opening commands, use search,expand,paths,hash,stat,open. (the option kpathsea is provided as a shorthand for these.) note that such a list may need to be quoted to prevent the shell from interpreting commas or spaces in the list.

the individual numbers and strings have the following meanings:

  1      bitmap      Bitmap creation
  2      dvi         DVI translation
  4      pk          PK fonts
  8      batch       Batch mode: Exit after reading the DVI file
  16     event       Event handling
  32     ps          PostScript interpreter calls
  64     stat        Kpathsea stat(2) calls
  128    hash        Kpathsea hash table lookups
  256    open        Kpathsea file opening
  512    paths       Kpathsea path definitions
  1024   expand      Kpathsea path expansion
  2048   search      Kpathsea searching
  4032   kpathsea    All Kpathsea options
  4096   htex        Hypertex specials
  8192   src         Source specials
  16384  client      Client/server mode (see -unique and -sourceposition options)
  32768  ft          FreeType library messages (Type 1 fonts)
  65536  ft_verbose  Verbose FreeType library messages (currently unused)
  131072 gui         GUI elements
  262144 find        Searching for strings in the DVI file
  524288 files       File history and opening DVI files

some of the Kpathsea debugging options are actually provided by Kpathsea; see the Debugging section in the Kpathsea manual for more information on these. ๐Ÿ“š

  • -density density โ€” (.densityPercent) determines the density used when shrinking bitmaps for fonts. a higher value produces a lighter font. the default value is 40. if greyscaling is in use, this argument does not apply โ€” use -gamma instead. see also the S keystroke. same as -S.
  • -display host:display โ€” specifies the host and screen to be used for displaying the dvi file. by default this is obtained from the environment variable DISPLAY.
  • -dvipspath path โ€” (.dvipsPath) use path as the dvips program to use when printing. the default for this is dvips. the program or script should read the DVI file from standard input, and write the PostScript file to standard output. ๐ŸŒˆ
  • -editor editor โ€” (.editor) specifies the editor that will be invoked when the source-special() action is triggered to start a reverse search (by default via Ctrl-Mouse 1). the argument to this option is a format string in which occurrences of %f are replaced by the file name, occurrences of %l are replaced by the line number within the file, and optional occurrences of %c are replaced by the column number within the line. ๐ŸŽ€

Okay so, if neither the option nor the X resource .editor is specified, xdvi checks these env vars to figure out the editor command: XEDITOR, VISUAL, and EDITOR โ€” in that exact order, bestie. ๐Ÿ’– If the string is found as the value of VISUAL or EDITOR, then xterm -e gets prepended to the string (yes, with a trailing space, she's particular). If the editor is specified by other means, then it has to be in the form of a shell command to pop up an X window with an editor in it. If none of these variables is set, a warning message is displayed and the command xterm -e vi +%l %f is used. ๐Ÿ˜ญ

If no %f or %l occurs in the string, the missing format strings are appended automatically. (This is for compatibility with other programs when using one of the environment variables.) โœจ

A new instance of the editor is started each time this command is used; therefore it is preferable to use an editor that can be invoked in client mode to load new files into the same instance. Example settings are:

  • emacsclient --no-wait โ€” (older Emacsen)
  • gnuclient -q โ€” (XEmacs and newer Emacsen)
  • gvim --servername xdvi --remote โ€” (VIM v6.0+; the --servername xdvi option will cause gvim to run a dedicated instance for the files opened by xdvi.)
  • nc โ€” (nedit)

Note that those strings need to be enclosed into quotes when using them on the command-line to protect them from the shell; when using them as argument for the .editor resource in an X resource file, no quotes should be used. ๐Ÿซถ

NOTE ON SECURITY: The argument of this option isn't executed as a shell command, but via exec() to prevent evil tricks with the contents of source specials. ๐Ÿ”’

  • -expert โ€” This option is only supported for backwards compatibility; it is equivalent to -expertmode 0, which should be preferred. (so lowkey deprecated, bestie, use the new one ๐Ÿ’…)
  • -expertmode flag โ€” (.expertMode) With an argument of 0, this option switches off the display of the buttons, scrollbars, the toolbar (Motif only), the statusline and the page list. These GUI elements can also be (de)activated separately, by combining the appropriate values in the flag argument. This acts similar to the -debug option: The integer flag is treated as a bitmap where each bit represents one element. If the bit has the value 1, the element is switched on; if it has the value 0, the element is switched off. The meaning of the bits is as follows:
    • 1 โ€” statusline
    • 2 โ€” scrollbars
    • 4 โ€” Motif: pagelist, Xaw: buttons and pagelist
    • 8 โ€” toolbar (Motif only)
    • 16 โ€” menubar (Motif only)

For example, to turn on only the statusline and the scrollbars, use 3 (= 1 + 2). See also the x keystroke, where the bits are addressed by their positions, from 1 to 3 (Xaw) or 5 (Motif), respectively. ๐Ÿ”ฅ

If the statusline is not active, all messages that would normally be printed to the statusline will be printed to stdout, unless the -hushstdout option is used. ๐Ÿ‘‘

  • -fg color โ€” (.foreground) Determines the color of the text (foreground). ๐ŸŽจ
  • -findstring string โ€” This option triggers a search for string in the DVI file mentioned on the command-line, similar to forward search (see the description of the sourceposition option): If there is already another instance of xdvi running on the displaying that DVI file, it will cause that instance to perform the search instead. The search starts at the top of the current page of the DVI file. ๐Ÿ”
  • -font font โ€” (*font) Sets the font used in menus, buttons etc., as described in the X(7x) man page. The font for child windows can be set separately, e.g.:
xdvi*statusline*font: \
   -*-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*
  • -foreground color โ€” Same as -fg. ๐Ÿ’…
  • -fullscreen โ€” When this option is used, xdvi will (try to) run in fullscreen mode, with no window decorations. This option is not guaranteed to work with all windowmanagers/desktops; if you're experiencing problems with it, please use the -geometry option instead, and a suitable window manager setting to remove the window decorations. When using this option for presentations, you might want to get rid of all the control widgets as well, using the -expertmode option. This option can also be toggled at runtime using the fullscreen action (by default bound to Ctrl-l). ๐Ÿ–ฅ๏ธโœจ
  • -gamma gamma โ€” (.gamma) Controls the interpolation of colors in the greyscale anti-aliasing color palette. Default value is 1.0. For 0 < gamma < 1, the fonts will be lighter (more like the background), and for gamma > 1, the fonts will be darker (more like the foreground). Negative values behave the same way, but use a slightly different algorithm. For color and grayscale displays; for monochrome, see -density. See also the S keystroke. ๐ŸŒˆ
  • -geometry geometry โ€” (.geometry) Specifies the initial geometry of the main window, as described in the X(7x) man page. The geometry of child windows can be set separately, e.g.:
xdvi*helpwindow.geometry: 600x800
  • -gsalpha โ€” (.gsAlpha) Causes Ghostscript to be called with the x11alpha driver instead of the x11 driver. The x11alpha driver enables anti-aliasing in PostScript specials, for a nicer appearance. It is available on newer versions of Ghostscript. This option can also be toggled with the V keystroke. ๐Ÿ‘‘
  • -gspalette palette โ€” (.palette) Specifies the palette to be used when using Ghostscript for rendering PostScript specials. Possible values are Color, Greyscale, and Monochrome. The default is Color. ๐ŸŽจ
  • -h, -help, --help โ€” Prints a short help text with an overview of the command-line options to standard output. ๐Ÿ†˜
  • -hl color โ€” (.highlight) Determines the color of the page border, of the ruler in ruler mode, and of the highlighting markers in forward search and string search. The default is the foreground color. ๐Ÿ’…
  • -hush โ€” (.Hush) Causes xdvi to suppress all suppressible warnings. ๐Ÿคซ (so it shuts up, basically)
  • -hushbell โ€” (.hushBell) Don't sound the X bell when an error occurs. ๐Ÿ”• (no annoying dings, periodt)
  • -hushchars โ€” (.hushLostChars) Causes xdvi to suppress warnings about references to characters which are not defined in the font. ๐Ÿšซ
  • -hushchecksums โ€” (.hushChecksums) Causes xdvi to suppress warnings about checksum mismatches between the dvi file and the font file. โœ…
  • -hushstdout โ€” (.hushStdout) Suppresses printing of status messages to stdout. Note that errors or warnings will still be printed to stderr even if this option is used. ๐Ÿ“ข
  • -icongeometry geometry โ€” (.iconGeometry) Specifies the initial position for the icon. ๐Ÿ“
  • -iconic โ€” (.iconic) Causes the xdvi window to start in the iconic state. The default is to start with the window open. ๐ŸชŸ (so it starts minimized, lowkey)
  • -install โ€” (.install) If xdvi is running under a PseudoColor visual, then (by default) it will check for TrueColor visuals with more bits per pixel, and switch to such a visual if one exists. If no such visual exists, it will use the current visual and colormap. If -install is selected, however, it will still use a TrueColor visual with a greater depth, if one is available; otherwise, it will install its own colormap on the current visual. If the current visual is not PseudoColor, then xdvi will not switch the visual or colormap, regardless of its options. The default value of the install resource is the special value, maybe. There is no +install option. See also -noinstall, and the GREYSCALING AND COLORMAPS section. ๐ŸŒˆ
  • -interpreter filename โ€” (.interpreter) Use filename as the Ghostscript interpreter. By default it uses gs. ๐Ÿ‘ป
  • -keep โ€” (.keepPosition) Sets a flag to indicate that xdvi should not move to the home position when moving to a new page. See also the k keystroke. This flag is honored by all page switching actions and by up-or-previous() / down-or-next(), although the latter only honor the horizontal position, not the vertical one. This allows for a "continuous" scrolling back and forth through a document with a display window narrower than a page width. ๐Ÿ“œ
  • -l โ€” (.listFonts) List the names of all fonts used. ๐Ÿ”ค
  • -license โ€” Prints licensing information. ๐Ÿ“„
  • -linkcolor โ€” (.linkColor) Color used for unvisited hyperlinks (Blue2 by default). Hyperlinks are unvisited before you click on them, or after the DVI file has been reloaded. The value should be either a valid X color name (such as DarkGoldenrod4) or a hexadecimal color string (such as #8b6508). See also -visitedlinkcolor and -linkstyle. ๐Ÿ”—
  • -linkstyle โ€” (.LinkStyle) Determines the style in which hyperlinks are displayed. Possible values and their meanings are:
    • 0 โ€” No highlighting of links
    • 1 โ€” Underline links with link color
    • 2 โ€” No underlining, color text with link color
    • 3 โ€” Underline and display text colored with link color

The values for link color are specified by the options/resources -linkcolor and -visitedlinkcolor (which see). ๐ŸŽจ

  • -margins dimen โ€” (.Margin) Specifies the size of both the top margin and side margin. This determines the ``home'' position of the page within the window as follows. If the entire page fits in the window, then the margin settings are ignored. If, even after removing the margins from the left, right, top, and bottom, the page still cannot fit in the window, then the page is put in the window such that the top and left margins are hidden, and presumably the upper left-hand corner of the text on the page will be in the upper left-hand corner of the window. Otherwise, the text is centered in the window. The dimension should be a decimal number optionally followed by any of the two-letter abbreviations for units accepted by TeX (pt, pc, in, bp, cm, mm, dd, cc, or sp). By default, the unit will be cm (centimeters). See also -sidemargin, -topmargin, and the keystroke M. ๐Ÿ“
  • -mfmode mode-def โ€” (.mfMode) sets a mode-def string, and that string gets used when xdvi goes looking for fonts (peep ENVIRONMENT down below for the deets). Heads up bestie: when you switch up the mode-def, you're usually gonna have to change the font size to whatever value matches that mode. How? Add a colon and then the value in dots per inch. Like this: -mfmode ljfour:600. ๐Ÿ’… And this method overrides anything the pixelsPerInch resource or the -p command-line argument tried to say. The metafont mode also gets handed off to metafont during automatic creation of fonts. Default? Unspecified, as in, it just vibes with nothing set. ๐Ÿฆ‹
  • -mgs size โ€” literally the same thing as -mgs1. That's it, that's the whole option. ๐Ÿ˜Œ
  • -mgs[n] size โ€” (.magnifierSize[n]) sets how big the window is for the "magnifying glass" attached to Button n. You can pass it as a plain integer (which means the magnifier is a square ๐Ÿ”ฒ), or in the form widthxheight. Go read MOUSE ACTIONS for the lore. The defaults, in order: 200x150, 400x250, 700x500, 1000x800, and 1200x1200. โœจ
  • -mousemode [0|1|2] โ€” (.mouseMode) picks what mode xdvi starts up in: Magnifier (0), Text Selection Mode (1), or Ruler Mode (2). The MODES section below spills all the tea. ๐Ÿซถ
  • -nocolor โ€” (.color) turns off the use of color specials, full stop. You can toggle this live with the C keystroke. (Note: -nocolor corresponds to color:off; +nocolor to color:on.) ๐ŸŒˆ
  • -nofork โ€” (.fork) okay so when you pair -sourceposition and -unique, the default behavior is that xdvi yeets itself into the background (like a daemon ๐Ÿ‘ป) if there's no appropriate instance of xdvi already running. This argument says nope, stay in the foreground instead. Super useful for debugging, or if your client app just cannot handle a program self-backgrounding like that โ€” e.g. the IPC functions in emacs are known to have problems with this. ๐Ÿ™ˆ If you pass neither -sourceposition nor -unique, then this option does absolutely nothing. (Note: -nofork corresponds to fork:off; +nofork to fork:on.)
  • -noghostscript โ€” (.ghostscript) blocks Ghostscript from being used to display PostScript<tm> specials. No Ghostscript, no ghosting. (Note: -noghostscript corresponds to ghostscript:off; +noghostscript to ghostscript:on.) ๐Ÿ‘ป
  • -nogrey โ€” (.grey) switches off greyscale anti-aliasing when printing shrunken bitmaps. (Note: -nogrey corresponds to grey:off; +nogrey to grey:on.) Also go check the G keystroke. ๐Ÿ’€
  • -nogssafer โ€” (.gsSafer) normally, when Ghostscript is used to render PostScript specials, the Ghostscript interpreter runs with the option -dSAFER. This option runs Ghostscript without -dSAFER. Why care? Because -dSAFER in Ghostscript disables PostScript operators such as deletefile, so that possibly malicious PostScript programs can't do any damage. ๐Ÿšจ If you specified the -safer option, then this option has no effect; in that case Ghostscript is always run with -dSAFER. (Note: -nogssafer corresponds to gsSafer:off; +nogssafer to gsSafer:on.)
  • -noinstall โ€” (.install) inhibits the default behavior of switching to a TrueColor visual if one is available with more bits per pixel than the current visual. (Note: -noinstall corresponds install:off; there is no +noinstall option.) Also see -install, plus the GREYSCALING AND COLORMAPS section. ๐ŸŽจ
  • -nomakepk โ€” (.makePk) turns off automatic generation of font files that can't be found by any other means. (Note: -nomakepk corresponds to makePk:off; +nomakepk to makePK:on.) โญ
  • -nomatchinverted โ€” (.matchInverted) don't highlight string search matches in inverted color; instead, draw a rectangle in highlight color (see the -hl option) around the match. This one activates automatically if the display isn't running in TrueColor. (Note: -nomatchinverted corresponds to matchInverted:off; +nomatchinverted to matchInverted:on.) ๐Ÿ”
  • -noomega โ€” (.omega) disables the use of Omega extensions when interpreting DVI files. By default, the additional opcodes 129 and 134 are recognized by xdvi as Omega extensions and interpreted as requests to set 2-byte characters. The only drawback? The virtual font array then requires 65536 positions instead of the default 256 positions, i.e. xdvi's memory requirements get slightly larger. If you find that unacceptable, or you hit another problem with the Omega extensions, you can switch this extension off with -noomega โ€” but please do send a bug report if you find such problems, see the bug address in the AUTHORS section below. ๐Ÿ™

(Note: -noomega corresponds to omega: off; +noomega to omega: on.)

  • -noscan โ€” (.prescan) by default, xdvi does a preliminary scan of the dvi file to process any papersize specials. This matters a lot at startup since the paper size may be needed to determine the window size. If PostScript<tm> is in use, then prescanning is also necessary in order to properly process header files. On top of that, prescanning is needed to correctly determine the background color of a page. This option turns off such prescanning. (Prescanning will automatically be turned back on if xdvi detects any of the specials mentioned above.) (Note: -noscan corresponds to prescan:off; +noscan to prescan:on.) ๐Ÿ‘€
  • -notempfile โ€” (.tempFile) remember how in DESCRIPTION above we said xdvi makes a temporary copy of the DVI file so it can be accessed without interruptions even while TeX is rewriting it? Well, that introduces the overhead of copying the file every single time it changes, so -notempfile lets you turn that behavior off. Downside: if you do that, exposing parts of the window while the DVI file is being written by TeX will erase the current window contents until the DVI file can be completely reread. ๐Ÿ˜ญ

(Note: -notempfile corresponds to tempFile:off; +notempfile to tempFile:on.)

  • -notype1fonts โ€” (.type1) disables the use of the FreeType library to display PostScript<tm> Type 1 fonts. Use this as a workaround when you're hitting problems displaying Type 1 fonts โ€” but please don't forget to send a bug report in that case, to the URL mentioned in the AUTHORS section below. (Note: -notype1fonts corresponds to type1:off; +notype1fonts to type1:on.) ๐Ÿ›
  • -noxi2scrolling โ€” (.xi2Scrolling) disables high-resolution scrolling via the XInput 2.1 features of the X Server. When it is enabled, horizontal and vertical scrolling happens in smaller increments than a single click of a mouse wheel would give you. Only available for hardware that supports the feature โ€” generally touchpads. Traditional wheel mice? Not it. If suitable hardware isn't present, or the X server doesn't support XInput 2.1 or higher, then the high-resolution scrolling feature is turned off and has no effect. (Note: -noxi2scrolling corresponds to xi2Scrolling:off; +noxi2scrolling, to xi2Scrolling:on.) ๐ŸŒŠ
  • -offsets dimen โ€” (.Offset) sets the size of both the horizontal and vertical offsets of the output on the page. By decree of the Stanford TeX Project ๐Ÿ‘‘, the default TeX page origin is always 1 inch over and down from the top-left page corner, even when non-American paper sizes are used. So the default offsets are 1.0 inch. The dimen argument should be a decimal number optionally followed by any of the two-letter abbreviations for units accepted by TeX: pt, pc, in, bp, cm, mm, dd, cc, or sp. By default, the unit is cm (centimeters). See also -xoffset and -yoffset. ๐Ÿ“
  • -p pixels โ€” (.pixelsPerInch) defines the size of the fonts to use, in pixels per inch. Default value is 600. This option exists only for backwards compatibility; the preferred way is to set both the resolution and the Metafont mode via the -mfmode option (which see). ๐Ÿซถ
  • -paper papertype โ€” (.paper) specifies the size of the printed page. Note that in most cases it's best to specify the paper size in the TeX input file via the line
\usepackage[dvips]{geometry}

which will be recognized by both dvips and xdvi; in that case the use of a -paper option should be unnecessary. ๐Ÿ’…

The paper size may be specified in the form widthxheight optionally followed by a unit, where width and height are decimal numbers giving the width and height of the paper, and the unit is any of the two-letter abbreviations for units accepted by TeX (pt, pc, in, bp, cm, mm, dd, cc, or sp). By default, the unit is cm (centimeters).

There are also synonyms you can use: us (8.5x11in), legal (8.5x14in), foolscap (13.5x17in), as well as the ISO sizes a1-a7, b1-b7, c1-c7. Each of these also has a landscape or 'rotated' variant: usr (11x8.5in), a1r-a7r, etc. For compatibility with dvips, the formats letter (8.5x11in), ledger (17x11in) and tabloid (11x17in) are also supported (these don't have rotated variants).

Any of the above sizes may be preceded by a plus sign (+); this causes the paper size given here to override any paper size given in the dvi file. The default paper size is 21 x 29.7 cm (A4 size). ๐ŸŽ€

  • -pause โ€” (.pause) this one gives you a simple implementation of incremental (stepwise) display, perfect for presentations, main character energy on stage fr. โœจ When this option is used, xdvi will pause the display of the current page whenever it encounters a special special-string (xdvi:pause by default; the string can be customized via -pausespecial, see below), and the cursor will change its shape. The action unpause-or-next() (by default bound to the Space key) will display the next portion of the page up to the following special-string, or until the end of the page is reached. When the option is not used, specials containing special-string will be ignored. ๐Ÿ’œ
  • -pausespecial special-string โ€” (.pauseSpecial) this is the special string that makes xdvi pause when the -pause option is on. The default for special-string is xdvi:pause. Slay.
  • -postscript flag โ€” (.postscript) okay so three moods here:
    • flag = 0 โ†’ rendering of PostScriptโ„ข specials is disabled, and instead you get bounding boxes displayed (if available).
    • flag = 1 (the default) โ†’ PostScriptโ„ข specials are switched on.
    • flag = 2 โ†’ PostScriptโ„ข specials are displayed together with their bounding boxes, which lets you visually check whether the bounding boxes are actually correct. Obsessed. You can also toggle these at runtime with the v keystroke plus the matching numerical prefix arguments 0, 1 and 2.
  • -ps2pdfpath path โ€” (.ps2pdfPath) use path as the conversion program from PostScript to PDF. The program or script should accept two command-line arguments: the PostScript file as first argument, and the PDF output file as second argument.
  • -rulecolor color โ€” (.ruleColor) sets the color of the rules used for the magnifier (default: foreground color).
  • -q โ€” (.noInitFile) ignore the $HOME/.xdvirc startup file (like, don't read it at startup and don't write it at exit). This forces the defaults defined in $HOME/.Xdefaults to be used. See FILES for more info on $HOME/.xdvirc.
  • -rv โ€” (.reverseVideo) makes the page display with white characters on a black background, instead of the other way round. ๐Ÿ–ค
  • -S density โ€” (.densityPercent) same as -density (which see).
  • -s shrink โ€” (.shrinkFactor) defines the initial shrink factor. The default value is 8. If shrink is given as 0, then the initial shrink factor is computed so that the page fits within the window (as if the s keystroke were given without a number).
  • -safer โ€” (.safer) this option turns on all available security options; it's designed for use when xdvi is called by a browser that obtains a dvi or TeX file from another site. This option selects +nogssafer and +allowshell.
  • -sidemargin dimen โ€” (.sideMargin) specifies the side margin (see -margins).
  • -sourceposition line[:col][ ]filename โ€” no cap, this one is a whole situation, so buckle up ๐Ÿซถ

This option makes xdvi search in the dvi file for the place corresponding to the indicated line (and, optionally, column) in the .tex source file, and highlight the place found by drawing a rectangle in the highlight color (see the -hl option) around the corresponding text. In addition, when run with this argument (and the -nofork option is not given, which see), xdvi will always return immediately: if it finds another instance of xdvi already showing dvi_file, then it will cause that instance to raise its window and move to the given place in the dvi file; otherwise it will start up its own instance in the background. If several instances of xdvi are displaying the respective dvi file, the instance which was last raised to the foreground will be used.

The space before filename is only needed if the filename starts with a digit. When the space is used, the argument needs to be enclosed in quotes to prevent the shell from misinterpreting the space as argument separator.

This option requires that dvi_file be prepared with source special information. See the section on SOURCE SPECIALS for details on how to do this.

Here's the more detailed tea on how the filename in the -sourceposition argument is matched with the filename in the source specials:

  1. If neither of the filenames contains a path name component, the filenames are compared ignoring the .tex extensions in both filenames.
  2. Otherwise, if one of the filenames does contain a path component (e.g.: ./test.tex, ../test.tex, /my/homedir/tex/test.tex or any combination of these), both filenames are expanded to a full path, with any occurrences of ../ and ./ expanded, and multiple slashes removed. The pathname in the -sourceposition is expanded relative to the current working directory of the xdvi -sourceposition invocation, and the pathnames in the source specials are expanded relative to the path of the current DVI file being viewed. The path names are then compared ignoring the .tex extensions in both path names.
  • -statusline โ€” (.statusline) this option is obsolete; use -expertmode flag instead (which see). It's giving legacy, bestie.
  • -text-encoding encoding โ€” (.textEncoding) use encoding as the text encoding of the string in the "Find" window. Usually this shouldn't be needed since the encoding is determined from the locale settings.
  • -thorough โ€” (.thorough) xdvi will usually try to ensure that overstrike characters (e.g. \notin) are printed correctly. On monochrome displays this is always possible with one logical operation, either and or or. On color displays, however, this may take two operations, one to set the appropriate bits and one to clear other bits. If that's the case, then by default xdvi will instead use the copy operation, which does not handle overstriking correctly. The -thorough option chooses the slower but more correct choice. See also -copy.
  • -topmargin dimen โ€” (.topMargin) specifies the top and bottom margins (see -margins).
  • -unique โ€” (.unique) this option will make another instance of xdvi running on the same display act as a server. For example, the invocation
xdvi -unique +5 file.dvi

will cause this other instance to load file.dvi on page 5 in place of the file that it is currently displaying. If there is already another instance of xdvi already displaying the file file.dvi, then it will just jump to page 5. If the other instance of xdvi is displaying a different file, it will load file.dvi instead. Otherwise, if no other instance of xdvi is currently running on the display, this option instead starts a new instance of xdvi in the background (unless the -nofork option is specified, which see) displaying page 5 of file.dvi.

The filename and the +n option for the page number are the only options available for controlling a remote instance of xdvi like this; all other options are currently ignored.

  • -useTeXpages โ€” use logical TeX pages (the values of the \count0 register) instead of physical pages for the pagelist labels and when jumping to a page in a document with the g keystroke (or the goto-page() action). This option can be toggled via the T keystroke. โœจ
  • -version โ€” print information on the version of xdvi.
  • -visitedlinkcolor โ€” (.visitedLinkColor) color used for visited hyperlinks (Purple4 by default). Hyperlinks become visited once you click on them. As for linkColor, the value should be either a valid X color name or a hexadecimal color string. ๐Ÿ’œ
  • -warnspecials โ€” (.warnSpecials) causes xdvi to print warnings about \special strings that it cannot process to stderr. These warnings are suppressed by default.
  • -watchfile n โ€” (.watchFile) if this option is set to a value larger than 0, xdvi will check the DVI file for changes every n seconds. If the DVI file has been completely written by TeX, it will be reloaded automatically. Fractional values (e.g. 2.5) are possible. The default for this option is 0, i.e. no watching. Since xdvi cannot handle partial DVI files, it tries not to reload the file while it is being rewritten. However, use of the magnifier or switching of pages requires reading (a part of) the DVI file, and if the tempfile option is switched off, this will erase the current contents of the window until the DVI file can be read entirely.
  • -wheelunit pixels โ€” (.wheelUnit) sets the number of pixels that a motion of a wheel mouse will move the image up, down, left, or right. (See the wheel and hwheel actions, below, for more information on this.) If set to zero, the wheel mouse functionality is (essentially) disabled. The default value is 80.
  • -xoffset dimen โ€” (.xOffset) specifies the size of the horizontal offset of the output on the page. See -offsets.
  • -yoffset dimen โ€” (.yOffset) specifies the size of the vertical offset of the output on the page. See -offsets.

โœจ KEYSTROKES โœจ

Xdvi recognizes the following keystrokes when typed in its window. Each may optionally be preceded by a (positive or negative) number, a prefix argument, whose interpretation will depend on the particular keystroke. This prefix argument can be discarded by pressing the "Escape" key. If present, the "Help", "Prior" and "Next" keys are synonyms for ?, b, and f keys, respectively.

The key bindings listed here are those that xdvi assigns by default. The names appearing in brackets at the beginning of the descriptions are the names of the actions associated with the keys; these can be used to customize the key bindings, as explained in more detail in the section CUSTOMIZATION below. If only a lowercase binding is listed, both upper- and lowercase keys will work for that binding. periodt ๐Ÿ’…

  • ESC key โ€” [discard-number()] the escape key discards the numerical prefix for all actions (super useful when you mistyped a number, we've all been there ๐Ÿ™ˆ).
  • Return key โ€” [forward-page()] moves to the next page (or to the *n*th next page if a number is given). Synonyms are n, f and Line Feed.
  • Backspace key โ€” [back-page()] moves to the previous page (or back n pages). Synonyms are p, b and Ctrl-h.
  • Delete key โ€” [up-or-previous()] moves up two-thirds of a window-full, or to the top of the previous page if already at the top of the page. With a float argument, moves up the corresponding fraction of a window-full.
  • Space key โ€” [unpause-or-next()] glides you down two-thirds of a window-full, or straight to the next page if you're already at the bottom of the page. โœจ

But wait, plot twist: when the option -pause special-string is in play and the display is currently paused, this key instead shows you the next portion of the page until it bumps into the next special-string or the end of the page. Peep the description of the -pause option for the whole story. The action [down-or-next()] does a similar thing, just without the pausing โ€” and it's not bound to a key by default.

  • Ctrl-Home (Xaw), Ctrl-osfBeginLine (Motif) โ€” [goto-page(1)] teleports you to the first page of the document. ๐Ÿ‘‘
  • Ctrl-End (Xaw), Ctrl-osfEndLine (Motif) โ€” [goto-page()] takes you to the last page of the document. ๐ŸŽ€
  • Home (Xaw), osfBeginLine (Motif) โ€” [home-or-top()] moves to the ``home'' position of the page, or to the top of the page if the keep flag is set (and in that case, the page doesn't scroll horizontally at all, bestie).
  • End (Xaw), osfEndLine (Motif) โ€” [end-or-bottom()] moves to the ``end'' position of the page (that's the lower right-hand corner, iykyk), or to the bottom of the page if the keep flag is set (and again, no horizontal scrolling in that case).
  • Down arrow โ€” [down(0.015)] scrolls page down. ๐Ÿฆ‹
  • Up arrow โ€” [up(0.015)] scrolls page up.
  • Right arrow โ€” [right(0.015)] scrolls page right.
  • Left arrow โ€” [left(0.015)] scrolls page left.
  • Alt-Ctrl-+ โ€” [change-density(25)] makes the fonts in the DVI window darker by adding to the gamma value (also see the S keystroke, they're besties).
  • Alt-Ctrl-- โ€” [change-density(-25)] makes the fonts in the DVI window lighter by subtracting from the gamma value (again, see the S keystroke).
  • Ctrl-+ โ€” [set-shrink-factor(+)] bumps the shrink factor up (see also the s keystroke).
  • Ctrl-- โ€” [set-shrink-factor(-)] brings the shrink factor down (see also the s keystroke).
  • Ctr-[ โ€” [pagehistory-delete-backward()] deletes the current item in the page history and moves to the history item before the deleted one. Give it a prefix argument n and it deletes n previous history items. See PAGE HISTORY for the deets.
  • [ โ€” [pagehistory-back()] moves back in the page history (see PAGE HISTORY for the deets). With a prefix argument n, it moves back n history items.
  • Ctr-] โ€” [pagehistory-delete-forward()] deletes the current item in the page history and moves to the history item after the deleted one. With a prefix argument n, it deletes n next history items. See PAGE HISTORY for the deets.
  • ] โ€” [pagehistory-forward()] moves forward in the page history (see PAGE HISTORY for the deets). With a prefix argument n, it moves forward n history items.
  • ^ โ€” [home()] moves to the ``home'' position of the page. That's normally the upper left-hand corner of the page, depending on the margins as described in the -margins option above. ๐Ÿ’–
  • ? โ€” [help()] same as the h key (which see).
  • B โ€” [htex-back()] jumps back to the previous hyperlink anchor. The HYPERLINKS section has more on navigating links. ๐Ÿ”ฅ
  • b โ€” [back-page()] moves to the previous page (or back n pages). Synonyms are p, Ctrl-h and Backspace.
  • C โ€” [set-color()] toggles the use of color specials. The key sequences 0C and 1C turn interpretation of color specials off and on, respectively. See also the -nocolor option. ๐ŸŒˆ
  • c โ€” [center()] moves the page so the point currently beneath the mouse cursor lands in the middle of the window, and warps the mouse cursor to that same place. โœจ
  • D โ€” [toggle-grid-mode()] toggles the use of a grid on the displayed page. Give it no number and the grid mode just switches on or off. Prepend a number from 1 to 3 and you can set 3 different grid levels. The units of the grid are inches or centimeters, depending on whether the paper format is letter (in) or a4 (cm).
  • d โ€” [down()] moves the page down two thirds of a window-full. With a float argument to ``down'', it moves down that corresponding fraction of a window-full.
  • Ctrl-f โ€” [find()] pops up a window to search for a string in the DVI file. See the STRING SEARCH section below for more details. ๐Ÿ“
  • f โ€” [forward-page()] moves to the next page (or to the *n*th next page if a number is given). Synonyms are n, Return, and Line Feed.
  • G โ€” [set-greyscaling()] toggles the use of greyscale anti-aliasing for displaying shrunken bitmaps. Plus, the key sequences 0G and 1G clear and set this flag, respectively. See also the -nogrey option.

If you give it a numeric argument that is not 0 or 1, greyscale anti-aliasing gets turned on, and the gamma resource is set to the value divided by 100. E.g. 150G turns on greyscale and sets gamma to 1.5. ๐Ÿ’…

  • Ctrl-g โ€” [find-next()] finds the next match string in the DVI file; use this instead of pressing the Find button in the search window.
  • g โ€” [goto-page()] moves to the page with the given number. If no page number is given, xdvi jumps to the last page.

If the option/resource useTeXpages is active, the numbers correspond to the actual page numbers in the TeX file; otherwise, absolute page numbers (starting from 1) are used. In the latter case, the page numbers can be changed with the P keystroke below. Note that with the useTeXpages option it's possible that the same page number occurs multiple times; in such a case, xdvi will use the first page number that matches.

  • h โ€” pops up a help window with a short explanation of the most important key bindings and concepts. ๐Ÿซถ
  • k โ€” [set-keep-flag()] normally, when xdvi switches pages, it moves to the home position too. The k keystroke toggles a ``keep-position'' flag which, when set, keeps the same position when moving between pages. Also 0k and 1k clear and set this flag, respectively. See also the -keep option.
  • Ctrl-l โ€” [fullscreen(toggle)] toggles fullscreen mode (see the description of the -fullscreen option for more on that). Heads up though: this is even more flaky than using the command-line option. There is no universal standard for how a window could change its own geometry or window decorations at run-time, so this will not work with most window managers or desktops. Generally it's better to use the window manager controls to change the size or decorations of the xdvi window. ๐Ÿ’€
  • l โ€” [left()] moves the page left two thirds of a window-full.
  • M โ€” [set-margins()] sets the margins so that the point currently under the mouse cursor defines the upper left-hand corner of the text in the page. Note that this command does not move the image โ€” it only determines the margins for the page switching commands. For details on how the margins are used, see the -margins option.
  • m โ€” [toggle-mark()] toggles the mark for the current page in the page list. When a page is marked, it's displayed with a small star * next to the page number. The marked pages can then be printed or saved to a file. You can also mark a page or several pages by clicking or dragging Mouse-2 in the page list. โญ
  • Ctrl-n โ€” [toggle-mark()forward-page()] toggles the mark for the current page in the page list, and moves to the next page. This lets you quickly mark a whole series of subsequent pages. Obsessed.
  • n โ€” [forward-page()] moves to the next page (or to the *n*th next page if a number is given). Synonyms are f, Return, and Line Feed.
  • Ctrl-o โ€” [select-dvi-file()] reads a new dvi file. A file-selection widget pops up for you to choose the DVI file from. If a prefix argument n is given, the *n*th file from the file history is opened instead. ๐Ÿ“‚
  • P โ€” [declare-page-number()] This is page number *n*.'' This can be used to make the `g` keystroke refer to a different page number than the physical page. (If you want to use logical'' or TeX page numbers instead of physical pages, consider using the option -useTeXpages instead.) The argument n should be given as a prefix to this key.
  • Ctrl-p โ€” [print()] opens a popup window for printing the DVI file, or parts of it. See the PRINT DIALOG section for an explanation of the options available, and the resources to customize the default behaviour.
  • p โ€” [back-page()] moves to the previous page (or back n pages). Synonyms are b, Ctrl-h and Backspace.
  • q โ€” [quit()] quits the program. Bye bestie ๐Ÿ‘‹
  • Ctrl-r โ€” [forward-page(0)] redisplays the current page.
  • R โ€” [reread-dvi-file()] forces the dvi file to be reread. This lets you preview many versions of the same file while running xdvi only once. ๐Ÿงš
  • r โ€” [right()] moves the page right two thirds of a window-full.
  • Ctrl-s โ€” [save()] opens a popup window for saving the DVI file, or parts of it. See the SAVE DIALOG section below for more info on this.
  • S โ€” [set-density()] sets the density factor to be used when shrinking bitmaps. This should be a number between 0 and 100; higher numbers produce lighter characters. If greyscaling mode is in effect, this changes the value of gamma instead. The new value of gamma is the given number divided by 100; negative values are allowed.
  • s โ€” [set-shrink-factor()] changes the shrink factor to the given number. If no number is given, the smallest factor that makes the entire page fit in the window will be used. (Margins are ignored in this computation.) ๐Ÿ’œ
  • T โ€” [use-tex-pages()] uses logical TeX pages (the values of the \count0 register) instead of physical pages for the pagelist labels and when jumping to a page in a document via goto-page(). See also the -useTeXpages option.
  • t โ€” [switch-magnifier-units()] Swaps up which units the magnifier tick marks use, and which units get used when reporting the distance between the mouse pointer and the ruler centre in ruler mode (peep the MODES section). Default comes from the X resource tickUnits (which is mm unless you say otherwise). The units cycle through these, and except for px they're all straight-up TeX units: mm (millimeters), pt (TeX points), in (inches), sp (scaled points, the unit TeX uses internally), bp (big points, aka PostScript points), cc (cicero points), dd (didot points), pc (pica), and px (screen pixels). ๐Ÿ’…
  • Ctrl-u โ€” [back-page()toggle-mark()] Goes to the previous page and toggles the mark for that page. It's the dual action to Ctrl-n, bestie, they're a matched set ๐Ÿซถ
  • u โ€” [up()] Nudges the page up by two thirds of a window-full. Give up a float argument and it'll move up that fraction of a window-full instead. โœจ
  • Ctrl-v โ€” [show-source-specials()] Shows bounding boxes for every source special on the current page, and prints the strings inside those specials to stderr. With prefix 1, it shows every bounding box on the page. Mainly a debugging thing, ngl. ๐Ÿ”
  • V โ€” [set-gs-alpha()] Toggles anti-aliasing of PostScript<tm> specials when Ghostscript is doing the rendering. Also, the key sequences 0V and 1V clear and set this flag respectively. Check the -gsalpha option too. ๐ŸŒธ
  • v โ€” [set-ps()] Toggles how PostScript<tm> specials get rendered, between 3 states:
    • specials (like EPS graphics) are displayed;
    • specials are displayed along with their bounding box (if available);
    • only the bounding box is displayed.

You can also pick the states directly with 1v, 2v and 0v respectively. See also the -postscript option. ๐Ÿ‘‘

  • Ctrl-x โ€” [source-what-special()] Pops info about the source special next to the mouse cursor into the statusline. It's the same special that source-special() would find, except it doesn't launch your editor. For debugging purposes. ๐Ÿ›
  • x โ€” [set-expert-mode()] Toggles expert mode, where the statusline, the scrollbars, the menu buttons, the toolbar (Motif only) and the page list all go bye-bye. Typing 1x toggles the statusline at the bottom of the window. Typing 2x toggles the scrollbars (if available). For Xaw, 3x toggles the menu buttons and the page list; for Motif, it toggles the page list. In Motif, the extra bindings 4x toggle the toolbar, and 5x the menu bar. With no prefix argument, all of those GUI elements get either switched on (if they were invisible before) or off. Heads up though โ€” toggling scrollbars can act a whole mess with the Xaw widgets; like, the scrollbars may reappear after you resize the window, and at certain window sizes one of the scrollbars may just refuse to disappear. ๐Ÿ˜ญ See also the option -expertmode (those numbers above line up with the bits in the argument to -expertmode).

๐Ÿ–ฑ๏ธ MOUSE ACTIONS IN THE MAIN WINDOW ๐Ÿ–ฑ๏ธ

You can customize the mouse actions by setting the X resource mouseTranslations. Since there are three different mouse modes (scroll down to the MODES section), there's a special action mouse-modes that lists the actions for each of the three modes: mouse-modes("ACTIONS-FOR-MODE1", "ACTIONS-FOR-MODE2", "ACTIONS-FOR-MODE3"). If you only give one argument, that action is used for all modes. The default bindings are as follows:

xdvi.mouseTranslations: \
Shift<Btn1Down>:mouse-modes("drag(+)")\n\
Shift<Btn2Down>:mouse-modes("drag(|)")\n\
Shift<Btn3Down>:mouse-modes("drag(-)")\n\
Ctrl<Btn1Down>:mouse-modes("source-special()")\n\
<Btn1Down>: mouse-modes("do-href()magnifier(*2)", "text-selection()", "ruler()")\n\
<Btn2Down>: mouse-modes("do-href-newwindow()magnifier(*2)", "text-selection()", "ruler()")\n\
<Btn3Down>: mouse-modes("magnifier(*3)")\n\
<Btn4Down>: mouse-modes("wheel(-0.2)")\n\
<Btn5Down>: mouse-modes("wheel(0.2)")\n\
<Btn6Down>: mouse-modes("hwheel(-0.2)")\n\
<Btn7Down>: mouse-modes("hwheel(0.2)")\n\

Every one of those actions is broken down in more detail below. Note the quote symbols around the action strings โ€” those are necessary to group them into one argument. Buttons 4, 5, 6, and 7 refer to wheel movements (wheel up/down/left/right) on wheel mice. Not all mice support horizontal scrolling, fyi.

The X Toolkit routines that implement translations do not support event types of Btn6Down or Btn7Down. Because of that, xdvi implements its own parser for translations given in mouseTranslations. That parser is more limited than the one built into the X Toolkit. The string given in mouseTranslations should not begin with #replace, #augment, or #override. Modifiers of the form @keysym are not supported, and the event type must be of the form BtnDown or BtnnDown, where n is a positive integer without leading zeroes. Also, some limitations apply to the action field. ๐Ÿ’€
  • do-href()
  • do-href-newwindow()

Usually, if a binding specifies more than one action, all the actions get executed in a sequence. The hyperlink bindings do-href() and do-href-newwindow() are special in that they're used as an alternative to the other actions that might follow them โ€” but only if the mouse is currently sitting on a hyperlink. In that case, none of the other actions will be executed; otherwise, only the other actions get executed. The action do-href() jumps to the link target in the current xdvi window (possibly switching to another page), and do-href-newwindow() opens a whole new instance of xdvi for the link target. Either way, the location of the target gets indicated by a small arrow drawn in the same color as a visited link, in the left corner of the window. ๐ŸŽ€

  • magnifier(n x m)
  • magnifier(*n)

This action pops up a "magnifying glass" that shows the unshrunk image of the region around the mouse pointer. The magnifier vanishes when you let go of the mouse button. Move the cursor while holding the button down and the magnifier moves with it. ๐Ÿงš Different mouse buttons give you different sized windows, as indicated by the argument of the magnifier() action. That argument is either a string of the form widthx*height*, just like in the -mgsn command-line option, or one of the strings *1 through *5, referring to the value specified by the corresponding -mgsn option. โœจ

  • drag(+)
  • drag(|)
  • drag(-)

Drags the page around with the mouse. This action should have one parameter โ€” the character |, -, or + โ€” indicating vertical dragging only, horizontal dragging only, or dragging in all directions. ๐Ÿ’…

  • source-special()

This action starts a "reverse search", opening your editor right at the location in the TeX file corresponding to the pointer location in the DVI file. More info lives in the SOURCE SPECIALS section below. ๐Ÿ”ฅ

  • wheel()

Use this to scroll the image with a wheel mouse, where it's usually bound to mouse button 4 (wheel up) or 5 (wheel down). It takes one parameter, the distance to scroll the image. If the parameter contains a decimal point, the distance is in wheel units; otherwise, pixels. A negative value scrolls up, a positive value scrolls down. โญ

  • hwheel()

Same energy but sideways โ€” scroll the image horizontally with a wheel mouse, where it's usually bound to mouse button 6 (wheel left) or 7 (wheel right). Takes one parameter, the distance to scroll the image. If the parameter contains a decimal point, the distance is in wheel units; otherwise, pixels. A negative value scrolls left, a positive value scrolls right. Not all mice support horizontal scrolling; this one's mostly for touchpads, trackpads, etc. ๐Ÿซถ

  • text-selection()

Lets you mark a rectangular region of text in the DVI file. The text goes into the X selection buffer and can be pasted into other applications (text editors, hi bestie ๐Ÿ‘‹). This works similar to the Plain text option in the Save dialog; check the discussion there for more on encoding issues. ๐ŸŒˆ

  • ruler()

Creates a cross-shaped ruler. Move the mouse while holding the button down to drag the ruler and measure distances on the page. See the Ruler Mode section for more. ๐Ÿ“

โœจ UNBOUND ACTIONS โœจ

These ones are lowkey just sitting there โ€” not bound to any key by default, but bestie they are 100% available for customization. They're like the cool clothes in your closet you forgot you owned. ๐Ÿ‘‘

  • quit-confirm() โ€” Pops up a whole confirmation window asking if you really wanna quit xdvi. So polite. So demure. If you'd rather have it on the q key instead of the default quit() action, just drop this into your ~/.Xdefaults file:
xdvi.mainTranslations: #override\
<Key>q: quit-confirm()\n
  • down-or-next() โ€” Basically unpause-or-next()'s twin: it moves down two-thirds of a window-full, or, if you're already chilling at the bottom of the page, it just goes to the next page. Simple as that. ๐Ÿ’…
  • shrink-to-dpi() โ€” This one takes one (required) argument. It sets the shrink factor to an integer so it approximates using fonts with that corresponding number of dots per inch. So if xdvi is using fonts scaled for p dots per inch, and the argument to shrink-to-dpi is n, then the corresponding shrink factor is the ratio p/n, rounded to the nearest integer. Math queen behavior. ๐Ÿงฎ
  • user-exec() โ€” Also takes one (required) argument. It runs an external program specified by that argument, which gets tokenized on whitespace. The XDVI_FILE environment variable is set to the absolute pathname of the DVI file, so your program can actually find the DVI. For example, to make the key m regenerate the DVI file with make, put this into your ~/.Xdefaults file:
xdvi.mainTranslations: #override\
<Key>m: user-exec(xdvi-remake)\n

...where xdvi-remake names a program in your PATH that's analogous to cd $(dirname $XDVI_FILE) && make $(basename $XDVI_FILE). (Also go peek at the section SIGNALS for a way to get xdvi to reload the DVI file once it's been regenerated.) ๐Ÿซถ


๐ŸŽ€ CUSTOMIZATION ๐ŸŽ€

Key and mouse button assignments? Changeable, bestie. Just set the mainTranslations resource to a string of translations as defined in the documentation for the X toolkit. The actions should take the form of action names listed in the KEYSTROKES and MOUSE ACTIONS sections.

One exception to this: the Motif keys osfPageUp (PgUp), osfPageDown (PgDown), osfBeginLine (Home) and osfEndLine (End), which are currently not customizable in the Motif version. Tragic, but that's the lore. ๐Ÿ’€

Key actions will usually be without arguments; if they are passed an argument, it represents the optional number or prefix argument typed prior to the action.

Some key actions may take special arguments, and here's the rundown:

  • The argument of goto-page may be the letter e, indicating the action of going to the end of the document.
  • The argument of set-shrink-factor may be the letter a, indicating that the shrink factor should be set to the smallest value such that the page will fit in the window โ€” or one of the signs + or -, indicating that the shrink factor should be increased or decreased, respectively.
  • Finally, actions that would perform a toggle, such as set-keep-flag, may receive an argument t, indicating that the action should toggle regardless of the current prefix argument.

Mouse actions should refer only to ButtonPress events (e.g. <Btn1Down>:magnifier(*1)). The corresponding motion and release events will be handled internally. A key action may be bound to a mouse event, but not vice versa. Rules are rules. โœจ

Usually the string of translations should begin with #override, indicating that the default key and mouse button assignments should not be discarded.

When keys or mouse buttons involving modifiers (like Ctrl or Shift) are customized together with their non-modified equivalents, the modified keys should come first, for example:

xdvi.mainTranslations: #override \
Shift<Key>s: select-dvi-file()\n\
Ctrl<Key>s: save()\n\
<Key>s: find()\n

Because xdvi needs to capture pointer motion events, and because the X Toolkit translations mechanism cannot accommodate both motion events and double-click events at the same time, it is not possible to specify double-click actions in xdvi customizations. Yeah. That's just how it is. For info on this and other aspects of translations, see the X Toolkit Intrinsics documentation.

There's no command-line option to set the mainTranslations resource, since changing this resource on the command line would be hella cumbersome. If you wanna set the resource for testing purposes, use the -xrm command-line option provided by the X toolkit. For example, xdvi -xrm 'XDvi.mainTranslations: #override "z":quit()' ... or xdvi -xrm 'XDvi.mainTranslations: #override <Key>z:quit()' ... will cause the key z to quit xdvi. Slay. ๐Ÿฆ‹

Some resources are provided to allow customization of the geometry of the Xaw command buttons. Again, they are not changeable via command-line options, other than via the -xrm option. All of these resources take integer values. ๐Ÿ“

  • buttonSideSpacing โ€” The number of pixels to be placed on either side of the buttons. The default value is 6.
  • buttonTopSpacing โ€” The number of pixels between the top button and the top of the window. The default value is 50.
  • buttonBetweenSpacing โ€” The number of pixels between the buttons. The default value is 20.
  • buttonBetweenExtra โ€” The number of pixels of additional space to be inserted if the buttonTranslations resource string contains an extra newline character. The default value is 50.
  • buttonBorderWidth โ€” The border width of the button windows. The default value is 1.

๐ŸŒธ PAGE LIST ๐ŸŒธ

The scrollable page list on the right of the main window lets you jump directly to a page in the DVI file. It's giving table of contents but make it interactive. ๐Ÿ’–

  • Mouse-1 โ€” Jumps to the page the mouse is located on.
  • Mouse-2 โ€” [toggle-mark()] Toggle the mark of the current page. The marks are used by the Print and Save to file dialogs to select only marked pages from the DVI file.

When the mouse pointer is inside the page list, the mouse wheel switches to the next or previous page. Cute AND functional. โœจ


๐ŸŒˆ SCROLLBARS ๐ŸŒˆ

The scrollbars (if present) behave in the standard way:

  • Pushing Button 2 in a scrollbar moves the top or left edge of the scrollbar to that point and optionally drags it.
  • Pushing Button 1 moves the image up or right by an amount equal to the distance from the button press to the upper left-hand corner of the window.
  • Pushing Button 3 moves the image down or left by the same amount.

The scrollbars can be removed via the -expertmode flag/keystroke (which see). Bye bye scrollbars. ๐Ÿ‘‹


๐Ÿ”ฅ MAGNIFIER ๐Ÿ”ฅ

By default, the mouse buttons 1 to 5 will pop up a magnifying glass that shows an unshrunken image of the page (i.e. an image at the resolution determined by the option/X resource pixels or mfmode) at varying sizes. When the magnifier is moved, small ruler-like tick marks are displayed at the edges of the magnifier (unless the X resource delayRulers is set to false, in which case the tick marks will always be displayed). The unit of the marks is determined by the X resource tickUnits (mm by default). This unit can be changed at runtime via the action switch-magnifier-units(), by default bound to the keystroke t (see the description of that key, and of switch-magnifier-units() for more details on the units available).

The length of the tick marks can be changed via the X resource tickLength (4 by default). A zero or negative value suppresses the tick marks. Gone. Poof. ๐Ÿ’…


๐Ÿงš PAGE HISTORY ๐Ÿงš

Xdvi keeps a history of viewed pages, and you can move through the history and delete items using the keys:

  • [ (pagehistory-back())
  • ] (pagehistory-forward())
  • Ctr-[ (pagehistory-delete-backward())
  • Ctr-] (pagehistory-delete-forward())

When one of the history commands is used, the page history is displayed in the status line at the bottom of the window, with the current list item marked by square brackets [, ] and a left and right context of at most 10 items. File boundaries are marked by #. So organized of it. ๐Ÿ’œ

The size of the history can be customized with the X resource pageHistorySize (the default size is 1000 items). If the size is set to 0, the history commands are disabled. RIP to your history. ๐Ÿ˜ญ


The actions do-href() and do-href-newwindow() (by default bound to Mouse-1 and Mouse-2 if the pointer is currently located on a hyperlink) can be used to open the link target in the same window (do-href()) or in a new window (do-href-newwindow()). Main character energy, opening links and everything. ๐Ÿ‘‘

If the link target is not a file on the local disk, xdvi tries to launch a web browser (as specified by the -browser command line option, the BROWSER environment variable or the wwwBrowser X resource, in this order) to retrieve the document. See the description of the BROWSER environment variable, below, for an example setting.

If the file is a local file, xdvi tries to determine if it's a DVI file. If it is, xdvi will try to display the file; otherwise it will try to determine the MIME type of the file, and from that an application suitable for opening the file. This is done by parsing the files specified by the environment variable EXTENSIONMAPS for a mapping of filename extensions to MIME types, and the files determined by the environment variable MAILCAPS for a mapping of MIME types to application programs. See the descriptions of these variables in the section ENVIRONMENT, below, for a more detailed description and the default values of these variables. If no suitable files are found, a set of built-in default MIME types and applications is used.

Xdvi currently uses no heuristics apart from the filename suffix to determine the mime type of a file. If a filename has no suffix, the value of the resource noMimeSuffix is used (by default application/x-unknown). If the suffix doesn't match any of the suffixes in mime.types, the value of the resource unknownMimeSuffix is used (by default application/x-unknown). If the mailcap entries do not list a viewer for a given mime type, xdvi will show a warning popup. If you want to avoid this warning, and for example want to always use the netscape browser for unknown MIME types, you could add the following line to your ~/.mailcap file:

application/xdvi-unknown; \
    netscape -raise -remote 'openURL(%s,new-window)'
fr fr, that popup is annoying โ€” now you know how to silence it. ๐Ÿ“

Okay bestie, you wanna find stuff in your DVI file? Say less. Hit Ctrl-f, or go through the menu at File > Find ..., or โ€” if you're on Motif โ€” tap that little Binoculars icon in the toolbar ๐ŸŽ€. Boom, a dialog window pops open and you can search for a text string or a regular expression inside the DVI file. And when you wanna hop to the next match? That's Ctrl-g, which is literally the same thing as smashing the Find button in that search window. Periodt ๐Ÿ’…

So by default, your matches get highlighted in inverted color โœจ. But โ€” and this is important โ€” if your display isn't running in TrueColor, or if the X resource matchHighlightInverted is set to false, or you used the command-line option -nomatchinverted, then xdvi does something else instead: it draws a rectangle in highlight color around the match (that's the color from the -hl option, iykyk).

If a match crosses a page boundary, only the part on the first page gets highlighted, no cap. Xdvi will scan up to 2 adjacent pages to match strings that cross page boundaries โ€” but heads up: header or footer lines, or intervening float pages, get treated as parts of the scanned text. And that text will usually make multi-page matching fail ๐Ÿ˜ญ.

This is the whole vibe of why searching in the formatted text (your DVI output) is a whole different beast from searching the source text: searching the DVI file makes it way easier to skip formatting instructions, and it lets you search for stuff like hyphenation and equation numbers ๐Ÿ”ฅ. But sometimes the formatting results get in the way, like with footnotes. When that happens, searching in the TeX source is just better. And using source specials makes bouncing between the xdvi display and your editor with the TeX source way easier โ€” check the section SOURCE SPECIALS below for the tea on that ๐Ÿ‘‘

The text extracted from the DVI file is encoded in UTF-8 (you can literally view that text by saving the file in UTF-8 format via the File > Save as ... menu item ๐Ÿซถ). Now, if xdvi was compiled with locale, nl_langinfo() and iconv support, then your search term gets converted from the character set specified by the current locale into UTF-8. (Peep the output of locale -a for the list of locale settings available on your system ๐ŸŒˆ.) If nl_langinfo() isn't available but iconv is, you can specify the input encoding for iconv via the X resource textEncoding (check the output of iconv -l for a list of valid encodings). And if iconv support isn't available at all? Then only the encodings ISO-8859-1 and UTF-8 are supported โ€” and those names are case-insensitive, bestie.

Ideographic characters from CJKV fonts get treated specially: all white space (spaces and newlines) before and after such characters is ignored in the search string and in the DVI file. Iconic behavior honestly ๐Ÿ’–

Wanna match a newline character? Use \n in the search string. Wanna match the actual string \n? Then use \\n. Easy.


โœจ Regular Expression Mode โœจ

If the checkbox Regular Expression is activated, your string gets treated as a regular expression in extended POSIX syntax, with these properties:

  • a? matches a zero or one times.
  • a* matches a zero or more times.
  • a+ matches a one or more times. Note that * and + are greedy, i.e. they match the longest possible substring.
  • The pattern . matches any character except for newline. To also match a newline, use (.|\n).
  • a{n} matches a exactly n times.
  • a{n,m} matches a at least n and no more than m times.
  • a|b matches a or b. Brackets can be used for grouping, e.g.: (a|b)|c.
  • The string matched by the nth group can be referenced by \n, e.g. \1 refers to the first match.
  • The characters ^ and $ match the beginning and the end of a line, respectively.
  • [abc] matches any of the letters a, b, c, and [a-z] matches all characters from a to z.
  • Each item in a regular expression can also be one of the following POSIX character classes:
    • [[:alnum:]] [[:alpha:]] [[:blank:]] [[:cntrl:]] [[:digit:]] [[:graph:]] [[:lower:]] [[:print:]] [[:space:]] [[:upper:]]

These can be negated by inserting a ^ symbol after the first bracket: [^[:alpha:]]

For more details on POSIX regular expressions, see e.g. the IEEE Std 1003.1 standard definition available online from:

http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap09.html
  • As a non-standard extension, the following Perl-like abbreviations can be used instead of the POSIX classes:
    • \w โ€” an alphanumeric character โ€” [[:alnum:]]
    • \W โ€” a non-alphanumeric character โ€” [^[:alnum:]]
    • \d โ€” a digit character โ€” [[:digit:]]
    • \D โ€” a non-digit character โ€” [^[:digit:]]
    • \s โ€” a whitespace character โ€” [[:space:]]
    • \S โ€” a non-whitespace character โ€” [^[:space:]]
  • The following characters are special symbols; they need to be escaped with \ in order to match them literally: ( ) [ ] . * ? + ^ $ \.
  • Matches of length zero are silently skipped.

๐ŸŽ€ The Checkboxes ๐ŸŽ€

The dialog also gives you these little boxes to tick:

  • search backwards;
  • match in a case-sensitive manner (the default is to ignore case, i.e. a search string Test will match both the strings test and TEST in the DVI file);
  • ignore line breaks and hyphens: this removes all hyphens at the ends of lines and the following newline characters, and replaces all remaining newline characters by white spaces. So hyphenated words will appear as one word to the search, and a search for two words with a space in between will also match the words if they're separated by a linebreak.
Ngl, the hyphen removal may cause unwanted side effects for compound words containing hyphens that are wrapped after the hyphen ๐Ÿ˜ฌ. And replacing the newlines affects the interpretation of regular expressions like this: the . pattern will also match newlines, and ^ and $ won't match begin and end of lines any more. (And since currently there's no option for turning off the greediness of * and +, turning on this option will usually result in matches that are longer than desired ๐Ÿ’€.)

The current checkbox settings are saved in the ~/.xdvirc file. Slay, persistence ๐Ÿ’–


The print dialog window lets you print all pages, marked pages (click or drag Mouse-2 in the page list to mark them ๐Ÿ‘†), or a range of pages. Quick note though: the page numbers always refer to physical pages, so if you're using the option use TeX pages, you might wanna disable it to make it easier to figure out the correct page numbers โ€” or just dodge the whole problem by marking the pages you wanna print instead ๐Ÿซถ.

The value of the Printer text field gets passed to dvips via the -o! mechanism, as a single argument after the !. Any arguments listed in the Dvips options field get segmented at whitespace and passed as separate arguments to dvips. So if you, say, wanna print the file 2-up, you should enter the following string into the Printer field:

psnup -2 -q | lpr -Plp

There are several resources for customizing the behaviour and the default entries of the print dialog:

  • dvipsPrinterString, dvipsOptionsString โ€” these can be used to provide default entries for the Printer and the Dvips options text fields, respectively. If no paper size is specified in the DVI file (via e.g. \usepackage[dvips]{geometry} โ€” and this is the preferred method, btw), the input field is initialized with the current value of the command line option/X resource paper. E.g. the option -paper a4r is translated into the dvips options -t a4 -t landscape. Note that no check is performed whether dvips actually understands these options (it will ignore them if it can't); currently not all options used by xdvi are also covered by dvips ๐Ÿ˜ญ.
  • dvipsHangTime, dvipsFailHangTime โ€” these specify the time (in milliseconds) that the printing progress window will stay open after the dvips process has terminated. The value of dvipsHangTime is used if the process terminates successfully; dvipsFailHangTime is used if it terminates with an error. The default values are 1.5 and 5 seconds, respectively. And if both values are negative, the window will stay open until it's closed by the user ๐Ÿ‘‘

๐Ÿ’พ SAVE DIALOG ๐Ÿ’พ

This dialog lets you save all or selected/marked pages in the current DVI file. And you've got formats, bestie:

  • PostScript โ€” uses dvips to convert the DVI file to a PostScript file, just like when printing to a PostScript file.
  • PDF โ€” first uses dvips to convert the DVI file to a PostScript file, then uses ps2pdf to convert the PostScript file to PDF.
  • Plain text in ISO-8859-1 or UTF-8 encoding. The UTF-8 one will preserve more of the special LaTeX characters, e.g. from mathematical mode ๐ŸŒธ. But note that e.g. only few of LaTeX's mathematical symbols can be rendered correctly as text; so this functionality works best for plain text documents. If a character can't be displayed in the selected charset, it gets replaced by \' followed by the hexadecimal character code. And if a character isn't recognized at all, it gets replaced by ?.

The programs for PostScript and PDF conversion can be customized via the command line options or X resources -dvipspath/.dvipsPath and -ps2pdfpath/.ps2pdfPath, respectively โ€” see the explanation of these options above for more details โœจ

โœจ MODES โœจ

Okay bestie, listen up, because this one is actually so fun. You know how you can have different mouse personalities depending on your mood? That's what modes are. Hit Ctrl-m [switch-mode()] and you rotate through three whole different mouse bindings, and you can also do it from the Modes menu (in Motif it's a lil submenu of the Options menu, named Mouse Mode, cute right?).

Want to pick which one you wake up in? Customize it with the X resource mouseMode or the command-line option -mousemode. Out of the box you start in Magnifier Mode, no cap.

Heads up though โ€” the modes work by literally swapping out the magnifier() action. So if you customized Mouse-1 into an action sequence that doesn't contain magnifier(), switching modes justโ€ฆ won't do anything. ๐Ÿ’€ Sad but true.

๐Ÿ” Magnifier Mode

The classic. Mouse buttons 1 to 5 pop up a little ``magnifying glass'' that shows an unshrunken image of the page โ€” like, an image at the resolution determined by the option/X resource pixels or mfmode โ€” and each button gives you a different size. โœจ

When you move the magnifier around, tiny ruler-ish tick marks show up at the edges of the magnifierโ€ฆ unless you set the X resource delayRulers to false, in which case the tick marks are always there, no waiting. The unit of those marks comes from the X resource tickUnits (mm by default). You can swap units live at runtime with the action switch-magnifier-units(), which by default is bound to the keystroke t (go read that key's description, and the switch-magnifier-units() description too, for the whole rundown of available units).

Wanna change how long the ticks are? X resource tickLength (4 by default). Set it to zero or negative and boom, tick marks gone. ๐Ÿซถ


๐Ÿ“ Text Selection Mode

This one lets you select a rectangular region of text in the DVI file by holding down Mouse-1 and dragging the mouse. The text lands in the X primary selection, so you can paste it into other X applications with Mouse-2 like you always do. Iconic.

Now here's the โœจencodingโœจ tea. If xdvi was compiled with locale, nl_langinfo() and iconv support, your selected text gets converted into the character set of the current locale (peep the output of locale -a for the list of locale settings your system has). If nl_langinfo() isn't available but iconv is, you can specify the input encoding for iconv via the X resource textEncoding (see the output of iconv -l for a list of valid encodings). And if iconv support isn't available at all? Then only the encodings ISO-8859-1 and UTF-8 are supported (those names are case-insensitive, don't stress).

Important lore: UTF-8 is the only encoding that can render all characters (like, mathematical symbols and stuff) of a DVI file. If ISO-8859-1 is active, characters that can't be displayed get replaced by \ followed by the hexadecimal character code. For other encodings, those characters may trigger iconv error messages. And if a character isn't recognized at all, it gets replaced by ?. ๐Ÿฅฒ

Oh and if you want to extract bigger chunks of text? You can alternatively save selected pages, or the entire file, in text format via the File > Save as ... menu. Slay.


๐Ÿ“ Ruler Mode

A simple way to measure distances on the page. When this mode activates, the mouse cursor turns into a thin cross, and a larger, cross-shaped ruler is drawn in the highlight color right at the mouse location. The ruler doesn't have units attached to it โ€” instead, the current distance between the ruler and the mouse cursor is continuously printed to the statusline. Obsessed with the live readout tbh.

When you activate Ruler Mode, the ruler is first attached to the mouse and moves around with it. Click Mouse-1 to lock it into a fixed place. After that, you can move the mouse cursor to measure the horizontal (dx), vertical (dy) and direct (shortest) (dr) distance between the ruler center point and the mouse.

Click Mouse-1 again and the ruler jumps to the current mouse position, and holding down Mouse-1 drags the ruler around. ๐ŸŒธ

In Ruler Mode, these special keybindings extend or replace the default bindings:

  • o โ€” [ruler-snap-origin()] Snap the ruler back to the origin coordinate (0,0).
  • t โ€” [overrides switch-magnifier-units()] Toggle between various ruler units, which can be specified by the X resource tickUnits (mm by default).
  • P โ€” [overrides declare-page-number()] Print the distances shown in the statusline to standard output.

๐Ÿ›  TOOLBAR (Motif only) ๐Ÿ› 

Yes bestie, the Motif toolbar is customizable too. ๐Ÿ’… The XPM file used for the toolbar icons gets specified via the resource toolbarPixmapFile, which should contain a filename that can be found in one of XFILESEARCHPATH or XDVIINPUTS (go read the section FILE SEARCHING below for more on those variables).

Xdvi will try to split this pixmap horizontally into n pieces, where each piece is as wide as the pixmap is high and gets treated as the image for toolbar button n. Which means: each icon should be a square, and the entire pixmap should have width n x h if h is the height of the pixmap. Math but make it fashion. โœจ

The resource toolbarTranslations maps icons/buttons to specific actions. It should contain a string separated by newline characters, similar to the resources mainTranslations and menuTranslations. Every line must contain either a spacer definition or an icon definition:

A spacer definition is a string SPACER(n), where n is the number of pixels inserted as separator to the following button.

An icon definition is a colon-separated list containing the following elements:

  • the index of an icon in the pixmap file (starting from zero);
  • a long tooltip string, displayed in the status area;
  • a short tooltip string, displayed as popup;
  • a sequence of actions to be performed when the corresponding toolbar button is pushed.

To illustrate this, the default value of toolbarTranslations looks as follows:

xdvi.toolbarTranslations: \
   SPACER(5)\n\
   0:Open a new document   (Key\\: Ctrl-f):\
        Open file:select-dvi-file()\n\
   SPACER(10)\n\
   1:Reread this document   (Key\\: R):\
        Reread file:reread-dvi-file()\n\
   SPACER(10)\n\
   2:Go to the first page of this document   (Key\\: 1g):\
        Go to first page:goto-page(1)\n\
   3:Go to the previous page of this document   (Key\\: p):\
        Go to previous page:back-page(1)\n\
   4:Go to the next page of this document   (Key\\: n):\
        Go to next page:forward-page(1)\n\
   5:Go to the last page of this document   (Key\\: g):\
        Go to last page:goto-page()\n\
   SPACER(10)\n\
   6:Enlarge the display   (Key\\: Ctrl-+):Zoom in:\
        set-shrink-factor(+)\n\
   7:Shrink the display   (Key\\: Ctrl--):Zoom out:\
        set-shrink-factor(-)\n\
   SPACER(10)\n\
   8:Jump back to the previous hyperlink   (Key\\: B):\
        Back hyperlink:htex-back()\n\
   SPACER(10)\n\
   10:Print this document:Print:print()\n\
   SPACER(10)\n\
   11:Toggle marks for odd pages   (Key\\: 1m):\
        Toggle odd:toggle-mark(1)\n\
   12:Toggle marks for even pages   (Key\\: 2m):\
        Toggle even:toggle-mark(2)\n\
   13:Toggle mark for current page   (Key\\: 2m):\
        Toggle current:toggle-mark()\n\
   14:Unmark all pages   (Key\\: 0m):\
        Unmark all:toggle-mark(0)\n\
   SPACER(10)\n\
   18:Display fonts darker   (Key\\: Alt-Ctrl-+):\
        Fonts darker:change-density(5)\n\
   19:Display fonts lighter   (Key\\: Alt-Ctrl--):\
        Fonts lighter:change-density(-5)\n

When the mouse stays over a toolbar button for a certain period of time, a ``tooltip'' window pops up describing what the button does, using the short tooltip string from that resource. At the same time, the long tooltip string gets displayed in the statusline. The appearance and behaviour of these tooltips can be customized via the following resources:

  • tipShell.background โ€” Background color of the tooltip window.
  • tipShell.fontSet โ€” Font used for the tooltip.
  • tipShell.waitPeriod โ€” The time (in milliseconds) the mouse pointer needs to be over the button before the tooltip is shown. Set it to a negative value to suppress the tooltips altogether.

๐ŸŒˆ GREYSCALING AND COLORMAPS ๐ŸŒˆ

Okay so the greyscale anti-aliasing feature in xdvi will not work at its best if your display doesn't have enough colors available. This can happen if other applications are hogging most of the colormap (yes, even if they're iconified, rude). If this happens, xdvi will print an error message and turn on the -copy option. That results in overstrike characters appearing wrong, and it may also give you poor display quality if the number of available colors is really small. ๐Ÿ˜ญ

Typically this problem shows up on displays that allocate eight bits of video memory per pixel. Wanna see how many bits per pixel your display uses? Type xwininfo in an xterm window, then click the mouse on the root window when it asks. The ``Depth:'' entry will tell you how many bits are allocated per pixel. ๐Ÿ”

Displays using at least 15 bits per pixel are typically TrueColor visuals, which don't have this problem, since their colormap is permanently allocated and available to all applications. (The visual class is also displayed by xwininfo.) For more information on visual classes, see the documentation for the X Window System.

To alleviate this problem, therefore, you may:

  1. run with more bits per pixel (this may require adding more video memory or replacing the video card),
  2. shut down other applications that may be using much of the colormap and then restart xdvi, or
  3. run xdvi with the -install option.

One application which is often the cause of this problem is Netscape. In this case there are two more alternatives to remedying the situation:

  • You can run ``netscape -install'' to cause Netscape to install a private colormap. Warning: this can cause colors to change in bizarre ways when the mouse is moved to a different window. ๐Ÿ™ˆ
  • Or, you can run ``netscape -ncols 220'' to limit Netscape to a smaller number of colors. A smaller number will ensure that other applications have more colors available, but it will degrade the color quality in the Netscape window.

โœจ HANDLING OF POSTSCRIPT FIGURES โœจ

Ok bestie, so Xdvi can absolutely display Encapsulated PostScript (EPS) files that are included in the dvi file. Obsessed. ๐Ÿ’…

Here's the search order, no cap:

  1. first it looks in the directory where the dvi file lives
  2. then it falls back to normal Kpathsea rules

But there's a plot twist ๐Ÿซฃ โ€” if the file name begins with a backtick (`), then the rest of the characters in that file name are literally a shell command (often zcat) that gets executed, and its standard output is then sent off to be interpreted as PostScript. Yeah. That's a whole vibe.

โš ๏ธ Running arbitrary shell commands with your permissions is a huge security risk, so evaluation of these backtick commands is disabled by default. You have to turn it on with the -allowshell command-line option.
๐Ÿšจ NOTE: You should never use this option when viewing documents that you didn't compile yourself. Periodt.

Good news though: the backtick specials are not needed for uncompressing gzipped PostScript files, because xdvi can do that on the fly if the filename ends with .eps.gz or .eps.Z โ€” and if the first bytes of the file indicate that the file is indeed compressed. This is both safer and more flexible than the backtick approach, since the default file searching rules will apply to such filenames too. Slay. โœจ


๐ŸŒธ TYPE 1 FONTS ๐ŸŒธ

Using FreeType (version 2), xdvi can render PostScriptโ„ข Type 1 fonts directly โ€” no route via TeX pixel (pk) fonts needed. The glow-up here: only one size of each font needs to be stored on disk. Iconic. ๐Ÿ‘‘

Unless the -notype1fonts option is used, xdvi will try to render every font using FreeType. Only as a fallback will it invoke an external program (like mktexpk, which in turn may invoke utilities like ps2pk or gsftopk) to generate a pixel font from the Type 1 source.

The direct rendering of the Computer Modern fonts should work out-of-the box โœจ, whereas other Type 1 fonts โ€” such as the 35 standard' PostScriptโ„ข fonts resident in printers โ€” may need to be made accessible for use with xdvi`, unless your system administrator or TeX distribution has already done so (which is the case e.g. for current TeX Live systems).

For the 35 PostScriptโ„ข resident fonts, xdvik will search using the Fontmap provided with Ghostscript, if necessary. Also, the xdvik distribution comes with a utility called t1mapper to make these fonts available for xdvi; see the manual page for t1mapper(1) for usage details. This program is likely to be dropped in the future, however, since it is probably not needed anymore. ๐Ÿ’€


๐Ÿ’ซ SPECIALS (GENERALLY) ๐Ÿ’ซ

Any of the specials used by xdvi may be preceded by the characters ``xdvi:''. Doing so does not change the behavior of the special under xdvi, but it tells other dvi drivers (such as e.g. dvips) to ignore the special. It's giving "this isn't for you, bestie" ๐Ÿ™ˆ.


๐Ÿงš SOURCE SPECIALS ๐Ÿงš

Some TeX implementations or macro packages provide the facility to automatically include so-called source specials' into a DVI file. These contain the line number, eventually a column number, and the filename of the .texsource. This makes it possible to jump from a.dvifile to the corresponding place in the.texsource and vice versa โ€” also calledinverse search'. Jumping from the DVI file to the TeX file is also known as reverse search', and jumping from the TeX file to the DVI file as forward search'. Both directions, we contain multitudes. ๐Ÿฆ‹

To be usable with xdvi, source specials in the dvi file must have one of the following formats:

src:line[ ]filename
src:line:col[ ]filename
src:line
src:line:col
src::col

If filename or line are omitted, the most recent values are used. The first source special on each page must be in one of the first two forms, since defaults are not inherited across pages. No carrying over, bestie. ๐Ÿšซ

You will need a TeX implementation that provides an appropriate switch (e.g. -src) or a macro package (such as srcltx.sty or srctex.sty, available from CTAN:macros/latex/contrib/supported/srcltx/) to insert such source specials into the DVI file.

For reverse search, the combination Ctrl-Mouse 1 will make xdvi open an editor (the value of the -editor command line option) with the file and the line number of the .tex source. See the description of the -editor option for more information and example settings.

For forward search, xdvi has a -sourceposition option that makes xdvi jump to the page in the DVI file corresponding to the given line (or the closest line having a source special) of the specified file and highlight the found region. See the description of the -sourceposition option for more details.

More information on setting up various editors for use with source specials can be found at:

http://xdvi.sourceforge.net/inverse-search.html

๐Ÿ“ PAPERSIZE SPECIALS ๐Ÿ“

xdvi accepts specials to set the paper size for the document. These specials should be of the form

papersize=[*]width,height

where width and height give the width and height of the paper, respectively. Each of these should appear in the form of a decimal number followed by any of the two-letter abbreviations for units accepted by TeX (pt, pc, in, bp, cm, mm, dd, cc, or sp).

If an asterisk (*) appears just before the width, then the measurements refer to the document dimensions (e.g. pt as opposed to truept). This allows a macro package to vary the page size according to elements of the document; e.g.

\special{xdvi: papersize=*\number\wd\mybox sp,
         \number\ht\mybox sp}

Except for the asterisk, this format is compatible with dvips. ๐Ÿค

The last papersize special on a page determines the size of that page. If there is no such special on a given page, the most recent papersize is used, or, if there are no papersize specials on any preceding page, then the value of the paper resource (or -paper option on the command line) is used. Thus the paper size may vary for different pages of the dvi file. It's a shapeshifter, honestly. ๐Ÿฆ‹

If the paper resource (or -paper command-line option) begins with a plus sign (+), then all papersize specials in the dvi file are ignored. Silenced. ๐Ÿ”‡


๐ŸŒˆ COLOR SPECIALS ๐ŸŒˆ

The color specials supported by xdvi are the same as those supported by dvips, except that the literal PostScript color specification (as in the AggiePattern example in the dvips documentation) is not supported. There are also some restrictions due to the way xdvi's drawing routines are implemented; e.g. the \colorbox and \fcolorbox macros don't work with xdvi. See the section LIMITATIONS below for more information on these restrictions. ๐Ÿ˜ญ

Xdvi supports the same list of named colors as dvips does, namely:

Apricot, Aquamarine, Bittersweet, Black, Blue, BlueGreen, BlueViolet, BrickRed, Brown, BurntOrange, CadetBlue, CarnationPink, Cerulean, CornflowerBlue, Cyan, Dandelion, DarkOrchid, Emerald, ForestGreen, Fuchsia, Goldenrod, Gray, Green, GreenYellow, JungleGreen, Lavender, LimeGreen, Magenta, Mahogany, Maroon, Melon, MidnightBlue, Mulberry, NavyBlue, OliveGreen, Orange, OrangeRed, Orchid, Peach, Periwinkle, PineGreen, Plum, ProcessBlue, Purple, RawSienna, Red, RedOrange, RedViolet, Rhodamine, RoyalBlue, RoyalPurple, RubineRed, Salmon, SeaGreen, Sepia, SkyBlue, SpringGreen, Tan, TealBlue, Thistle, Turquoise, Violet, VioletRed, White, WildStrawberry, Yellow, YellowGreen, YellowOrange.

๐ŸŽ€ Note that these names are case sensitive.

The documentation of the LaTeX color package provides more details on how to use such specials with LaTeX; see the dvips documentation for a detailed description of the syntax and semantics of the color specials.


๐Ÿ”” SIGNALS ๐Ÿ””

When xdvi receives a SIGUSR1 signal, it rereads the dvi file. That's it, that's the whole signal. Rude of it to be so short and yet so powerful. ๐Ÿ’…

๐ŸŒธ ENVIRONMENT ๐ŸŒธ

Okay bestie, here's the tea on how xdvik finds its stuff: it uses the same environment variables and algorithms for searching for font files as TeX and friends. If you want the whole lore, go read the documentation for the Kpathsea library, kpathsea.dvi. It's detailed, it's giving encyclopedia, it's there for you. ๐Ÿ’–

On top of all that, xdvik also accepts the following variables:

  • DISPLAY โ€” tells it which graphics display terminal to use. Yeah, that one. The classic.
  • KPATHSEA_DEBUG โ€” traces Kpathsea lookups. Set it to -1 (= all bits on) if you want the complete tracing experience, no crumbs left behind. ๐Ÿ”
  • EXTENSIONMAPS โ€” a list of files to be searched for mime types entries (as for Acrobat Reader). Earlier entries in one of these files override later ones. If this variable is not set, the following default path is used:
$HOME/.mime.types:/etc/mime.types:\
    /usr/local/etc/mime.types
  • MAILCAPS โ€” a list of files to be searched for mailcap entries, as defined by RFC 1343. See this RFC or the mailcap(4) manual page for a detailed description of the mailcap file format. Currently, only the following mailcap features are supported:
    • test=command โ€” the entry is only used if command can be executed via the system() call and if the system() call returns with value 0 (success). The command string may contain the format string %s, which will be replaced by the file name.
    • needsterminal โ€” if this flag is used, the command will be executed in a new xterm window by prepending xterm -e to the command string.

All other fields in the mailcap entry are ignored by xdvi. Earlier entries in one of these files override later ones. If the variable is not defined, the following default path is used:

$HOME/.mailcap:/etc/mailcap:\
    /usr/local/etc/mailcap
For security reasons, some special characters (i.e. ( ) \ ;) are escaped in the argument before passing it to system()`.

Stay safe out there, bestie. ๐Ÿ›ก๏ธ

  • BROWSER โ€” determines the web browser used to open external links (i.e. all URLs that don't start with the file: scheme and are not relative links in the local DVI file), and to open links for which no viewer has been specified in the mailcap files. The value of this variable is a colon-separated list of commands. Xdvi will try each of them in sequence until one succeeds (i.e. doesn't immediately return with status 0). This allows you to specify your favourite browser at the beginning, and fallback browsers at the end. Every occurrence of %s in the string is replaced by the target URL; every occurrence of %% is replaced by a single %. If no %s is present, the URL string is added as an extra argument. An example setting is:
netscape -raise -remote 'openURL(%s,new-window)':xterm -e lynx
%s:xterm -e wget %s:lynx %s:wget %s

See

http://www.catb.org/~esr/BROWSER/

for more details on the BROWSER environment variable.

  • GS_LIB โ€” a colon-separated list of directories to search for Fontmap files, etc., as used for Ghostscript. It has the same meaning as it does when running Ghostscript. In xdvik, it is used when searching for font files when the map file does not give a file name for the font (this should be quite rare). The command gs -h will list the default value that Ghostscript uses. See also the XDVI_GS_LIB environment variable (below).
  • XDVI_GS_LIB โ€” this has the same effect as GS_LIB but affects only xdvi. Use this when you want to use a different value for GS_LIB when running xdvi, but use either the compiled-in default value or some other value when running Ghostscript. If both GS_LIB and XDVI_GS_LIB are set, then xdvi uses XDVI_GS_LIB. To use the default value compiled in to xdvi while still retaining the ability to set GS_LIB for use with Ghostscript, you can set XDVI_GS_LIB to the empty string. ๐Ÿ’…
  • TMPDIR โ€” the directory to use for storing temporary files created when uncompressing PostScript files.
  • XEDITOR โ€” determines the editor command used for source special reverse search, if neither the -editor command-line option nor the .editor resource are specified. See the description of the -editor command line option for details on the format.
  • VISUAL โ€” determines an editor to be opened in an xterm window if neither of -editor, .editor, or XEDITOR is specified.
  • EDITOR โ€” determines an editor to be opened in an xterm window if neither of -editor, .editor, XEDITOR or VISUAL is specified.
  • WWWBROWSER โ€” obsolete; use BROWSER instead. Ma'am, it's 2022, let it go. ๐Ÿ™ˆ

๐Ÿ’€ LIMITATIONS ๐Ÿ’€

Real talk, bestie โ€” xdvi accepts many but not all types of PostScript specials accepted by dvips. For example, it accepts most specials generated by epsf and psfig. It does not, however, support bop-hook or eop-hook, nor does it allow PostScript commands to affect the rendering of things that are not PostScript (for example, the NEAT'' and rotated A'' examples in the dvips manual). These restrictions are due to the design of xdvi; in all likelihood they will always remain. It's giving permanent, no cap. ๐Ÿ˜ญ

LaTeX2e rotation specials are currently not supported.

MetaPost files containing included text are not supported.

Xdvi's color handling doesn't support the \colorbox and \fcolorbox macros; this is not likely to change in the near future. This also means that e.g. colored tables (as created by the colortbl package) may render incorrectly: Text in colors different from the default foreground color may not be displayed. When the page is redrawn (e.g. after using the magnifier), the background color of the cells may overdraw the text. Yikes. ๐Ÿซ 


๐ŸŽ€ FILES ๐ŸŽ€

  • $HOME/.xdvirc โ€” a file that holds all settings that the user changed via the keys, the Options' and the Xaw Modes' menu and the dialogs, as X resources. These resources override the settings in $HOME/.Xdefaults. This file is ignored if the -q option is used or the noInitFile X resource is set.
  • config.xdvi โ€” an optional configuration file for the Type 1 font setup, which specifies dvips-style map files specific to xdvik. If used, it should be present in the directory determined by the TEXCONFIG environment variable. Its format is similar to configuration files for dvips, except that it is only scanned for the names of map files (p and p+ directives).

๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

X(1), dvips(1), mktexpk(1), ps2pk(1), gsftopk(1), t1mapper(1), mailcap(4), the Kpathsea documentation, https://ctan.org/pkg/xdvi/, and the Xdvik home page at http://xdvi.sourceforge.net/.

Go read, bestie, it's giving โœจscholarlyโœจ.


๐Ÿ‘‘ AUTHORS ๐Ÿ‘‘

Eric Cooper, CMU, did a version for direct output to a QVSS. Modified for X by Bob Scheifler, MIT Laboratory for Computer Science. Modified for X11 by Mark Eichin, MIT SIPB. Additional enhancements by many others. Legit so many people, iconic behavior. ๐Ÿ’œ

The current maintainer of the original xdvi is Paul Vojta, U.C. Berkeley.

Code for the xdvik variant has been contributed by many people, whose names are scattered across the source files. Finding them all is a scavenger hunt, iykyk. ๐Ÿงš

For the most up-to-date information, please visit:

http://xdvi.sourceforge.net

Please report all bugs to the SourceForge bug tracker:

http://sourceforge.net/tracker/?func=add&group_id=23164&atid=377580

And that's a wrap, bestie!! ๐ŸŽ€โœจ This whole beautiful manual is from Xdvik 22.87.06, dated 2022-02-17, and it's the XDVI(1) page. Go forth and render them DVI files, you absolute main character. ๐Ÿ’…๐Ÿ’–๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from