# Why does the arXiv produce a messed-up DVI when the PDF is fine?

Historically, I've checked the quality of arXiv output by reading the PDF it creates; I learned today that this actually a serious mistake. If you look at the PDF and DVI for my most recent article, you'll see that the PDF looks fine, and the DVI is essentially unusable from a mathematical perspective. The tikz pictures don't come out at all, and there seem to be serious font issues.

I'll note that this file compiles fine as a DVI on my home computer.

What's causing this? Is it a problem a user can fix by include font/style files with his/her upload? is there someone at the arXiv I should be telling to install something? Why is the arXiv less competent than a home installation of MikTeX?

EDIT: So, the take-away seems to be that your DVIs from the arXiv will only look right if you use Computer Modern. Hooray for all math papers looking the same!

-
On my system, the pictures are fine, but the DVI viewer complains about fonts that it cannot find. In general, it is not surprising to me that DVI produced on one machine is not readable on another one. The DVIs are not portable (as well as many other types of files). – Sergei Ivanov Apr 29 '10 at 19:25
Erm... Checking this, the DVI file displays fine on my computer (Windows Vista, MikTeX). But: YAP did have to download and install a font package. This works flawlessly on my computer, but I imagine if I tried to view the file on my aging Linux machine at work, then it wouldn't display. So... it is just the case that you're using an old DVI viewer?? – Matthew Daws Apr 29 '10 at 19:26
A few years ago the arXiv was still producing PDF by a rather circuitous route: DVI->PS->PDF. (I contacted them and they explained why, but I seem to have misplaced their explanatory email.) – José Figueroa-O'Farrill Apr 29 '10 at 22:56
@Andrea: There is an analog of dvips for PDF. It's called dvipdfm. It supports EPS figures, colors etc. I do not see any reason not to use it. – Dmitri Pavlov Apr 30 '10 at 1:38
Best to convert your figure to PDF first and then include them in a format-neutral manner. If, for example, you are using the graphicx package then if you leave off the extension it tries to find the right format. So \includegraphics{hello} will look for hello.eps when doing DVI and hello.pdf when doing PDF. – Loop Space Apr 30 '10 at 6:34

Apparently the source of the problem is that TikZ behaves differently when the TeX file is compiled with pdftex/pdflatex instead of the standard tex/latex. Instead of simply embedding PostScript into the DVI file, as any sane system would do, it apparently tries to draw figures using characters from some special fonts.

In my opinion, TikZ authors should be crucified for this. Mathematical papers are supposed to last a little longer than 10 or 15 years. In 10 or 15 years PDF will be replaced by yet another format, and all TeX files that are tailored specifically for PDF will become unusable. So long for durability. For this reason I urge everybody to ignore Andrew Stacey's advice (no offense meant).

One more reason to use METAPOST instead of TikZ. They seem to have similar functionality, but METAPOST is much more powerful when it comes to solving systems of equations, has more convenient syntax (no annoying backslashes), and is also an order of magnitude more portable (for example, any document with METAPOST pictures looks exactly the same in DVI, PostScript, and PDF formats).

As for the fonts, we should blame arXiv for this. The DVI format is device independent. However, a DVI file must always be accompanied by all fonts that it uses, except for the standard Computer Modern family. The arXiv simply gives you the DVI file without any fonts, which I find ridiculous.

Since the paper under discussion uses some weird PostScript fonts, and the arXiv gives you a DVI file without any fonts, it is natural that the DVI file is unreadable on many machines.

I apologize for somewhat strong language, but I feel very strongly when it comes to the issues of portability and/or durability of mathematical papers. For example, 10 or 15 year old LaTeX files are often no longer compilable on modern TeX systems and require some voodoo magic on my part, because of the changes in the LaTeX and its various packages. For this reason I switched to Plain TeX about 10 years ago. A Plain TeX file created in 1982 will compile without any errors and will produce exactly the same document in 2012 or in 2042.

[If I am allowed to comment on the appearance of the paper, I must say that it looks quite weird with the current fonts. Apparently, PostScript fonts are used to typeset the main text, but all formulas are still typeset in Computer Modern. Since the two fonts are obviously incompatible in style (for example, they have different thickness), the end result is horrible. If I were to read this paper, I would recompile it using the standard Computer Modern fonts. Again, no offense meant.]

-
TikZ's docs explain how to get Postscript embedded into the DVI file, by setting the output driver correctly, and it also explains why this cannot be done automatically. Since there is no standard way of providing fonts with a DVI file, the only portable DVI files are those that depends only on the standard CM family: that may be enough for some people, but it is not enough for others, and therefore the portability is of rather limited use, just as as ASCII is essentially problem-freen unless you need to write in one of the languages 95% of the world writes in! – Mariano Suárez-Alvarez Apr 29 '10 at 22:22
Can you please point me to the relevant page in TikZ' documentation, especially “why this cannot be done automatically”? Thanks. I must admit that I have no idea how to interpret your statement “there is no standard way of providing fonts with a DVI file”. Just put the fonts in the same directory as the DVI file. For your information, if the DVI file uses any external pictures, the arXiv will give you a tar.gz archive containing the DVI file itself and all files with pictures. This archive should also include all non-standard fonts. – Dmitri Pavlov Apr 29 '10 at 22:46
And we should all just use pure HTML with no CSS, javascript, MathML ... Indeed, we should be using lynx and not firefox. TikZ is fantastic. You can do great things with it, it's easy to use, and it just works! And the TikZ guys write fantastic documentation. I've never tried metapost and probably never will. I've seen some great stuff done by writing postscript directly, but while I could say "Wow, that's fantastic", I could also say "But I'll stick with the easy stuff.". – Loop Space Apr 30 '10 at 6:30
And to comment on the future formats: any decent future format will have to be constructed so that anything that works with PDF will work with the future one - otherwise no-one will use it! So just as any tex file that works with DVI will work with PDF, so also any that work with PDF will work in FFF (Fantastic Future Format). Just look at the evolution of HTML to see how this works in practice. – Loop Space Apr 30 '10 at 6:32
@Andrew: As I pointed out in my other comment, few TeX documents use PDF-specific features, so when FFF comes out it will probably be incompatible with PDF-specific TeX and the latter will suffer the fate of ChiWriter and troff, which were replaced by completely incompatible system TeX. I am also familiar with evolution of HTML and in my opinion it disproves your statements. Just look how they discarded all presentational elements from HTML and replaced them by CSS. – Dmitri Pavlov May 1 '10 at 2:00

Sadly, DVI is misnamed. It isn't truly "DeVice Independent" as DVIs do not embed fonts. So to see a DVI correctly, you have to have the fonts available. This can be hard to debug since if you happen to have the correct fonts on your computer then you won't see a problem. PDFs, on the other hand, embed their fonts so avoid this problem.

Moreover, as mentioned in the comments, tikz does it's best when exporting to DVI but cannot do much. If you have complicated drawings, you need to bypass the DVI stage and go straight to PDF.

You could add a remark to the abstract on the arXiv saying "Don't use the DVI version, use the PDF". If you wanted to be really cunning, you could add some LaTeX code at the head of your document that tests for PDF mode and produces a warning in DVI:

\RequirePackage{ifpdf}
...
\begin{document}
\ifpdf
\else
\begin{center}
\textbf{Warning:} The DVI version of this paper may be corrupted.  If possible, use the PDF version.
\end{center}
\fi


should do the trick.

-
This is a very bad idea. In 10 years PDF will be replaced by yet another format, which will render your TeX file unusable. – Dmitri Pavlov Apr 29 '10 at 20:56
I disagree with Dmitri. pdf is much more widespread than dvi, so in 10 years it is much likelier that you can find a working pdf previewer than a working dvi previewer. A simple method of forcing arxiv to use pdflatex instead of latex (so that it doesn't even generate dvi; this is necessary if you include pdf figures) is to add near the start of the file the line \pdfoutput=1 – David Eppstein Apr 29 '10 at 22:04
@David: You completely misunderstood my comment. I did not even mention DVI in my comment. The point is that a TeX file should be compilable to any format, not just to PDF, which might very well become obsolete in 10 or 15 years, thus rendering all PDF-specific TeX files unusable. – Dmitri Pavlov Apr 29 '10 at 22:13
So change the message to: "The author checked that this document looked right as a PDF. It looked incorrect in some other formats, including DVI. This format, not being PDF, thus cannot be considered reliable.". That should be robust enough! As for formats compatible with Tikz, I'm of the opinion that TikZ is SO fantastic that if a format isn't compatible with TikZ then I won't use it. Fortunately, PDF is compatible. Any future formats will be backwards-compatible with PDF otherwise they won't get off the ground so I think it's okay to let the future worry about itself on that one. – Loop Space Apr 30 '10 at 6:22
@Andrew: Mariano in his comment points out that in TikZ it is possible “to get Postscript embedded into the DVI file”. Why not do this so that you TeX file will work not just with the PDF format, but with all formats? – Dmitri Pavlov May 1 '10 at 1:30

TikZ's DVI driver only supports a very restricted subset of capabilities. As its amazing docs say, "Naturally, very little is possible with this driver."

(I cannot tell from a quick glance what fonts issues there are: maybe you can be more explicit?)

-
Then why does it compile just fine on my home machine? Maybe the question I should be asking is "Why can my home computer compile TikZ in DVI's when TikZ says it can't?" – Ben Webster Apr 29 '10 at 19:12
For font issues: obviously this is more machine dependent, but what I see is o's in italics not closing up, and a lot of math coming out as gobbledy-gook (for example, look at the definition of the quantized universal enveloping algebra on page 5). – Ben Webster Apr 29 '10 at 19:19
I have just tried compiling your .tex file with a TeXLive installation updated as of 5 minutes and a PGF/TikZ package (from texample.net/tikz/builds) as of ten days (the latests cvs release, I guess) and the formulas in your diagrams show all missplaced. I doubt arXiv has its tex installation up to the latest release of everything, so I honestly have no idea what MikTeX is doing for you! Can you email me a correct dvi file for me to look? firstname.lastnamewithoutthehyphen@gmail.com – Mariano Suárez-Alvarez Apr 29 '10 at 19:20
The dvi files do not include the fonts but only references to them, so their correct display depends on your setup being the same as the originators' (and hopefully both are correct...) The definition for $U_q$ looks the same in the PDF and in the DVI file here. Look at complaints from the DVI viewer you are using (in Unix I'd tell you to run it from a terminal and see its output there... I have never used MikTeX so I don't know the equivalent there.) for messages about fonts not being found. – Mariano Suárez-Alvarez Apr 29 '10 at 19:25
Related to my comment above: YAP on my windows machine switches to "postscript" mode (or whatever it's called). It's not using the native DVI renderer, which maybe suggests some DVI trickery is going on. – Matthew Daws Apr 29 '10 at 19:27

9.2.1 Selecting the Backend Driver

of the pgf/tikz manual. arXiv dvi is generated with the dvips backend driver, and it must be post-processed with dvips to render in a useful way. In addition all the fonts referenced in the dvi need to be available to dvips when post-processing the dvi.

There is also section

9.2.5 Producing Perfectly Portable DVI Output

which seems like a choice of last resort.

Cheers T.

-

It appears that I don't even have a DVI previewer anymore. When I downloaded your DVI file, I renamed it to have a .dvi extension. When I ask OS X Finder to open it, it launches TeXShop, which apparently runs dvi2pdf (or something similar), and then shows me a PDF which looks just fine.

-
TeX on Macs is different. It does not use DVI indeed and it is not compatible with other systems (even at TeX level!). – Sergei Ivanov Apr 29 '10 at 19:35
@Sergei: the truth of that statement depends on where you get TeX from in the Mac. – Mariano Suárez-Alvarez Apr 29 '10 at 19:41
@Mariano: Are there DVI viewers for Mac other than xdvi? – Sergei Ivanov Apr 29 '10 at 20:11
Skim is a DVI viewer, among other things. – Graham Leuschke Apr 29 '10 at 20:55
@Sergei, I have no idea. But I am sure you can install a texmf tree in many different incompatible ways! For all I know, TeXShop and TeXLive have not-equivalent set-ups. – Mariano Suárez-Alvarez Apr 29 '10 at 21:57