5

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?

lhf
  • 2,212
  • Isn't a changeroot way easier? (apparently, you use Unix/Linux or MacOS) –  Apr 20 '16 at 13:22
  • @ChristianHupfer. changeroot would affect where dvips finds its own stuff, wouldn't it? – lhf Apr 20 '16 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 –  Apr 20 '16 at 13:26
  • @ChristianHupfer, ah, copying the TeX distribution to a fake root would work but it seems a lot of work! – lhf Apr 20 '16 at 13:28
  • Perhaps it's possible to mount the TeX tree to your change-root? Unsure, this is a rather a StackOverFlow/Unix question then –  Apr 20 '16 at 13:30
  • 1
    @ChristianHupfer Possible, but far more difficult than replacing strings in a binary file. – Gilles 'SO- stop being evil' Apr 20 '16 at 15:54
  • I'm glad I had the dvi file. More food for thought wrt http://tex.stackexchange.com/questions/130518/is-the-dvi-format-de-facto-dead... – lhf Apr 20 '16 at 18:52

1 Answers1

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.

Martin
  • 2,628