# How to view .xdv files?

How can I view eXtended DVi files in a computer? These are the output of the command `xelatex -no-pdf`. I am particularly interested for the solution on a Mac, but please comment on other platforms as well. Traditional programs like xdvi or Okular seem not to be able to deal with the `.xdv` file.

-
Welcome to TeX.sx! There is no viewer for files in `.xdv` format. They are only intermediate files that `xdvipdfmx` is fed with to produce the final PDF file. –  egreg Dec 1 '12 at 15:42
As @egreg says, there is no viewer: the `--no-pdf` option is there for debugging purposes only. –  Joseph Wright Dec 1 '12 at 15:43
This is a real pity. Viewing DVI files is very convenient in pure LaTeX. (Are there any plans of supporting xdv files in the future by any program?) Anyway, thank you, both of you. –  MightyMouse Dec 1 '12 at 15:45
@MightyMouse I'd say viewing `.dvi` files is a pain, as they can't deal with the specials and so don't correctly represent graphics or other 'manipulated' content. As far as I know, no-one is interested in creating a viewer for `.xdv` files as PDF is perfectly usable, so if you want one I guess you'll have to 'roll your own'. –  Joseph Wright Dec 1 '12 at 15:48
My point is that traditional .dvi files are generated much easier and hence one can view the basic content of a document, as it is written, much faster. Otherwise, I totally agree with you that .ps and .pdf files is the way to go so that one can see all the manipulated content correctly. And while this problem can be bypassed easily in English-only documents by using latex throughout apart from the last step where one can make 2-3 changes and use xelatex, this is not the case with documents that are using other languages as well. In any case, thank you very much for your input. Best regards. –  MightyMouse Dec 1 '12 at 16:02

When Jonathan Kew wrote XeTeX, he found it easier using an extension of the DVI output format rather than direct PDF output. So he defined the XDV format and wrote a driver `xdv2pdf` for transforming the XDV file into a PDF one.

However the `xdv2pdf` program used extensively the Apple font libraries, so it wasn't easy to adapt it to other platforms. Later on, the `xdvipdfmx` driver, based on `dvipdfmx` (which in turn is based on M. Wicks's `dvipdfm`), was written. Now XeTeX uses the `fontconfig` library on all systems (but on Mac OS X it can still use Apple libraries). As Khaled Hosny remarks in a comment, `xdvipdfmx` doesn't rely on `fontconfig`, however.

Each run of `xetex` produces a file in XDV format which is transparently fed to `xdvipdfmx` (with no user intervention) and then removed.

There is no previewer for the XDV format. While it may be possible to extend `xdvi` for this purpose, I don't think that this will ever be attempted: one should link it to the `fontconfig` libraries and do many other changes for accommodating all "specials" understood by `xdvipdfmx`. PDF previewers are fast and reliable, so there's no point in trying such a path.

In olden times, previewing a DVI instead of a PostScript/PDF file was maybe faster (with some limitations related mainly to rotation); nowadays the difference in time is probably negligible.

-
Note that FontConfig was only used for finding system fonts, since 0.9998 `xdvipdfmx` does not link with `libfontconfig`; XeTeX always embeds the full font file path (this was to fix the famous bug when one had two versions of the same font resulting in XeTeX showing garbage glyphs). –  Khaled Hosny Dec 1 '12 at 18:10
For “native” fonts, XeTeX essentially passes a stream of glyph ids, there positions and a font, so in theory it is possible to write a XDV viewer, but I don’t see the point; there are plenty of PDF viewers and some of them are blazingly fast (MuPDF for example), no one is forced to use the bloated Adobe reader all the time. –  Khaled Hosny Dec 1 '12 at 18:14
@KhaledHosny Your second comment confirms what I said. I'll modify my answer in view of hour first comment, thanks. –  egreg Dec 1 '12 at 18:17
@egreg A plain `latex` command is much faster than the amount of time required for `xelatex`, even with today's computers. The reasoning is also implicit in the post, since the `xdvi` is fed to `dvipdfmx`, and hence there is an amount of time spent on the latter. I agree that it is not a big problem in general, but it is still a limitation when using XeTeX. (For big documents such as books or theses, where one mostly writes conventional text or equations it is a great source of delay.) Thank you very much for a very detailed post and explanations. I appreciate it. Best regards. –  MightyMouse Dec 2 '12 at 5:39