World Library  
Flag as Inappropriate
Email this Article

Device independent file format

Article Id: WHEBN0000196831
Reproduction Date:

Title: Device independent file format  
Author: World Heritage Encyclopedia
Language: English
Subject: New Typesetting System, TeX, Texinfo, PSTricks, Yet Another Previewer
Collection: Computer File Formats, Open Formats, Page Description Languages, Tex
Publisher: World Heritage Encyclopedia

Device independent file format

Device-independent (DVI)
Evince previewing a DVI file. Note that referenced images are not displayed, because they are not part of the DVI file. Images will be added in by a print driver, such as dvips.
Filename extension .dvi
Internet media type application/x-dvi (unofficial)
Developed by David R. Fuchs
Type of format document

The device independent file format (DVI) is the output file format of the TeX typesetting program, designed by David R. Fuchs and implemented by Donald E. Knuth in 1982.[1] Unlike the TeX markup files used to generate them, DVI files are not intended to be human-readable; they consist of binary data describing the visual layout of a document in a manner not reliant on any specific image format, display hardware or printer. 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 languages (e.g. PostScript, PDF) and for printing.

DVI is not a document encryption 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).

DVI differs from PostScript 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 programming language, though it does use a limited sort of machine language.


  • Specification 1
  • Graphics as specials 2
  • DVI versions 3
  • DVI related software 4
    • DVI-to-PDF converters 4.1
  • References and notes 5
  • External links 6


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.[1] Each command begins with an eight-bit opcode, 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,v,w,x,y,z). 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_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 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 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.

Graphics as specials

The DVI format does not have support for graphics 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 specials, but other programs like tpic have their own.[2]:6,17

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 (included in MiKTeX), xdvi, windvi, Evince, KDVI, Okular, dviout, dviwin, DView (included in the commercial BaKoMa TeX distribution), javaDVI, MDVI, and DVIWindo (of the now defunct commercial Y&Y TeX, which has been open-sourced).[3]
  • DVI to human-readable format: dvitype (disassembler of sorts)
  • DVI-to-PDF converters: dvipdf, dvipdfm, dvipdfmx
  • DVI-to-PS converters: dvips is the de facto standard. CTAN includes some older ones like dvitops (and DVIPSONE[4]) with a note they've lost their market share a long time ago.[5]
  • DVI-to-bitmap converters: dvipng (generates GIF or PNG), or use dvips and Ghostscript
  • DVI-to-SVG converters: dvisvg,[2]:13 dvisvgm,[2]:13 dvi2svg;[2]:13[6] As of 2014 the only one included in CTAN and actively maintained is dvisvgm.[7]

The first DVI previewers capable of on-screen previewing and modification of LaTeX documents ran on Amigas.[8][9]

DVI-to-PDF converters

dvipdf is a tool to translate DVI files (generated by TeX) to PDF files. In current Linux distributions like Ubuntu, it is a thin wrapper around dvips and ghostscript, and copyrighted to Artifex Software (the makers of ghostscript).[10] A possibly different program with the same name—described as a modified version of dvips—was announced in the late 1990s by Sergey Lesenko,[11][12][13] however it was apparently never released.[14][15]

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.[16] dvipdfm supports most of the newer special functions of the PDF format, including bookmarks, annotations, thumbnails, and dvips specials—a feature making possible the inclusion of Encapsulated PostScript (.eps) files like METAPOST output—as well inclusion of JPEG and PNG images; other features of dvipdfm include partial font embedding (reducing file size) and balancing the internal PDF document trees to speed up rendering of large documents.[2]:798 Many of these features (except for the direct support for .eps files[17]) are also present in pdfTeX, which typesets TeX directly to PDF. The 2004, 4th edition of the Guide to LaTeX compares them in the following way:[18]

The dvipdfm program is in the original spirit of TEX, that uses DVI as a universal intermediate format for all outputs. Purists might tend to respect this ideal. After all, no one ever considered rewriting TEX to produce PostScript output directly. That said, one must consider that TEX was invented in the days when no one printer specification dominated the field. Today, PDF is much more than a printer format; it is the means of representing documents electronically. That alone would not justify preferring pdfTEX over a DVI-to-PDF converter, nor would the fact that it saves a processing step; the deciding argument is that pdfTEX has established itself as reliable, robust, and flexible. In the end, it is likely a question of which program one is more comfortable with, and which one has given the better results for the particular user.

dvipdfmx is an extended version of the dvipdfm DVI-to-PDF translator, included current TeX distributions like TeX Live 2014[19] and MiKTeX 2.9.[20] The primary goal of the dvipdfmx project is to support multi-byte character encodings and CJK character sets for East Asian languages.[21] dvipdfmx is also included (in a somewhat modified form) in XeTeX.[2]:798

The 2nd, 2008 edition of the LaTeX Graphics Companion makes the following workflow suggestion:[2]:803

The route that you should follow depends mostly on the graphics material that you want to include. If most of it is in EPS format, the easiest way is to use latex, followed by dvips and finally ps2pdf. If all of your graphics files are already in PDF format, with some JPEG and PNG images, the more direct route is to run pdflatex. You can also combine both approaches by running latex and the dvipdfmx program. If you make a lot of use of PSTricks, you should look at [...] the pst-pdf package.

References and notes

  1. ^ a b  
  2. ^ a b c d e f g Michel Goossens, Frank Mittelbach, Sebastian Rahtz, Denis Roegel, Herbert Voß (2008). The LaTeX Graphics Companion (2nd ed.). Addison-Wesley.  
  3. ^
  4. ^
  5. ^
  6. ^
  7. ^
  8. ^ In 1986 Tomas Rokicki printed his first page with dvisw, an early DVI printer driver for the Amiga, on a QMS SmartWriter using AmigaTeX by Radical Eye Software. A link to a relic info about milestones of LaTeX history is available at this external site.
  9. ^ Rokicki, Tomas (April 1988). "The Commodore Amiga: A Magic TeX Machine" (PDF).  
  10. ^
  11. ^
  12. ^
  13. ^
  14. ^ Helmut Kopka; Patrick W. Daly (February 2008) [2004]. Guide to LaTeX (4th; 9th printing ed.). Pearson Education. § 13.2.2 the dvipdfm driver.  
  15. ^
  16. ^ Mark A. Wicks, Dvipdfm User’s Manual, Version 0.12.4 September 19, 1999, page 2
  17. ^
  18. ^ Helmut Kopka; Patrick W. Daly (February 2008) [2004]. Guide to LaTeX (4th; 9th printing ed.). Pearson Education. § 13.2.3 The pdfTEX program.  
  19. ^
  20. ^
  21. ^ The Dvipdfmx Project
  • Fuchs, David (October 1982). "The format of TeX's DVI files" (PDF).  

External links

  • (Unofficial) description of the DVI file format
  • TeX DVI file Information utility
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from World Library are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.