This is a sample .tex file



\resizebox{\hsize}{!}{\includegraphics[bb = 0 0 1937 1912]{test.jpg}}
\caption{This is a test figure.}


I compile the above .tex file and the compilation is free or warning and errors. However when I open the .dvi the figure is not shown, while the caption is written. Only when I compile the dvi to pdf the figure is visible. So, my question: Is there a way to make the figure visible in both modes (DVI and PDF)?

many thanks in advance.

  • 2
    It is almost always better, and never worse, to use \includegraphics[bb = 0 0 1937 1912, width=\hsize]{test.jpg} rather than \resizebox{\hsize}{!}{\includegraphics[bb = 0 0 1937 1912]{test.jpg}} – David Carlisle Jun 8 '15 at 8:26

There is no standard for the inclusion of images in the DVI file. The DVI file format does not know anything about figures. Thus the image support is done via \special{...}. The syntax of the contents for \special depends on the DVI driver. The file in the question uses driver option dvipdfm, thus the graphics package writes the \special for dvipdfm. Since dvipdfm only converts DVI to PDF and cannot view anything, you have to use a different DVI viewer, which apparently does not support specials for dvipdfm. If you want to have the images included in the DVI viewer, you have to compile again with a different driver option to get specials for the DVI viewer with some hope, that the viewer also supports the used image format.

  • If I use \documentclass{article} without the [dvipdfm] option then the figure is shown in the .dvi output but then when I compile to .pdf the size of the same figure is very small confined at the lower left part of the bounding box. Any ideas? – Vaggelis_Z Jun 8 '15 at 6:57
  • @Vaggelis_Z Without option, dvips is usually used as default and the DVI viewer recognizes the special. But for dvipdfm, you have to recompile with driver option dvipdfm. – Heiko Oberdiek Jun 8 '15 at 7:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.