Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Device independent file format
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Specification == The DVI format was designed to be compact and easily machine-readable. Toward this end, a DVI file is a sequence of commands which form "a [[machine language|machine-like language]]", in [[Donald Knuth|Knuth]]'s words.<ref name="DVItype"/> Each command begins with an eight-bit [[opcode]], followed by zero or more bytes of parameters. For example, an opcode from the group <code>0x00</code> through <code>0x7F</code> (decimal 127), <code>set_char_''i''</code>, typesets a single character and moves the implicit cursor right by that character's width. In contrast, opcode <code>0xF7</code> (decimal 247), <code>pre</code> (the preamble, which must be the first opcode in the DVI file), takes at least fourteen bytes of parameters, plus an optional comment of up to 255 bytes. In a broader sense, a DVI file consists of a preamble, one or more pages, and a postamble. Six state variables are maintained as a tuple of signed, 32-bit integers: <math>(h,v,w,x,y,z)</math>. ''h'' and ''v'' are the current horizontal and vertical offsets from the upper-left corner (increasing ''v'' moves down the page), ''w'' and ''x'' hold horizontal space values, ''y'' and ''z'', vertical. These variables can be pushed to or popped from the [[stack (data structure)|stack]]. In addition, the current font ''f'' is held as an integer value, but is not pushed and popped with the rest of the state variables when the opcodes <code>push</code> or <code>pop</code> are encountered. Font spacing information is loaded from [[TeX font metric|TFM]] files. The fonts themselves are not embedded in the DVI file, only referenced by an integer value defined in the relevant <code>fnt_def''i''</code> op. (This is done exactly twice for each loaded font: once before it is referenced, and once in the postamble.) ''f'' contains an integer value of up to four bytes in length, though in practice, [[TeX]] only ever outputs font numbers in the range 0 through 255. Similarly, the DVI format supports character codes up to four bytes in length, even though only the 0β255 range is commonly seen, as the [[TeX font metric|TFM]] format is limited to that range. Character codes in DVI files refer to the [[character encoding]] of the current font rather than that of the system processing it. This means, for instance, that an [[EBCDIC]]-based system can process a DVI file that was generated by an [[ASCII]]-based system, so long as it has the same fonts installed.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)