DVI (file format)
Encyclopedia
The Device independent file format (DVI) is the output file format
File format
A file format is a particular way that information is encoded for storage in a computer file.Since a disk drive, or indeed any computer storage, can store only bits, the computer must have some way of converting information to 0s and 1s and vice-versa. There are different kinds of formats for...

 of the TeX
TeX
TeX is a typesetting system designed and mostly written by Donald Knuth and released in 1978. Within the typesetting system, its name is formatted as ....

 typesetting
Typesetting
Typesetting is the composition of text by means of types.Typesetting requires the prior process of designing a font and storing it in some manner...

 program, designed by David R. Fuchs in 1979. Unlike the TeX markup files used to generate them, DVI files are not intended to be human-readable
Human-readable
A human-readable medium or human-readable format is a representation 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 presented in a binary representation...

; they consist of binary data
Binary file
A binary file is a computer file which may contain any type of data, encoded in binary form for computer storage and processing purposes; for example, computer document files containing formatted text...

 describing the visual layout of a document in a manner not reliant on any specific image format, display hardware or printer
Computer printer
In computing, a printer is a peripheral which produces a text or graphics of documents stored in electronic form, usually on physical print media such as paper or transparencies. Many printers are primarily used as local peripherals, and are attached by a printer cable or, in most new printers, a...

. 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
Page description language
A page description language is a language that describes the appearance of a printed page in a higher level than an actual output bitmap. An overlapping term is printer control language, but it should not be confused as referring solely to Hewlett-Packard's PCL...

s (e.g. PostScript
PostScript
PostScript is a dynamically typed concatenative programming language created by John Warnock and Charles Geschke in 1982. It is best known for its use as a page description language in the electronic and desktop publishing areas. Adobe PostScript 3 is also the worldwide printing and imaging...

, PDF
Portable Document Format
Portable Document Format is an open standard for document exchange. This file format, created by Adobe Systems in 1993, is used for representing documents in a manner independent of application software, hardware, and operating systems....

) and for printing.

DVI is not a document encryption
Encryption
In cryptography, encryption is the process of transforming information using an algorithm to make it unreadable to anyone except those possessing special knowledge, usually referred to as a key. The result of the process is encrypted information...

 format, and TeX markup may be at least partially reverse-engineered 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
LaTeX is a document markup language and document preparation system for the TeX typesetting program. Within the typesetting system, its name is styled as . The term LaTeX refers only to the language in which documents are written, not to the editor used to write those documents. In order to...

).

DVI differs from PostScript
PostScript
PostScript is a dynamically typed concatenative programming language created by John Warnock and Charles Geschke in 1982. It is best known for its use as a page description language in the electronic and desktop publishing areas. Adobe PostScript 3 is also the worldwide printing and imaging...

 and PDF 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. Also, unlike PostScript (but like PDF), DVI is not a full, Turing-complete
Turing completeness
In computability theory, a system of data-manipulation rules is said to be Turing complete or computationally universal if and only if it can be used to simulate any single-taped Turing machine and thus in principle any computer. A classic example is the lambda calculus...

 programming language, though it does use a limited sort of machine language.

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
Donald Knuth
Donald Ervin Knuth is a computer scientist and Professor Emeritus at Stanford University.He is the author of the seminal multi-volume work The Art of Computer Programming. Knuth has been called the "father" of the analysis of algorithms...

's words. Each command begins with an eight-bit opcode
Opcode
In computer science engineering, an opcode is the portion of a machine language instruction that specifies the operation to be performed. Their specification and format are laid out in the instruction set architecture of the processor in question...

, 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
Stack (data structure)
In computer science, a stack is a last in, first out abstract data type and linear data structure. A stack can have any abstract data type as an element, but is characterized by only three fundamental operations: push, pop and stack top. The push operation adds a new item to the top of 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
TeX font metric
TeX font metric is a font file format used by the TeX typesetting system. It is a font metric format, not an outline font format like TrueType, because it provides only the information necessary to typeset the font such as each character's width, height and depth. The actual glyphs are stored...

 files. The fonts themselves are not embedded in the DVI file, only referenced by an integer value defined in the relevant fnt_defi 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
TeX is a typesetting system designed and mostly written by Donald Knuth and released in 1978. Within the typesetting system, its name is formatted as ....

 only ever outputs font numbers in the range 0 through 255.

Similarly, the DVI format supports character codes up to four byte in length, even though only the 0–255 range is commonly seen, as the TFM
TeX font metric
TeX font metric is a font file format used by the TeX typesetting system. It is a font metric format, not an outline font format like TrueType, because it provides only the information necessary to typeset the font such as each character's width, height and depth. The actual glyphs are stored...

 format is limited to that range. Character codes in DVI files refer to the character encoding
Character encoding
A character encoding system consists of a code that pairs each character from a given repertoire with something else, such as a sequence of natural numbers, octets or electrical pulses, in order to facilitate the transmission of data through telecommunication networks or storage of text in...

 of the current font rather than that of the system processing it. This means, for instance, that an EBCDIC
EBCDIC
Extended Binary Coded Decimal Interchange Code is an 8-bit character encoding used mainly on IBM mainframe and IBM midrange computer operating systems....

-based system can process a DVI file that was generated by an ASCII
ASCII
The American Standard Code for Information Interchange is a character-encoding scheme based on the ordering of the English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that use text...

-based system, so long as it has the same fonts installed.

DVI related software

DVI files are often converted into PDF or PostScript files for reading and printing. They can be also viewed directly by using DVI viewers.
  • DVI viewers: YAP (included in MiKTeX
    MiKTeX
    MiKTeX is a typesetting system for Microsoft Windows that is developed by Christian Schenk. It consists of an implementation of TeX and a set of related programs....

    ), xdvi, windvi, Evince
    Evince
    Evince is a document viewer for PDF, PostScript, DjVu, TIFF and DVI designed for the GNOME desktop environment.The developers of Evince intended to replace the multiple GNOME document viewers with a single and simple application. The Evince motto sums up the project aim: "Simply a Document...

    , KDVI, Okular
    Okular
    Okular is the document viewer for KDE SC 4 . It is based on KPDF and it replaced KPDF, KGhostView, KFax, KFaxview and KDVI in KDE 4.Its functionality can be easily embedded in other applications....

    , dviout, dviwin, DView (included in BaKoMa TeX distribution), javaDVI, MDVI
  • DVI to human-readable format: dvitype
  • DVI-to-PDF converters: dvipdf, dvipdfm, dvipdfmx
  • DVI-to-PS converters: dvips
    Dvips
    dvips is a software program that converts the DVI format output of TeX typography into a printable or otherwise presentable form. dvips was written by Tomas Rokicki to produce printable PostScript files from DVI input, and is now commonly used for general DVI conversion.The TeX typesetting system...

  • DVI-to-bitmap converters: dvipng
    Dvipng
    dvipng is a cross-platform program for converting the DVI output of the typesetting system into PNG image format. Dvipng was written by Jan-Åke Larsson....

     (generates GIF or PNG), or use dvips
    Dvips
    dvips is a software program that converts the DVI format output of TeX typography into a printable or otherwise presentable form. dvips was written by Tomas Rokicki to produce printable PostScript files from DVI input, and is now commonly used for general DVI conversion.The TeX typesetting system...

     and Ghostscript
    Ghostscript
    Ghostscript is a suite of software based on an interpreter for Adobe Systems' PostScript and Portable Document Format page description languages.- Features :...

  • DVI-to-SVG converters: dvisvg, dvisvgm


The first DVI previewers capable of on-screen previewing and modification of LaTeX documents ran on Amiga
Amiga
The Amiga is a family of personal computers that was sold by Commodore in the 1980s and 1990s. The first model was launched in 1985 as a high-end home computer and became popular for its graphical, audio and multi-tasking abilities...

s.

DVI-to-PDF converters

dvipdf is a tool to translate DVI files (generated by TeX
TeX
TeX is a typesetting system designed and mostly written by Donald Knuth and released in 1978. Within the typesetting system, its name is formatted as ....

) to PDF files. Although it is still included in most LaTeX
LaTeX
LaTeX is a document markup language and document preparation system for the TeX typesetting program. Within the typesetting system, its name is styled as . The term LaTeX refers only to the language in which documents are written, not to the editor used to write those documents. In order to...

 distributions, it is out-dated and users are advised to use instead the newer tool dvipdfm.

(PDF e-prints that cause fonts to render poorly on the screen, but fine in print, are often caused by not providing dvipdf with a good font mapping table such as the one bundled with dvipdfm.)

dvipdfm is a DVI to PDF translator, included in current LaTeX distributions such as teTeX. It produces PDF files of a quality superior to that of its now outdated predecessor dvipdf and also supports most of the newer special functions of the PDF format. It incorporates the *.eps graphics file format without problems. You can use it to convert arquive.dvi with the command dvipdfm arquive.dvi.

dvipdfmx is an extended version of the dvipdfm DVI to PDF translator. The primary goal of the dvipdfmx project is to support multi-byte character encodings and CJK
CJK
CJK is a collective term for Chinese, Japanese, and Korean, which is used in the field of software and communications internationalization.The term CJKV means CJK plus Vietnamese, which constitute the main East Asian languages.- Characteristics :...

character sets for East Asian languages.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK