XDVI(1)
๐ฆ XDVI(1) โ DVI Previewer for the X Window System
okay bestie, welcome to XDVI(1) from the General Commands Manual โ this is the whole scoop on xdvi, and I'm gonna walk you through every single bit of it. grab a boba, we're doing this ๐
โจ NAME โจ
xdvi โ a DVI previewer for the X Window System ๐ฅ๏ธ๐
๐ 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] [-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]
that's a LOT of flags and honestly? iconic. every single one gets explained below, don't you worry ๐ซถ
๐ DESCRIPTION ๐
Xdvi is a program for previewing dvi files โ like the ones made by the tex(1) program โ under the X window system. that's literally its whole job and it does it gorgeously โจ
Xdvi can show your file shrunken by various integer factors, and it has a ``magnifying glass'' for viewing parts of the page enlarged (peep the MAGNIFIER section below, bestie). This version of xdvi is also referred to as xdvik since it uses the kpathsea library to locate and generate font files. On top of all that, it 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)
Xdvi can be compiled with the Motif toolkit or the Xaw (Athena) toolkit (and variants of it), and the Motif version has a slightly different GUI โ those differences get noted as we go ๐
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 that's the case, it reloads the file. this feature is lowkey the whole reason you can preview many versions of the same file while running xdvi only once ๐ฅ Since it cannot 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 can be used to turn off this feature.)
Xdvi can show PostScript<tm> specials by any of three methods. It tries first to use Display PostScript<tm>, then NeWS, then it tries to use Ghostscript to render the images. All of these options depend on additional software to work properly โ and some of them may not even be compiled into this copy of xdvi ๐
heads up bestie: for performance reasons, xdvi does not render PostScript specials in the magnifying glass. that's just how it is ๐
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, it will 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; you can set the X resource noFileArgUseHistory to false to get back the old behaviour.) ๐
๐ธ OPTIONS ๐ธ
Besides specifying the dvi file (with or without the .dvi extension), xdvi supports the following command line options. If the option begins with a + instead of a -, the option is restored to its default value. By default, these options can be set via the resource names given in parentheses in the description of each option.
+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 option enables the shell escape in PostScript specials. (For security reasons, shell escapes are disabled by default.) This option should be rarely used; in particular it should not be used just to uncompress files: that function is done automatically if the file name ends in.Z,.gz, or.bz2. Shell escapes are always turned off if the-saferoption is used.
okay so for real, be careful with this one. shell escapes off by default for a reason ๐
-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 invokingxdvifrom 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 theBROWSERenvironment variable; see the explanation of that variable in the section ``ENVIRONMENT'' below for a detailed description. If neither the option nor the X resourcewwwBrowseris specified, the environment variablesBROWSERandWWWBROWSER(in that order) are used to determine the browser command. If these are not set either, the following 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
-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. If greyscale anti-aliasing is in use, the-copyoperation 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 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 creation2โdvi: DVI translation4โpk: PK fonts8โbatch: Batch mode: Exit after reading the DVI file16โevent: Event handling32โps: PostScript interpreter calls64โstat: Kpathseastat(2)calls128โhash: Kpathsea hash table lookups256โopen: Kpathsea file opening512โpaths: Kpathsea path definitions1024โexpand: Kpathsea path expansion2048โsearch: Kpathsea searching4032โkpathsea: All Kpathsea options4096โhtex: Hypertex specials8192โsrc: Source specials16384โclient: Client/server mode (see-uniqueand-sourcepositionoptions)32768โft: FreeType library messages (Type 1 fonts)65536โft_verbose: Verbose FreeType library messages (currently unused)131072โgui: GUI elements262144โfind: Searching for strings in the DVI file524288โ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 is40. If greyscaling is in use, this argument does not apply; use-gammainstead. 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 variableDISPLAY.-dvipspath pathโ (.dvipsPath) Use path as thedvipsprogram to use when printing. The default for this isdvips. 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 thesource-special()action is triggered to start a reverse search (by default viaCtrl-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. โจ
So bestie, if neither the option nor the X resource .editor is specified, xdvi goes digging through your environment variables to figure out what editor command to use. It checks them in this exact order: XEDITOR, then VISUAL, then EDITOR. ๐ต๏ธโโ๏ธ
If the string it finds is sitting in VISUAL or EDITOR, then xterm -e gets prepended to it automatically. But if the editor got specified some other way, then you have to hand it over in the form of a shell command that pops up an X window with an editor inside. If literally none of those variables are set? It shows a warning message and just uses the command xterm -e vi +%l %f. No cap.
And if there's no %f or %l anywhere in the string, the missing format strings get appended automatically โ this is for compatibility with other programs when you're using one of those environment variables. ๐ซถ
Also important: a brand new instance of the editor starts every single time you use this command. So it's way better to use an editor that can be invoked in client mode, so new files load into the same instance instead of spawning a whole new one. Example settings, iconic behavior only:
emacsclient --no-waitโ (older Emacsen)gnuclient -qโ (XEmacs and newer Emacsen)gvim --servername xdvi --remoteโ (VIM v6.0+; the--servername xdvioption will cause gvim to run a dedicated instance for the files opened by xdvi.)ncโ (nedit)
Heads up: those strings need to be enclosed into quotes when you use them on the command-line, so the shell doesn't mess with them. But when you're using them as the argument for the .editor resource in an X resource file, no quotes should be used. Different rules, different vibes. ๐
NOTE ON SECURITY: The argument of this option isn't executed as a shell command โ it goes through exec() instead, to prevent evil tricks with the contents of source specials. ๐
-expertโ Okay so this one is only still around for backwards compatibility. It's equivalent to-expertmode 0, and honestly you should prefer that instead. It's giving legacy, not giving slay.-expertmode flagโ (.expertMode) With an argument of0, this option switches off the display of the buttons, scrollbars, the toolbar (Motif only), the statusline and the page list. ๐๏ธ
All of those GUI elements can also be (de)activated separately, by combining the appropriate values in the flag argument. This works 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โ statusline2โ scrollbars4โ Motif: pagelist, Xaw: buttons and pagelist8โ 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 thesourcepositionoption). Here's the tea: if there's already another instance of xdvi running on the display showing 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 theX(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. Twin energy. ๐ฏ-fullscreenโ When this option is used, xdvi will (try to) run in fullscreen mode, with no window decorations. ๐ฅ๏ธ
Fair warning bestie: this option is not guaranteed to work with all windowmanagers/desktops. If you're experiencing problems with it, please use the -geometry option instead, plus 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 is1.0. For0 < gamma < 1, the fonts will be lighter (more like the background), and forgamma > 1, the fonts will be darker (more like the foreground). Negative values behave the same way, but use a slightly different algorithm. This is for color and grayscale displays; for monochrome, see-density. See also theSkeystroke. ๐-geometry geometryโ (.geometry) Specifies the initial geometry of the main window, as described in theX(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 thex11alphadriver instead of thex11driver. Thex11alphadriver 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 theVkeystroke.-gspalette paletteโ (.palette) Specifies the palette to be used when using Ghostscript for rendering PostScript specials. Possible values areColor,Greyscale, andMonochrome. The default isColor. ๐-h,-help,--helpโ Prints a short help text with an overview of the command-line options tostandard output. ๐-hl colorโ (.highlight) Determines the color of the page border, of the ruler inruler 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. ๐คซ-hushbellโ (.hushBell) Don't sound the X bell when an error occurs. ๐-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 tostdout. But note: errors or warnings will still be printed tostderreven 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. ๐ช-installโ (.install) Okay so 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 usesgs. ๐ป-keepโ (.keepPosition) Sets a flag to indicate that xdvi should not move to the home position when moving to a new page. See also thekkeystroke.
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 an 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 (Blue2by 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 links1โ Underline links with link color2โ No underlining, color text with link color3โ 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 thehomeposition 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. ๐
-mfmodemode-def โ (.mfMode) bestie this one sets a mode-def string that xdvi uses when it goes hunting for fonts (peep the ENVIRONMENT section below for the whole tea ๐ ). lowkey important: when you switch up the mode-def you usually gotta switch the font size too, to whatever value actually matches that mode. and the way you do that is by adding a colon plus the value in dots per inch โ like-mfmode ljfour:600. โจ this method overrides anything thepixelsPerInchresource or the-pcommand-line argument said, so it wins the argument, no cap. the metafont mode also gets handed off tometafontduring automatic font creation. by default? unspecified. mysterious. main character energy ๐-mgssize โ literally just the same thing as-mgs1. twin behavior ๐-mgs[n]size โ (.magnifierSize[n]) sets the size of the window used for the ``magnifying glass'' for Button n ๐. you can give the size as a plain integer (which means the magnifying glass is gonna be square, iconic), or you can give it as widthx*height*. check the MOUSE ACTIONS section for more. the defaults are200x150,400x250,700x500,1000x800, and1200x1200โ they really said options, options, options ๐ธ-mousemode[0|1|2] โ (.mouseMode) picks the default mode xdvi starts up in: Magnifier (0), Text Selection Mode (1) or Ruler Mode (2). the MODES section below has all the details, go look ๐ฆ-nocolorโ (.color) turns OFF the use of color specials. you can toggle this with the`C'keystroke. (note:-nocolorcorresponds tocolor:off;+nocolortocolor:on.) ๐-noforkโ (.fork) so here's the situation: with the-sourcepositionand-uniqueoptions, the default behavior is for xdvi to yeet itself into the background (like a daemon) if there's no appropriate instance of xdvi already running. this argument makes it run in the foreground instead. super useful for debugging, or if your client application cannot deal well with a program self-backgrounding itself like this โ e.g. the IPC functions inemacsare known to have problems with this. if no-sourcepositionor-uniqueargument is given, then this option does literally nothing, sorry bestie ๐. (note:-noforkcorresponds tofork:off;+noforktofork:on.)-noghostscriptโ (.ghostscript) stops Ghostscript from being used to display PostScript<tm> specials. (note:-noghostscriptcorresponds toghostscript:off;+noghostscripttoghostscript:on.) ๐ป-nogreyโ (.grey) turns OFF the use of greyscale anti-aliasing when printing shrunken bitmaps. (note:-nogreycorresponds togrey:off;+nogreytogrey:on.) also go peep the`G'keystroke. ๐ฉถ-nogssaferโ (.gsSafer) normally, if Ghostscript is used to render PostScript specials, the Ghostscript interpreter is run with the option-dSAFER. the-nogssaferoption runs Ghostscript without-dSAFER. the-dSAFERoption in Ghostscript disables PostScript operators such asdeletefile, to prevent possibly malicious PostScript programs from having any effect. > โ ๏ธ bestie if the-saferoption is specified, then this option has no effect; in that case Ghostscript is ALWAYS run with-dSAFER. no exceptions, periodt. (note:-nogssafercorresponds togsSafer:off;+nogssafertogsSafer: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:-noinstallcorrespondsinstall:off; there is no+noinstalloption.) also see-install, and the GREYSCALING AND COLORMAPS section. ๐-nomakepkโ (.makePk) turns off automatic generation of font files that can't be found by other means. (note:-nomakepkcorresponds tomakePk:off;+nomakepktomakePK:on.) yes it really ismakePKwith a capital PK there, i don't make the rules ๐-nomatchinvertedโ (.matchInverted) don't highlight string search matches in inverted color; instead, draw a rectangle in highlight color (see the-hloption) around the match. this option gets activated automatically if the display isn't running in TrueColor. (note:-nomatchinvertedcorresponds tomatchInverted:off;+nomatchinvertedtomatchInverted:on.) ๐-noomegaโ (.omega) this disables the use of Omega extensions when interpreting DVI files. by default, the additional opcodes129and134are recognized by xdvi as Omega extensions and interpreted as requests to set 2-byte characters. the only drawback is that the virtual font array will require65536positions instead of the default256positions, i.e. the memory requirements of xdvi will be slightly larger. if you find this unacceptable or encounter another problem with the Omega extensions, you can switch this extension off by using-noomega(but please do send a bug report if you find such problems โ see the bug address in the AUTHORS section below). ๐ (note:-noomegacorresponds toomega: off;+noomegatoomega: on.)-noscanโ (.prescan) by default, xdvi does a preliminary scan of the dvi file to process any papersize specials; this is especially important 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, so don't stress ๐ซถ) (note:-noscancorresponds toprescan:off;+noscantoprescan:on.)-notempfileโ (.tempFile) like we mentioned in the DESCRIPTION section above, xdvi creates a temporary copy of the DVI file so it can be accessed without interruptions even while the file is being rewritten by TeX. since that introduces the overhead of copying the file every time it's changed,-notempfilelets you turn off this behaviour. in that case, 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:-notempfilecorresponds totempFile:off;+notempfiletotempFile:on.)-notype1fontsโ (.type1) this disables the use of the FreeType library to display PostScript<tm> Type 1 fonts. use this option as a workaround when you encounter problems with the display of Type 1 fonts (but please don't forget to send a bug report in this case, to the URL mentioned in the section AUTHORS below). (note:-notype1fontscorresponds totype1:off;+notype1fontstotype1:on.) โจ-offsetsdimen โ (.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 always1 inchover and down from the top-left page corner, even when non-American paper sizes are used. so the default offsets are1.0 inch. ๐ the argument dimen 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, orsp). by default, the unit will becm(centimeters). also see-xoffsetand-yoffset.-ppixels โ (.pixelsPerInch) defines the size of the fonts to use, in pixels per inch. the default value is600. this option is provided only for backwards compatibility; the preferred way is to set both the resolution and the Metafont mode via the-mfmodeoption (which see). ๐-paperpapertype โ (.paper) sets 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 widthx*height* optionally followed by a unit, where width and height are decimal numbers giving the width and height of the paper, respectively, 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, sad).
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 option provides a simple implementation of incremental (stepwise) display, which can be used for presentations. ๐ค when this option is used, xdvi will pause the display of the current page whenever it encounters a special special-string (xdvi:pauseby default; the string can be customized via-pausespecial, see below), and the cursor will change its shape. the actionunpause-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. ๐-pausespecialspecial-string โ (.pauseSpecial) sets the special string that causes xdvi to pause when the-pauseoption is active. the default value of special-string isxdvi:pause. โธ๏ธ-postscriptflag โ (.postscript) sets how PostScript<tm> specials get rendered. If flag =0, rendering is off and you just see the bounding boxes instead (if there even are any). flag =1is the default and turns the PostScript<tm> specials on. flag =2shows the specials and their bounding boxes at the same time โ so you can visually vibe-check whether the bounding boxes are correct. You can also flip between these at runtime with thevkeystroke plus the numerical prefix arguments0,1, and2. ๐-ps2pdfpathpath โ (.ps2pdfPath) uses path as the conversion program from PostScript to PDF. That program or script needs to accept two command-line arguments: the PostScript file as the first argument, and the PDF output file as the second. ๐-rulecolorcolor โ (.ruleColor) decides the color of the rules used for the magnifier (default: the foreground color). ๐-qโ (.noInitFile) ignore the$HOME/.xdvircstartup file, meaning don't read it on startup and don't write it on exit. This forces the defaults defined in$HOME/.Xdefaultsto be used instead. Peep the FILES section for more on$HOME/.xdvirc. ๐ซถ-rvโ (.reverseVideo) makes the page display with white characters on a black background instead of the other way around. Main character energy, honestly. ๐ค-Sdensity โ (.densityPercent) same as-density(which see). ๐ซ-sshrink โ (.shrinkFactor) sets the initial shrink factor. Default is8. If shrink is given as0, the initial shrink factor gets computed so the page fits inside the window โ exactly like giving theskeystroke with no number. โจ-saferโ (.safer) turns on all available security options. It's designed for whenxdviis called by a browser that grabbed a dvi or TeX file from some other site. This option selects+nogssaferand+allowshell. ๐-sidemargindimen โ (.sideMargin) specifies the side margin (see-margins). ๐-sourcepositionline[:col][ ]filename โ this one makesxdvisearch the dvi file for the place matching the indicated line (and optionally col) in the.texsource file, then highlights what it found by drawing a rectangle in the highlight color (see the-hloption) around the corresponding text. ๐
Also, when run with this argument (and the -nofork option isn't given, which see), xdvi will always return immediately: if it finds another instance of xdvi already showing dvi_file, it makes that instance raise its window and move to the given place in the dvi file; otherwise it starts up its own instance in the background. If several instances of xdvi are displaying the respective dvi file, the instance that was last raised to the foreground gets used.
The space before filename is only needed if the filename starts with a digit. When you do use the space, the whole argument needs to be enclosed in quotes so the shell doesn't misinterpret the space as an argument separator.
This option requires that dvi_file be prepared with source special information. Check the SOURCE SPECIALS section for how to do that. ๐
Here's a more detailed breakdown of how the filename in the -sourceposition argument gets matched with the filename in the source specials:
- If neither of the filenames contains a path name component, the filenames are compared ignoring the
.texextensions in both filenames. - Otherwise, if one of the filenames does contain a path name component (e.g.:
./test.tex,../test.tex,/my/homedir/tex/test.texor 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-sourcepositionis expanded relative to the current working directory of thexdvi -sourcepositioninvocation, 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.texextensions in both path names.
-statuslineโ (.statusline) this option is obsolete; use-expertmodeflag instead (which see). ๐-text-encodingencoding โ (.textEncoding) uses encoding as the text encoding of the string in the "Find" window. Usually you won't need this since the encoding is determined from the locale settings. ๐ธ-thoroughโ (.thorough) so like,xdviusually tries to make sure overstrike characters (e.g.\notin) print correctly. On monochrome displays this is always possible with one logical operation, eitherandoror. On color displays though, it may take two operations: one to set the appropriate bits and one to clear other bits. When that's the case, by defaultxdviwill instead use thecopyoperation, which doesn't handle overstriking correctly. The-thoroughoption picks the slower but more correct choice. See also-copy. ๐ฏ-topmargindimen โ (.topMargin) specifies the top and bottom margins (see-margins). ๐-uniqueโ (.unique) this option makes another instance ofxdvirunning on the same display act as aserver. For example, the invocation
xdvi -unique +5 file.dvi
will cause that other instance to load file.dvi on page 5 in place of whatever file it's currently displaying. If there's already another instance of xdvi already displaying the file file.dvi, then it'll just jump to page 5. If that other instance of xdvi is displaying a different file, it'll 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โ uses logical TeX pages (the values of the\count0register) instead of physical pages for the pagelist labels and when jumping to a page in a document with thegkeystroke (or thegoto-page()action). This option can be toggled via theTkeystroke. ๐-versionโ prints info on the version ofxdvi. โญ-visitedlinkcolorโ (.visitedLinkColor) the color used for visited hyperlinks (Purple4by default). Hyperlinks become visited once you click on them. Just like withlinkColor, the value should be either a valid X color name or a hexadecimal color string. ๐-warnspecialsโ (.warnSpecials) makesxdviprint warnings about\specialstrings it can't process to stderr. These warnings are suppressed by default. ๐ฅ-watchfilen โ (.watchFile) if this option is set to a value larger than0,xdvichecks the DVI file for changes every n seconds. If the DVI file has been completely written by TeX, it gets reloaded automatically. Fractional values (e.g.2.5) are possible. The default for this option is0, i.e. no watching.
Since xdvi can't handle partial DVI files, it tries not to reload the file while it's being rewritten. However, using the magnifier or switching 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. ๐ญ
-wheelunitpixels โ (.wheelUnit) sets the number of pixels that a motion of a wheel mouse will move the image up, down, left, or right. (See thewheelandhwheelactions, below, for more on this.) If set to zero, the wheel mouse functionality is (essentially) disabled. The default value is80. ๐ฑ๏ธ-xoffsetdimen โ (.xOffset) specifies the size of the horizontal offset of the output on the page. See-offsets. โก๏ธ-yoffsetdimen โ (.yOffset) specifies the size of the vertical offset of the output on the page. See-offsets. โฌ๏ธ
โจ KEYSTROKES โจ
Xdvi recognizes the following keystrokes when you type them in its window. Each one may optionally be preceded by a (positive or negative) number โ a prefix argument โ whose interpretation depends 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 the ?, b, and f keys, respectively. โจ๏ธ
The key bindings listed here are the ones xdvi assigns by default. The names appearing in brackets at the start 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 CUSTOMIZATION section below. If only a lowercase binding is listed, both upper- and lowercase keys will work for that binding. ๐
ESCkey โ[discard-number()]the escape key discards the numerical prefix for all actions (super useful when you mistyped a number). ๐Returnkey โ[forward-page()]moves to the next page (or to the *n*th next page if a number is given). Synonyms aren,fand Line Feed. โจBackspacekey โ[back-page()]moves to the previous page (or back n pages). Synonyms arep,bandCtrl-h. โฌ ๏ธDeletekey โ[up-or-previous()]moves up two-thirds of a window-full, or to the top of the previous page if you're 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()]โ scrolls down two-thirds of a window-full, or straight to the next page if you're already at the bottom of this one. BUT โจ if the-pausespecial-string option is in play and the display is currently paused, this key does something different: it shows the next chunk of the page until it hits the next special-string or the end of the page. Check the description of the-pauseoption for the deets. Oh and there's an action called[down-or-next()]that does a similar thing, just without the pausing โ it's not bound to any key by default tho.Ctrl-Home(Xaw),Ctrl-osfBeginLine(Motif) โ[goto-page(1)]โ zooms you to the very first page of the document. first page girlies rise ๐Ctrl-End(Xaw),Ctrl-osfEndLine(Motif) โ[goto-page()]โ jumps to the last page of the document. end credits energy โจ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, bestie).End(Xaw),osfEndLine(Motif) โ[end-or-bottom()]โ moves to the "end" position of the page (that's the lower right-hand corner), or to the bottom of the page if the keep flag is set (and again, when it is, the page doesn't scroll horizontally).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 (see also theSkeystroke, it's the same vibe).Alt-Ctrl--โ[change-density(-25)]โ makes the fonts in the DVI window lighter by subtracting from the gamma value (again, see theSkeystroke).Ctrl-+โ[set-shrink-factor(+)]โ bumps the shrink factor up (see also theskeystroke).Ctrl--โ[set-shrink-factor(-)]โ brings the shrink factor down (see also theskeystroke).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 details, iykyk.[โ[pagehistory-back()]โ moves back in the page history (see PAGE HISTORY for details). 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 details.]โ[pagehistory-forward()]โ moves forward in the page history (see PAGE HISTORY for details). 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, depending on the margins as described in the-marginsoption above. ๐?โ[help()]โ same as thehkey (which see).Bโ[htex-back()]โ jumps back to the previous hyperlink anchor. See the HYPERLINKS section for more info on navigating the links, bestie.bโ[back-page()]โ moves to the previous page (or back n pages). Synonyms arep,Ctrl-handBackspace.Cโ[set-color()]โ toggles the use of color specials. The key sequences0Cand1Cturn interpretation of color specials off and on, respectively. See also the-nocoloroption. ๐cโ[center()]โ moves the page so that whatever point is currently under your mouse cursor gets moved to the middle of the window, and warps the mouse cursor to that same place. centering the main character fr.Dโ[toggle-grid-mode()]โ toggles the use of a grid on the displayed page. No number given? The grid mode just switches on or off. Prepend a number from 1 to 3 and you get 3 different grid levels. The grid units 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. Hand a float argument todownand it moves down that fraction of a window-full instead.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 you give it a number). Synonyms aren,Return, andLine Feed.Gโ[set-greyscaling()]โ toggles the use of greyscale anti-aliasing for displaying shrunken bitmaps. Also, the key sequences0Gand1Gclear and set this flag, respectively. See also the-nogreyoption.
If you give it a numeric argument that isn't 0 or 1, greyscale anti-aliasing gets turned on and the gamma resource gets set to the value divided by 100. E.g. 150G turns on greyscale and sets gamma to 1.5. math girlie behavior honestly ๐งฎ
Ctrl-gโ[find-next()]โ finds the next match string in the DVI file. You can use this instead of pressing theFindbutton in the search window.gโ[goto-page()]โ moves to the page with the given number. No page number given? Then xdvi jumps to the last page. If the option/resourceuseTeXpagesis active, those numbers correspond to the actual page numbers in the TeX file; otherwise, absolute page numbers (starting from 1) are used. In that latter case, the page numbers can be changed with thePkeystroke below. Heads up tho: with theuseTeXpagesoption it's possible that the same page number occurs multiple times, and in such a case xdvi will use the first page number that matches. no duplicates drama, just first-come-first-served ๐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. Thekkeystroke toggles akeep-positionflag, and when that's set, it keeps the same position while moving between pages. Also0kand1kclear and set this flag, respectively. See also the-keepoption.Ctrl-lโ[fullscreen(toggle)]โ toggles fullscreen mode (see the description of the-fullscreenoption for more info on this).
โ ๏ธ This is even more flaky than using the command-line option: there's 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. bestie trust me, just use the WM.
lโ[left()]โ moves the page left two thirds of a window-full.Mโ[set-margins()]โ sets the margins so that the point currently under your 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-marginsoption.mโ[toggle-mark()]โ toggles the mark for the current page in the page list. When a page is marked, it shows a little star*next to the page number. Those marked pages can then be printed or saved to a file. You can also mark a page or several pages by clicking or draggingMouse-2in 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. Perfect for quickly marking a whole series of subsequent pages. speedrun strat fr ๐โโ๏ธnโ[forward-page()]โ moves to the next page (or to the *n*th next page if a number is given). Synonyms aref,Return, andLine Feed.Ctrl-oโ[select-dvi-file()]โ reads a new dvi file. A file-selection widget pops up so you can pick the DVI file. If a prefix argument n is given, the *n*th file from the file history gets opened instead.Pโ[declare-page-number()]โ "This is page number n." ๐ You can use this to make thegkeystroke refer to a different page number than the physical page. (If you want to uselogicalor TeX page numbers instead of physical pages, consider using the option-useTeXpagesinstead.) 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, plus the resources for customizing the default behaviour.pโ[back-page()]โ moves to the previous page (or back n pages). Synonyms areb,Ctrl-handBackspace.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 is the move that lets you preview many versions of the same file while running xdvi only once. iconic tbh โจ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.Sโ[set-density()]โ sets the density factor used when shrinking bitmaps. 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 gamma value 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, it uses the smallest factor that makes the entire page fit in the window. (Margins are ignored in this computation, jsyk.)Tโ[use-tex-pages()]โ uses logical TeX pages (the values of the\count0register) instead of physical pages for the pagelist labels, and when jumping to a page in a document viagoto-page(). See also the-useTeXpagesoption.t[switch-magnifier-units()] โ swaps out the units used for the magnifier tick marks, and for reporting the distance between your mouse pointer and the ruler centre when you're in ruler mode (peep the MODES section for that one). The default is set by the X resourcetickUnits(mmby default, bestie). The units cycle through these values โ and except forpx, they're all straight-up TeX units:mm(millimeters),pt(TeX points),in(inches),sp(scaled points, the unit TeX uses internally, iconic),bp(big points, akaPostScript points),cc(cicero points),dd(didot points),pc(pica), andpx(screen pixels). Go off, unit system ๐Ctrl-u[back-page()toggle-mark()] โ moves you to the previous page and toggles the mark for that page. It's the dual action toCtrl-n, they're giving โจtwinsโจ energy.u[up()] โ moves the page up two thirds of a window-full. If you throw a float argument at ``up'', it moves up by that corresponding fraction of a window-full instead. Math girlies stay winning ๐Ctrl-v[show-source-specials()] โ shows bounding boxes for every source special on the current page, and prints the strings tucked inside those specials out tostderr. With prefix1, it shows every bounding box on the page. This is mainly for debugging, iykyk ๐V[set-gs-alpha()] โ toggles the anti-aliasing of PostScript<tm> specials whenever Ghostscript is doing the rendering. Bonus: the key sequences0Vand1Vclear and set this flag respectively. See also the-gsalphaoption. Smooth edges, no cap ๐v[set-ps()] โ toggles how PostScript<tm> specials get rendered, cycling through 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 jump straight to any state with 1v, 2v, and 0v respectively. See also the -postscript option.
Ctrl-x[source-what-special()] โ shows info about the source special chilling next to your mouse cursor, right there in the statusline. It's the same special thatsource-special()would find, except it doesn't go and bother your editor. For debugging purposes, obviously ๐ต๏ธโโ๏ธx[set-expert-mode()] โ toggles expert mode, which is the vibe where the statusline, the scrollbars, the menu buttons, the toolbar (Motif only) and the page list all go invisible. Typing1xtoggles the statusline at the bottom of the window. Typing2xtoggles the scrollbars (if they exist for you). For Xaw,3xtoggles the menu buttons and the page list; for Motif, it toggles the page list. In Motif, the extra bindings4xtoggle the toolbar, and5xtoggle the menu bar. Without a prefix argument, all of those GUI elements mentioned above either get switched on (if they were invisible before) or off. Toggling scrollbars may behave erratically with the Xaw widgets โ like, the scrollbars might reappear after you resize the window, and at certain window sizes one of the scrollbars can straight-up refuse to disappear ๐ญ. See also the option-expertmode(the numbers above correspond to the bits in the argument to-expertmode).
๐ฑ๏ธ MOUSE ACTIONS IN THE MAIN WINDOW ๐ฑ๏ธ
The mouse actions are customizable by setting the X resource mouseTranslations. And because there are three different mouse modes (check the MODES section below, bestie), 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 hand it one argument, that action gets used for all the modes. The default bindings are giving:
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 single one of these actions gets a full breakdown below. Side note: peep the quote symbols wrapped around the action strings โ those are necessary to group them into one argument, fr fr. Buttons 4, 5, 6, and 7 refer to wheel movements (wheel up/down/left/right) on wheel mice. And not every mouse supports horizontal scrolling, so don't come for me if yours doesn't ๐
Okay so here's a whole thing: 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. This parser is more limited than the one built into the X Toolkit. So the string you give in mouseTranslations should not begin with #replace'', #augment'', or ``#override''. Modifiers of the form @keysym are not supported, and the event type has to be of the form BtnDown or BtnnDown, where n is a positive integer with no leading zeroes. Also, some limitations apply to the action field. The drama, honestly ๐
do-href()
do-href-newwindow()
Usually, if a binding specifies more than one action, all the actions get executed in a sequence. But the hyperlink bindings do-href() and do-href-newwindow() are special โ they act 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. Main character behaviour tbh ๐
The action do-href() jumps to the link target in the current xdvi window (eventually switching to another page), and do-href-newwindow() opens a brand new instance of xdvi for the link target. In both cases, the location of the target is indicated by a small arrow drawn in the same color as a visited link, tucked in the left corner of the window. Cute and functional ๐ธ
magnifier(n x m)
magnifier(*n)
This action pops up a ``magnifying glass'' that shows the unshrunk image of the region around your mouse pointer. The magnifier dips when you release the mouse button. And if you move the mouse cursor while holding the button down, the magnifier moves with it. So slay ๐ฆ
Different mouse buttons produce 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, which refer 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. Pick your fighter ๐
source-special()
This action kicks off a ``reverse search'', opening your editor right at the location in the TeX file that corresponds to the pointer location in the DVI file. See the SOURCE SPECIALS section below for way more on that. Iconic behaviour, no notes โจ
wheel()
This action lets you scroll the image with a wheel mouse, where it's usually bound to mouse button 4 (wheel up) or 5 (wheel down). The action takes one parameter, which gives the distance to scroll the image. If that parameter contains a decimal point, the distance is given in wheel units; otherwise, it's in pixels. A negative value scrolls up, a positive value scrolls down. Up and down, we stay scrolling ๐
hwheel()
This action lets you scroll the image horizontally with a wheel mouse, where it's usually bound to mouse button 6 (wheel left) or 7 (wheel right). The action takes one parameter, giving the distance to scroll the image. If that parameter contains a decimal point, the distance is given in wheel units; otherwise, pixels. A negative value scrolls left, a positive value scrolls right. And reminder bestie: not all mice support horizontal scrolling โ this is mostly for touchpads, trackpads, etc. ๐ฅ
text-selection()
This action lets you mark a rectangular region of text in the DVI file. The text gets put into the X selection buffer, so you can paste it into other applications (like text editors, obviously). It works similar to the Plain text option in the Save dialog; check out the discussion there for more info on encoding issues. Copy-paste girlies rise up ๐ซถ
ruler()
This action creates a cross-shaped ruler. Moving the mouse while holding the button down drags the ruler around and lets you measure distances on the page. See the Ruler Mode section for more on this. Measure twice, slay once ๐
โจ UNBOUND ACTIONS โจ
okay so these next ones are not glued to any key by default, but bestie they are so there for you if you wanna customize. your canvas, your rules ๐
quit-confirm()โ pops up a lil confirmation window before quitting xdvi, because sometimes you're clumsy and you need a safety net ๐ฅบ. wanna bind it to theqkey instead of the defaultquit()action? drop this into your~/.Xdefaultsfile:
xdvi.mainTranslations: #override\
<Key>q: quit-confirm()\n
down-or-next()โ basically the cousin ofunpause-or-next(): it scrolls down two-thirds of a windowfull, or, if you're already chillin' at the bottom of the page, it flips to the next page. main character energy fr โจshrink-to-dpi()โ this one takes one (required!) argument, no cap. it sets the shrink factor to an integer so you can approximate using fonts with the corresponding number of dots per inch. here's the math bestie: if xdvi is using fonts scaled for p dots per inch, and the argument to shrink-to-dpi is n, then the shrink factor you get is the ratio p/n, rounded to the nearest integer. slay ๐งฎuser-exec()โ takes one (required) argument. it runs an external program specified by that argument, and it gets tokenized on whitespace. theXDVI_FILEenvironment variable is set to the absolute pathname of the DVI file so the program can actually find the DVI ๐ซถ. for example, wanna make themkey regenerate the DVI file withmake? put this in your~/.Xdefaultsfile:
xdvi.mainTranslations: #override\
<Key>m: user-exec(xdvi-remake)\n
where xdvi-remake names a program in your PATH analogous to cd $(dirname $XDVI_FILE) && make $(basename $XDVI_FILE). (also peep 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? totally changeable, just set the mainTranslations resource to a string of translations like the X toolkit documentation describes. the actions should take the form of action names listed up in the KEYSTROKES and MOUSE ACTIONS sections, iykyk โจ
one exception tho bestie: the Motif keysosfPageUp(PgUp),osfPageDown(PgDown),osfBeginLine(Home) andosfEndLine(End) are currently not customizable in the Motif version. sad but true ๐ญ
key actions are usually without arguments; but if they do get passed an argument, it represents the optional number or prefix argument you typed before the action ๐ซ
some key actions take special arguments, like:
- the argument of
goto-pagemay be the lettere, which means "go to the end of the document" ๐ - the argument of
set-shrink-factormay be the lettera, meaning 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-, meaning the shrink factor should be increased or decreased respectively ๐ - finally, actions that would perform a toggle, such as
set-keep-flag, may receive an argumentt, meaning the action should toggle regardless of the current prefix argument ๐
mouse actions should refer only to ButtonPress events (like <Btn1Down>:magnifier(*1)). the corresponding motion and release events get handled internally. also: a key action may be bound to a mouse event, but not the other way around, so don't try it ๐ซ
usually your string of translations should start with #override, which says "hey, don't throw away the default key and mouse button assignments" ๐
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, like:
xdvi.mainTranslations: #override \
Shift<Key>s: select-dvi-file()\n\
Ctrl<Key>s: save()\n\
<Key>s: find()\n
here's the tea โ: because xdvi needs to capture pointer motion events, and because the X Toolkit translations mechanism can't handle both motion events and double-click events at the same time, it is not possible to specify double-click actions in xdvi customizations. for the deets on this and other translations stuff, go read the X Toolkit Intrinsics documentation ๐
there's also no command-line option to set the mainTranslations resource, because changing this resource on the command line would be straight-up cumbersome ๐. to set the resource for testing purposes, use the -xrm command-line option that the X toolkit provides. 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. periodt ๐
some resources are also provided to let you customize the geometry of the Xaw command buttons. again, these 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 placed on either side of the buttons. the default value is6.buttonTopSpacingโ the number of pixels between the top button and the top of the window. the default value is50.buttonBetweenSpacingโ the number of pixels between the buttons. the default value is20.buttonBetweenExtraโ the number of pixels of additional space to be inserted if thebuttonTranslationsresource string contains an extra newline character. the default value is50.buttonBorderWidthโ the border width of the button windows. the default value is1.
๐ PAGE LIST ๐
the scrollable page list on the right of the main window lets you jump directly to any page in the DVI file. iconic โจ
- Mouse-1 โ jumps to the page the mouse is located on ๐ฑ๏ธ
- Mouse-2 โ [
toggle-mark()] toggles the mark of the current page. these marks are used by thePrintandSave to filedialogs to select only the 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 ๐ก
๐ SCROLLBARS ๐
the scrollbars (if present) behave in the standard way, no surprises here:
- 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 โฌ๏ธ
and bestie, you can remove the scrollbars entirely via the -expertmode flag/keystroke (which see) ๐
๐ MAGNIFIER ๐
by default, mouse buttons 1 to 5 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, which is honestly so satisfying ๐
when the magnifier is moved, small ruler-like tick marks get displayed at the edges of the magnifier โ unless the X resource delayRulers is set to false, in which case the tick marks are always 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 entirely ๐ซ
๐ธ PAGE HISTORY ๐ธ
xdvi keeps a whole history of viewed pages, bestie โ you can move through the history and delete items using these keys:
[โpagehistory-back()]โpagehistory-forward()Ctr-[โpagehistory-delete-backward()Ctr-]โpagehistory-delete-forward()
when one of the history commands is used, the page history gets 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 # ๐๏ธ
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 ๐ป
๐ฆ HYPERLINKS ๐ฆ
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()) ๐
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 figure out if it's a DVI file. if it is, xdvi will try to display it; otherwise it will try to determine the MIME type of the file, and from that an application suitable for opening it. this is done by parsing:
- the files specified by the environment variable
EXTENSIONMAPSfor a mapping of filename extensions to MIME types ๐ - and the files determined by the environment variable
MAILCAPSfor a mapping of MIME types to application programs ๐
see the descriptions of these variables in the section ENVIRONMENT below for a more detailed rundown 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. so:
- if a filename has no suffix, the value of the resource
noMimeSuffixis used (by defaultapplication/x-unknown) ๐คท - if the suffix doesn't match any of the suffixes in
mime.types, the value of the resourceunknownMimeSuffixis used (by defaultapplication/x-unknown) ๐คท - if the mailcap entries don't list a viewer for a given mime type, xdvi will show a warning popup โ ๏ธ
if you want to avoid that 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)'
๐ STRING SEARCH ๐
okay so you wanna find text inside your DVI file? bestie, hit Ctrl-f, or go through the menu at File > Find ... (or, if you're living that Motif life, click the little Binoculars symbol up in the toolbar). A dialog window pops up and you can search for either a plain text string or a full-on regular expression. And to jump to the next match? That's Ctrl-g โ literally the same thing as smashing the Find button in that search window. ๐
By default, your matches get highlighted in inverted color, which is iconic. BUT โ if your display isn't running in TrueColor, or if the X resource matchHighlightInverted is set to false, or if you pass the command-line option -nomatchinverted, then xdvi switches it up and instead draws a rectangle in the highlight color around the match (that's the -hl option, iykyk).
If a match crosses a page boundary, only the part sitting on the first page gets highlighted. xdvi will scan up to 2 adjacent pages to match strings that cross page boundaries โ but heads up, header or footer lines, or any intervening float pages, get treated as parts of the scanned text. And that kinda text will usually make multi-page matching fail. ๐ซ
This whole thing really emphasizes that searching in the formatted text (the DVI output) works differently from searching in the source text. Searching in the DVI file makes it easier to skip past formatting instructions, and it makes it possible to search for stuff like hyphenation and equation numbers โ slay. But sometimes the formatting results get in the way, e.g. with footnotes. In those cases it's better to search in the TeX source instead. Using source specials makes switching between the xdvi display and the editor with the TeX source easier; check out the section SOURCE SPECIALS below for the tea on that. โ
The text extracted from the DVI file is encoded in UTF-8 (you can actually view that text by saving the file in UTF-8 format through the File > Save as ... menu item). 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 a 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 (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 โ and those names are case-insensitive, so don't stress about it. ๐
Ideographic characters from CJKV fonts get treated specially: all white space (spaces and newlines) before and after such characters is ignored โ both in the search string and in the DVI file. no cap.
Wanna match a newline character? Use \n in the search string. Wanna match the literal string \n? Use \\n. ๐
๐ง Regular Expression Mode ๐ง
If the Regular Expression checkbox is activated, your string gets treated as a regular expression in extended POSIX syntax, with the following properties:
a?matchesazero or one times.a*matchesazero or more times.a+matchesaone 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}matchesaexactly n times.a{n,m}matchesaat least n and no more than m times.a|bmatchesaorb. Brackets can be used for grouping, e.g.:(a|b)|c.- The string matched by the *n*th group can be referenced by
\n, e.g.\1refers to the first match. - The characters
^and$match the beginning and the end of a line, respectively. [abc]matches any of the lettersa,b,c, and[a-z]matches all characters fromatoz.- 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 dialog also provides checkboxes to:
- search backwards;
- match in a case-sensitive manner (the default is to ignore case, i.e. a search string
Testwill match both the stringstestandTESTin 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 are separated by a linebreak.
Note that the hyphen removal may cause unwanted side effects for compound words containing hyphens that are wrapped after the hyphen, and that replacing the newlines affects the interpretation of regular expressions as follows: The.pattern will also match newlines, and^and$won't match begin and end of lines any more. (Since currently there is 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. โจ
๐จ๏ธ PRINT DIALOG ๐จ๏ธ
The print dialog window lets you print all pages, marked pages (just click or drag Mouse-2 in the page list to mark them), or a range of pages. Heads up tho: the page numbers always refer to physical pages, so if you're using the option use TeX pages, you may wanna disable it to make it easier to figure out the correct page numbers โ or just dodge this whole problem entirely by marking the pages you want to print. ๐ฏ
The value of the Printer text field is passed to dvips via the -o! mechanism, as a single argument after the !. Any arguments listed in the Dvips options field are segmented at whitespace and passed as separate arguments to dvips. So if you e.g. want to 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:
dvipsPrinterStringdvipsOptionsString
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} โ this is the preferred method), 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.
dvipsHangTimedvipsFailHangTime
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. If both values are negative, the window will stay open until it is closed by the user. ๐
๐พ SAVE DIALOG ๐พ
This dialog allows you to save all or selected/marked pages in the current DVI file. You can save in one of the following formats:
- PostScript (uses
dvipsto convert the DVI file to a PostScript file, just like when printing to a PostScript file). - PDF (first uses
dvipsto convert the DVI file to a PostScript file, then usesps2pdfto convert the PostScript file to PDF). - Plain text in
ISO-8859-1orUTF-8encoding. The latter will preserve more of the special LaTeX characters e.g. from mathematical mode. Note however 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 cannot be displayed in the selected charset, it is replaced by\'followed by the hexadecimal character code. If a character is not recognized at all, it is 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, so <pink>Ctrl-m</pink> โ that's [switch-mode()] โ flips you between three whole different mouse bindings. you can also do it from the Modes menu (in Motif it's a submenu of the Options menu, and it's called Mouse Mode there, cute right?). the mode you start in is customizable via the X resource mouseMode or the command-line option -mousemode. and the default startup mode? Magnifier Mode. slay.
โ ๏ธ heads up bestie: the modes work by changing themagnifier()action. so if you customized Mouse-1 to an action sequence that doesn't containmagnifier(), switching modes just won't work. not me warning you twice ๐
๐ Magnifier Mode
in this mode, mouse buttons 1 to 5 pop up a "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 โ at varying sizes.
when you move the magnifier around, little ruler-like tick marks show up at the edges of the magnifier. unless the X resource delayRulers is set to false, in which case the tick marks are always displayed. ๐
the unit of the marks is decided by the X resource tickUnits (mm by default). you can change that unit at runtime with the action switch-magnifier-units(), which is by default bound to the keystroke t (peep the description of that key, and of switch-magnifier-units(), for all the deets on which units you get).
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 entirely. gone. poof. โจ
๐ Text Selection Mode
this mode lets you select a rectangular region of text in the DVI file by holding down Mouse-1 and moving the mouse. the text goes into the X primary selection so you can paste it into other X applications with Mouse-2 like usual. ๐ซถ
if xdvi was compiled with locale, nl_langinfo() and iconv support, the selected text is converted into the character set of the current locale (run locale -a to see 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). if iconv support isn't available at all, only the encodings ISO-8859-1 and UTF-8 are supported (and those names are case-insensitive, so don't stress the caps).
๐ note thatUTF-8is the only encoding that can render all characters (e.g. mathematical symbols) of a DVI file. ifISO-8859-1is active, characters that can't be displayed get replaced by\followed by the hexadecimal character code. for other encodings, those characters may triggericonverror messages. and if a character isn't recognized at all, it's replaced by?.
want to grab larger portions of text? you can alternatively save selected pages, or the entire file, in text format via the File > Save as ... menu. iconic.
๐ Ruler Mode
this mode gives you a simple way of measuring distances on the page.
when you activate it, the mouse cursor turns into a thin cross, and a bigger, cross-shaped ruler is drawn in the highlight color 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. ๐
when you activate Ruler Mode, the ruler is first attached to the mouse and can be moved around. you can then position it at a fixed place by clicking Mouse-1. 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.
clicking Mouse-1 again moves the ruler 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 resourcetickUnits(mmby default).P[overrides declare-page-number()]โ print the distances shown in the statusline to standard output.
๐ ๏ธ TOOLBAR (Motif only) ๐ ๏ธ
the Motif toolbar is customizable too, bestie. the XPM file used for the toolbar icons can be specified via the resource toolbarPixmapFile, which should contain a filename findable in one of XFILESEARCHPATH or XDVIINPUTS (see 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 each piece is treated as an image for toolbar button n. so basically: every icon should be a square, and the whole pixmap should be n x h wide if h is the height of the pixmap. math. ๐
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 single 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 these 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, the default value of toolbarTranslations looks like this:
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, a "tooltip" window pops up describing what the button does, using the short tooltip string from that resource. and at the same time, the long tooltip string is displayed in the statusline. two for one, we love to see it. โจ
the appearance and behaviour of these tooltips can be customized via these 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 ๐
ngl bestie, the greyscale anti-aliasing feature in xdvi will not work at its best if the display doesn't have enough colors available. this can happen when other applications are hogging most of the colormap (even if they're iconified, rude). if that happens, xdvi prints an error message and turns on the -copy option. this makes overstrike characters appear wrong, and it may also give you poor display quality if the number of available colors is very small. ๐
typically this problem happens on displays that allocate eight bits of video memory per pixel. wanna know 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 tells you how many bits are allocated per pixel. iykyk.
displays using at least 15 bits per pixel are typically TrueColor visuals, which don't have this problem at all, since their colormap is permanently allocated and available to all applications. (the visual class is also displayed by xwininfo.) for more info on visual classes, see the documentation for the X Window System. ๐
so to alleviate this problem, you can (a) run with more bits per pixel (might require adding more video memory or replacing the video card, rip your wallet), (b) shut down other applications that may be using much of the colormap and then restart xdvi, or (c) run xdvi with the -install option.
one application that's often the cause of this problem is Netscape. in that case there are two more alternatives:
- run
netscape -installto make Netscape install a private colormap. > โ ๏ธ this can cause colors to change in bizarre ways when the mouse is moved to a different window. - run
netscape -ncols 220to limit Netscape to a smaller number of colors. a smaller number ensures other applications have more colors available, but it will degrade the color quality in the Netscape window. pick your poison bestie ๐
๐ HANDLING OF POSTSCRIPT FIGURES ๐
ok so here's the tea bestie ๐ Xdvi can literally display Encapsulated PostScript (EPS) files that are included in the dvi file. Iconic.
Where does it go looking for them? First in the directory where the dvi file lives, and then using the normal Kpathsea rules. โจ
But wait โ there's an exception, and it's a big one ๐จ: if the file name begins with a backtick (`), then the rest of the characters in the file name are actually a shell command (often zcat) which gets executed, and its standard output is then sent off to be interpreted as PostScript. ๐ณ
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. fr fr, not even once. ๐
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<tm> Type 1 fonts directly, without the whole detour via TeX pixel (pk) fonts. The glow-up here is that only one size of each font needs to be stored on disk. ๐
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<tm> 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<tm> 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. ๐ญ rip bestie
โจ 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 โ it just tells other dvi drivers (such as e.g. dvips) to ignore the special. ๐ซ
๐ฆ 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`.) the way that works is so satisfying ngl ๐
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. โ ๏ธ
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. โจ
If the paper resource (or -paper command-line option) begins with a plus sign (+), then all papersize specials in the dvi file are ignored. ๐
๐ 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 section bestie ๐
๐ฟ ENVIRONMENT ๐ฟ
ok so xdvik is not doing its own lil font-hunt, bestie โ it uses the same environment variables and algorithms for searching for font files as TeX and friends. See the documentation for the Kpathsea library, kpathsea.dvi, for a detailed description of these. it's giving "shared custody of the font search" fr fr ๐
Plus, xdvik accepts the following variables:
DISPLAYโ specifies which graphics display terminal to use. classic.KPATHSEA_DEBUGโ trace Kpathsea lookups; set it to-1(= all bits on) for complete tracing. maximum snooping, no notes ๐ต๏ธ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/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 themailcap(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 ifcommandcan be executed via thesystem()call and if thesystem()call returns with value0(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 newxtermwindow by prependingxterm -eto 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/etc/mailcap:\
/usr/local/etc/mailcap
For security reasons, some special characters (i.e. ( ) \ ;) are escaped in the argument before passing it to system()`.
bestie the escaping thing is the whole point, don't skip it, it's keeping you safe from your own filenames ๐
BROWSERโ determines the web browser used to open external links (i.e. all URLs that don't start with thefile: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 status0). This allows you to specify your favourite browser at the beginning, and fallback browsers at the end. Every occurrence of%sin the string is replaced by the target URL; every occurrence of%%is replaced by a single%. If no%sis 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 forFontmapfiles, 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 commandgs -hwill list the default value that Ghostscript uses. See also theXDVI_GS_LIBenvironment variable (below).XDVI_GS_LIBโ this has the same effect asGS_LIBbut affects onlyxdvi. Use this when you want to use a different value forGS_LIBwhen runningxdvi, but use either the compiled-in default value or some other value when running Ghostscript. If bothGS_LIBandXDVI_GS_LIBare set, thenxdviusesXDVI_GS_LIB. To use the default value compiled in toxdviwhile still retaining the ability to setGS_LIBfor use with Ghostscript, you can setXDVI_GS_LIBto 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 specialreverse search, if neither the-editorcommand-line option nor the.editorresource are specified. See the description of the-editorcommand line option for details on the format.VISUALโ determines an editor to be opened in anxtermwindow if neither of-editor,.editor, orXEDITORis specified.EDITORโ determines an editor to be opened in anxtermwindow if neither of-editor,.editor,XEDITORorVISUALis specified. the fallback chain is giving "last one picked in gym class" ๐ญWWWBROWSERโ obsolete; useBROWSERinstead.
๐ง LIMITATIONS ๐ง
ok real talk, this is the "we don't do that here" section, and it's important, so read it:
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 "by design, sorry babe" ๐
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.
๐ซถ none of this is your fault, it's just how the rendering engine was built. don't come for yourself.
๐ FILES ๐
$HOME/.xdvircโ a file that holds all settings that the user changed via the keys, theOptionsand the XawModesmenu and the dialogs, as X resources. These resources override the settings in$HOME/.Xdefaults. This file is ignored if the-qoption is used or thenoInitFileX 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 theTEXCONFIGenvironment variable. Its format is similar to configuration files for dvips, except that it is only scanned for the names of map files (pandp+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/.
๐ 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.
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.
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
๐ธ real ones report bugs instead of just suffering in silence, ok? the maintainers genuinely want to hear it.
and that's a wrap on the whole page, bestie!! ๐โจ this is Xdvik 22.87.06, dated 2022-02-17 โ go forth and render your .dvi files, you absolute icon. periodt ๐
๐ฆ
๐ฆ where this page comes from
- alpine 3.24: texlive-doc 2026.0-r0 ยท GPL-2.0-or-later AND GPL-3.0-or-later
- arch rolling: texlive-doc 2026.1-1 ยท GPL
- fedora 43: texlive-xdvi 11:svn62387-93.fc43 ยท MIT
- fedora 43: texlive-xdvi 11:svn62387-95.fc43.1 ยท MIT
- fedora 44: texlive-xdvi 12:svn62387-105.fc44 ยท MIT
- fedora 44: texlive-xdvi 12:svn62387-111.fc44 ยท MIT
- opensuse-leap 16.0: texlive-xdvi-doc 2025.221.svn62387-160000.3.1 ยท LPPL-1.0
- Copyright 1990-2022 Paul Vojta and others
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms