The device independent file format (DVI) is the output
file format
A file format is a standard way that information is encoded for storage in a computer file. It specifies how bits are used to encode information in a digital storage medium. File formats may be either proprietary or free.
Some file formats ...
of the
TeX
Tex may refer to:
People and fictional characters
* Tex (nickname), a list of people and fictional characters with the nickname
* Joe Tex (1933–1982), stage name of American soul singer Joseph Arrington Jr.
Entertainment
* ''Tex'', the Italian ...
typesetting
Typesetting is the composition of text by means of arranging physical ''type'' (or ''sort'') in mechanical systems or ''glyphs'' in digital systems representing ''characters'' (letters and other symbols).Dictionary.com Unabridged. Random Ho ...
program, designed by David R. Fuchs and implemented by
Donald E. Knuth
Donald Ervin Knuth ( ; born January 10, 1938) is an American computer scientist, mathematician, and professor emeritus at Stanford University. He is the 1974 recipient of the ACM Turing Award, informally considered the Nobel Prize of computer sc ...
in 1982.
Unlike the TeX markup files used to generate them, DVI files are not intended to be
human-readable
A human-readable medium or human-readable format is any encoding of data or information that can be naturally read by humans.
In computing, ''human-readable'' data is often encoded as ASCII or Unicode text, rather than as binary data. In most c ...
; they consist of
binary data
Binary data is data whose unit can take on only two possible states. These are often labelled as 0 and 1 in accordance with the binary numeral system and Boolean algebra.
Binary data occurs in many different technical and scientific fields, wher ...
describing the visual layout of a document in a manner not reliant on any specific
image format
An Image file format is a file format for a digital image. There are many formats that can be used, such as JPEG, PNG, and GIF. Most formats up until 2022 were for storing 2D images, not 3D ones. The data stored in an image file format may be ...
,
display hardware or
printer
Printer may refer to:
Technology
* Printer (publishing), a person or a company
* Printer (computing), a hardware device
* Optical printer for motion picture films
People
* Nariman Printer (fl. c. 1940), Indian journalist and activist
* James ...
. DVI files are typically used as input to a second program (called a DVI ''driver'') which translates DVI files to graphical data. For example, most TeX software packages include a program for previewing DVI files on a user's computer display; this program is a driver. Drivers are also used to convert from DVI to popular
page description language
In digital printing, a page description language (PDL) is a computer language that describes the appearance of a printed page in a higher level than an actual output bitmap (or generally raster graphics). An overlapping term is printer control la ...
s (e.g.
PostScript
PostScript (PS) is a page description language in the electronic publishing and desktop publishing realm. It is a dynamically typed, concatenative programming language. It was created at Adobe Systems by John Warnock, Charles Geschke, Doug Br ...
,
PDF
Portable Document Format (PDF), standardized as ISO 32000, is a file format developed by Adobe in 1992 to present documents, including text formatting and images, in a manner independent of application software, hardware, and operating systems. ...
) and for printing.
TeX markup may be at least partially
reverse-engineer
Reverse engineering (also known as backwards engineering or back engineering) is a process or method through which one attempts to understand through deductive reasoning how a previously made device, process, system, or piece of software accompl ...
ed from DVI files, although this process is unlikely to produce high-level constructs identical to those present in the original markup, especially if the original markup used high-level TeX extensions (e.g.
LaTeX
Latex is an emulsion (stable dispersion) of polymer microparticles in water. Latexes are found in nature, but synthetic latexes are common as well.
In nature, latex is found as a milky fluid found in 10% of all flowering plants (angiosperms ...
).
DVI differs from
PostScript
PostScript (PS) is a page description language in the electronic publishing and desktop publishing realm. It is a dynamically typed, concatenative programming language. It was created at Adobe Systems by John Warnock, Charles Geschke, Doug Br ...
and
PDF
Portable Document Format (PDF), standardized as ISO 32000, is a file format developed by Adobe in 1992 to present documents, including text formatting and images, in a manner independent of application software, hardware, and operating systems. ...
in that it does not support any form of font embedding. (Both PostScript and PDF formats can either embed their fonts inside the documents, or reference external ones.) For a DVI file to be printed or even properly previewed, the fonts it references must be already installed. Like PDF, DVI uses a limited sort of machine language with termination guarantees that is not a full,
Turing-complete
In computability theory, a system of data-manipulation rules (such as a computer's instruction set, a programming language, or a cellular automaton) is said to be Turing-complete or computationally universal if it can be used to simulate any Tur ...
programming language like PostScript.
As of 2004 there is a compilation of the specifications a DVI driver must implement by the "TUG DVI Driver Standards Committee". It seems to be based on a TUGboat article of the same name from 1992, but which is much shorter. These documents do not specify the
endianness
In computing, endianness, also known as byte sex, is the order or sequence of bytes of a word of digital data in computer memory. Endianness is primarily expressed as big-endian (BE) or little-endian (LE). A big-endian system stores the most sig ...
, which is however big endian, as can be seen looking into a DVI file itself.
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-like language", in
Knuth's words.
Each command begins with an eight-bit
opcode
In computing, an opcode (abbreviated from operation code, also known as instruction machine code, instruction code, instruction syllable, instruction parcel or opstring) is the portion of a machine language instruction that specifies the operat ...
, followed by zero or more bytes of parameters. For example, an opcode from the group
0x00
through
0x7F
(decimal 127),
set_char_''i''
, typesets a single character and moves the implicit cursor right by that character's width. In contrast, opcode
0xF7
(decimal 247),
pre
(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:
. ''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. 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
push
or
pop
are encountered. Font spacing information is loaded from
TFM files. The fonts themselves are not embedded in the DVI file, only referenced by an integer value defined in the relevant
fnt_def''i''
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
Tex may refer to:
People and fictional characters
* Tex (nickname), a list of people and fictional characters with the nickname
* Joe Tex (1933–1982), stage name of American soul singer Joseph Arrington Jr.
Entertainment
* ''Tex'', the Italian ...
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
TFM format is limited to that range. Character codes in DVI files refer to the
character encoding
Character encoding is the process of assigning numbers to Graphics, graphical character (computing), characters, especially the written characters of Language, human language, allowing them to be Data storage, stored, Data communication, transmi ...
of the current font rather than that of the system processing it. This means, for instance, that an
EBCDIC
Extended Binary Coded Decimal Interchange Code (EBCDIC; ) is an eight-bit character encoding used mainly on IBM mainframe and IBM midrange computer operating systems. It descended from the code used with punched cards and the corresponding six- ...
-based system can process a DVI file that was generated by an
ASCII
ASCII ( ), abbreviated from American Standard Code for Information Interchange, is a character encoding standard for electronic communication. ASCII codes represent text in computers, telecommunications equipment, and other devices. Because of ...
-based system, so long as it has the same fonts installed.
Graphics as specials
The DVI format does not have support for
graphics
Graphics () are visual images or designs on some surface, such as a wall, canvas, screen, paper, or stone, to inform, illustrate, or entertain. In contemporary usage, it includes a pictorial representation of data, as in design and manufacture ...
except for the most basic black-and-white boxes. Instead DVI has a general escape/extension mechanism, known as specials (expressed by the
\special
command in TeX), which defers graphics (and color) to post-processing filters. There are numerous DVI specials, the most notable of which are
PostScript
PostScript (PS) is a page description language in the electronic publishing and desktop publishing realm. It is a dynamically typed, concatenative programming language. It was created at Adobe Systems by John Warnock, Charles Geschke, Doug Br ...
specials, but other programs like
tpic have their own.
DVI versions
DVI related software
DVI files are often converted into PDF, PostScript, or
PCL format for reading and printing. They can be also viewed directly by using DVI viewers.
* DVI viewers:
YAP
Yap ( yap, Waqaab) traditionally refers to an island group located in the Caroline Islands of the western Pacific Ocean, a part of Yap State. The name "Yap" in recent years has come to also refer to the state within the Federated States of Micr ...
(included in
MiKTeX
MiKTeX is a free and open-source distribution of the TeX/LaTeX typesetting system for Microsoft Windows (and for Mac and certain Linux distributions such as Ubuntu, Debian and Fedora). It also contains a set of related programs. MiKTeX provides ...
),
xdvi
xdvi is an open-source computer program written by Paul Vojta for displaying TeX-produced .dvi files under the X Window System on Unix, including Linux.
The xdvi interface has a set of GUI controls and a window displaying a single page of the ...
windvi Evince
Evince (), also known as GNOME Document Viewer, is a free and open source document viewer supporting many document file formats including PDF, PostScript, DjVu, TIFF, XPS and DVI. It is designed for the GNOME desktop environment.
The develo ...
KDVI Okular
Okular is a multiplatform document viewer developed by the KDE community and based on Qt and KDE Frameworks libraries. It is distributed as part of the KDE Applications bundle. Its origins are from KPDF and it replaces KPDF, KGhostView, KFax, ...
dvioutdviwin DView (included in the commercial BaKoMa TeX distribution)
javaDVIMDVI and DVIWindo (of the now defunct commercial Y&Y TeX, which has been open-sourced).
* DVI to human-readable format: dvitype (disassembler of sorts)
* DVI-to-PDF converters: dvipdf, dvipdfm, dvipdfmx
* DVI-to-PS converters:
dvips
dvips is a computer program that converts the Device Independent file format (DVI) output of TeX typography into a printable or otherwise presentable form. was written by Tomas Rokicki to produce printable PostScript files from DVI input, and ...
is the de facto standard.
CTAN
CTAN (an acronym for "Comprehensive TeX Archive Network") is the authoritative place where TeX related material and software can be found for download. Repositories for other projects, such as the MiKTeX distribution of TeX, constantly mirror mo ...
includes some older ones like dvitops (and DVIPSONE) with a note that they lost their market share a long time ago.
* DVI-to-bitmap converters:
dvipng (generates GIF or PNG), or use
dvips
dvips is a computer program that converts the Device Independent file format (DVI) output of TeX typography into a printable or otherwise presentable form. was written by Tomas Rokicki to produce printable PostScript files from DVI input, and ...
and
Ghostscript
Ghostscript is a suite of software based on an interpreter for Adobe Systems' PostScript and Portable Document Format (PDF) page description languages. Its main purposes are the rasterization or rendering of such page description language files, ...
* DVI-to-SVG converters
dvisvg[dvisvgm]
dvi2svg; the only one included in CTAN
CTAN (an acronym for "Comprehensive TeX Archive Network") is the authoritative place where TeX related material and software can be found for download. Repositories for other projects, such as the MiKTeX distribution of TeX, constantly mirror mo ...
and actively maintained is dvisvgm.
The first DVI previewers capable of on-screen previewing and modification of LaTeX documents ran on Amiga
Amiga is a family of personal computers introduced by Commodore in 1985. The original model is one of a number of mid-1980s computers with 16- or 32-bit processors, 256 KB or more of RAM, mouse-based GUIs, and significantly improved graphi ...
s.
DVI-to-PDF converters
dvipdf is a tool to translate DVI files (generated by TeX
Tex may refer to:
People and fictional characters
* Tex (nickname), a list of people and fictional characters with the nickname
* Joe Tex (1933–1982), stage name of American soul singer Joseph Arrington Jr.
Entertainment
* ''Tex'', the Italian ...
) to PDF
Portable Document Format (PDF), standardized as ISO 32000, is a file format developed by Adobe in 1992 to present documents, including text formatting and images, in a manner independent of application software, hardware, and operating systems. ...
files. In current Linux distributions like Ubuntu
Ubuntu ( ) is a Linux distribution based on Debian and composed mostly of free and open-source software. Ubuntu is officially released in three editions: '' Desktop'', ''Server'', and ''Core'' for Internet of things devices and robots. All ...
, it is a thin wrapper around dvips and Ghostscript
Ghostscript is a suite of software based on an interpreter for Adobe Systems' PostScript and Portable Document Format (PDF) page description languages. Its main purposes are the rasterization or rendering of such page description language files, ...
, and copyrighted to Artifex Software (the makers of Ghostscript). A possibly different program with the same name—described as a modified version of dvips—was announced in the late 1990s by Sergey Lesenko, however it was apparently never released.
dvipdfm is a DVI-to-PDF translator developed by Mark A. Wicks. The early documentation of dvipdfm specifically mentions the limited availability of Lesenko's dvipdf as a reason for creating dvipdfm. dvipdfm supports most of the newer special functions of the PDF format, including bookmark
A bookmark is a thin marking tool, commonly made of card, leather, or fabric, used to keep track of a reader's progress in a book and allow the reader to easily return to where the previous reading session ended. Alternate materials for boo ...
s, annotation
An annotation is extra information associated with a particular point in a document or other piece of information. It can be a note that includes a comment or explanation. Annotations are sometimes presented in the margin of book pages. For anno ...
s, thumbnails
Thumbnails are reduced-size versions of pictures or videos, used to help in recognizing and organizing them, serving the same role for images as a normal text index (publishing), index does for words. In the age of digital images, visual search ...
, and dvips specials—a feature making possible the inclusion of Encapsulated PostScript (.eps) files like METAPOST
MetaPost refers to both a programming language and the interpreter of the MetaPost programming language. Both are derived from Donald Knuth's Metafont language and interpreter. MetaPost produces vector graphic diagrams from a geometric/algebra ...
output—as well inclusion of JPEG
JPEG ( ) is a commonly used method of lossy compression for digital images, particularly for those images produced by digital photography. The degree of compression can be adjusted, allowing a selectable tradeoff between storage size and imag ...
and PNG images; other features of dvipdfm include partial font embedding
Font embedding is the inclusion of font files inside an electronic document. Font embedding is controversial because it allows licensed fonts to be freely distributed.
History
Font embedding has been possible with Portable Document Format (PDF), M ...
(reducing file size) and balancing the internal PDF document trees to speed up rendering of large documents. Many of these features (except for the direct support for .eps files) are also present in pdfTeX
__NOTOC__
The computer program pdfTeX is an extension of Knuth's typesetting program TeX, and was originally written and developed into a publicly usable product by Hàn Thế Thành as a part of the work for his PhD thesis at the Faculty of In ...
, which typesets TeX directly to PDF. The 2004, 4th edition of the ''Guide to LaTeX'' compares them in the following way:
dvipdfmx is an extended version of the dvipdfm DVI-to-PDF translator, included in current TeX distributions like TeX Live
TeX Live is a cross-platform, free software distribution for the TeX typesetting system that includes major TeX-related programs, macro packages, and fonts. It is the replacement of its no-longer supported counterpart teTeX.
It is now the def ...
2014 and MiKTeX
MiKTeX is a free and open-source distribution of the TeX/LaTeX typesetting system for Microsoft Windows (and for Mac and certain Linux distributions such as Ubuntu, Debian and Fedora). It also contains a set of related programs. MiKTeX provides ...
2.9. The primary goal of the dvipdfmx project is to support multi-byte character encodings and CJK character sets for East Asian languages. dvipdfmx is also included (in a somewhat modified form) in XeTeX
XeTeX (
or ; see also Pronouncing and writing "TeX") is a TeX typesetting engine using Unicode and supporting modern font technologies such as OpenType, Graphite and Apple Advanced Typography (AAT). It was originally written by Jonathan Ke ...
.
The 2nd, 2008 edition of the ''LaTeX Graphics Companion'' makes the following workflow suggestion:
References and notes
*
External links
(Unofficial) description of the DVI file format
TeX DVI file Information utility
CTAN: /tex-archive/dviware
pdftex - Why does pdflatex produce bigger output files than latex+dvipdfm?
{{TeX navbox
Page description languages
Computer file formats
Open formats
TeX