I have a legacy book written in LaTeX for which I have all sources, eps figures, and the final dvi file.

I have to produce a pdf for the book that matches the original book published in paper.

Since the book was last compiled ten years ago, I've discarded recompiling it, to avoid changing the layout due to differences in packages etc.

The obvious conversion from dvi to pdf with dvipdf did not work because the dvi has hard-coded paths for the eps figures. These paths are absolute paths like /local/books/i3d/figures/eps/intro/areas.eps. If the paths were relative paths, it'd be simple to make a suitable tree with symbolic links.

I ended up editing the dvi and replacing /local/books/i3d/ by .local-books-i3d/, carefully keeping the lengths the same to avoid messing up the offsets in the dvi file.

This hack worked perfectly. But I wish dvips had an option to change absolute paths to relative ones, like tar does by default.

Is there a simpler solution?

  • Isn't a changeroot way easier? (apparently, you use Unix/Linux or MacOS)
    – user31729
    Commented Apr 20, 2016 at 13:22
  • @ChristianHupfer. changeroot would affect where dvips finds its own stuff, wouldn't it?
    – lhf
    Commented Apr 20, 2016 at 13:25
  • You could pretend a different root, at least. The problem is of course finding the TeX distribution or copying it over to the 'fake' root filesystem tree
    – user31729
    Commented Apr 20, 2016 at 13:26
  • @ChristianHupfer, ah, copying the TeX distribution to a fake root would work but it seems a lot of work!
    – lhf
    Commented Apr 20, 2016 at 13:28
  • 1
    @ChristianHupfer Possible, but far more difficult than replacing strings in a binary file. Commented Apr 20, 2016 at 15:54

1 Answer 1


A possibility to edit the DVI file easily is to use dviasm. It creates a textual representation of the file and allows to convert this "disassembled" code back to DVI. This way you can change the paths in the text file and create a new DVI file from it afterwards.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .