[tex-live] Non-PDF documentation

Heiko Oberdiek oberdiek at uni-freiburg.de
Mon Feb 1 22:52:30 CET 2010


On Mon, Feb 01, 2010 at 09:34:18PM +0100, Frank Küster wrote:

> Manuel Pégourié-Gonnard <mpg at elzevir.fr> wrote:
> 
> > Hi Philipp,
> >
> > Philipp Stephani a écrit :
> >> are there any plans to convert non-PDF manuals to PDF? I think PS and DVI
> >> manuals are inconvenient for many because end users generally have no DVI or
> >> PostScript viewer installed. For example, on Mac OS X, PDFs can be viewed
> >> natively, whereas DVIs and PSs have to be converted on the fly and look much
> >> worse.
> >
> > I agree with you. Actually there are such plans. At least Robin an I have been
> > converting dvi/ps documentation to pdf (or generating pdf documentation when no
> > compiled doc was available at all) for some time. 
> 
> What a pity.  Viewing DVI in xdvi is so much faster and in particular so
> much more comfortable than PDF in xpdf(-derivatives) or acroread.

There are DVI files that can be viewed in xdvi,
there are DVI files containing \specials for other
drivers, not supported by xdvi (perhaps dvipdfm, dvipsone, ...),
there are DVI files with fonts that are not installed on
the system, there are DVI files with graphics where
the graphics type is not supported or the graphics file is even
missing, ...

> Is there really a majority of TeX users who prefer PDF?  Is the planned
> new 1.5 format faster to load?  Are there any alternative PDF viewers
> that can be handled conveniently with keystrokes, like xdvi?

xdvi is a nightmare in comparison to emTeX's comfortable dvi drivers.

If there would be a common standard for DVI extensions (\special) for
* specifying page size for each page
* color specifications
* graphics inclusion
* rotating
* scaling
* anchor, links
* bookmarks
* embedding of fonts
* embedding of graphics
* metadata
* ...
that would be supported by the major dvi drivers (dvips, dvipdfm, ...),
then the DVI format would have a chance, even nowadays.

Also xdvi isn't well supported by LaTeX:
* Package `color' 2005/11/14 v1.0j contains:
    \DeclareOption{xdvi}{\ExecuteOptions{dvips,monochrome}}
  Thus xdvi doesn't even support color?
  (Rethorical question, I know that xdvi support some
  kind of color specials.)
* xdvi supports the \special{papersize} for *each* page
  (according to manual page), but both Package `geometry'
  and `typearea' are setting this special on the first
  page only.

But if you like, you can convert the PDF files to DVI files
(probably not the DVI that you have in mind, but DVI is DVI, isn't it?)

Yours sincerely
  Heiko <oberdiek at uni-freiburg.de>

PS: pdftodvi.pl

#!/usr/bin/env perl
use strict;
$^W=1;

my $sourcefile = $ARGV[0];
my $targetfile = $ARGV[1];

if (not $sourcefile) {
    die "Syntax: $0 <input.pdf> <output.dvi>\n";
}
if (not -f $sourcefile and -f "$sourcefile.pdf") {
     $sourcefile .= '.pdf';
}
-f $sourcefile or die "!!! Error: Source file `$sourcefile' not found!\n";
if (not $targetfile) {
    $targetfile = $sourcefile;
    $targetfile =~ s/\.pdf$//;
}
else {
    $targetfile =~ s/\.dvi$//;
}
my $targetbase = $targetfile;
$targetfile .= '.dvi';

my $pages = 0;

foreach (`pdfinfo $sourcefile`) {
    if (/Pages:\s+(\d+)/) {
        $pages = $1;
        last;
    }
}
$pages or die "!!! Error: Cannot get page count of `$sourcefile'!\n";
foreach my $page (1..$pages) {
    my @cmd = (
        'pdftops',
        '-f', $page,
        '-l', $page,
        '-eps',
        $sourcefile,
        "$targetbase-$page.eps"
    );
    system @cmd;
}
my $tempbase = "__pdftodvi__$$";
my $texfile = "$tempbase.tex";
my $logfile = "$tempbase.log";
my $dvifile = "$tempbase.dvi";
open(TEX, '>', $texfile) or die "!!! Error: Cannot write `$texfile'!\n";
print TEX "\\def\\File{$targetbase}\n";
print TEX "\\def\\PageMax{$pages}\n";
print TEX <<'END_TEX';
\input graphicx\relax
\def\Page{%
  \setbox0=\hbox{\includegraphics{\File-\the\pageno.eps}}%
  \shipout\vtop{%
    \special{papersize=\the\wd0,\the\ht0}%
    \kern-1in\relax
    \hbox{\kern-1in\unhbox0}%
  }%
  \ifnum\PageMax=\pageno
    \let\Next\relax
  \else
    \advancepageno
  \fi
  \Next
}
\let\Next\Page
\Next
\end
END_TEX
close(TEX);

my @cmd = (
    'tex',
    $texfile
);
system @cmd;
unlink $texfile;
unlink $logfile;
unlink $targetfile;
rename $dvifile, $targetfile;
print "==> $targetfile\n";
1;
__END__


More information about the tex-live mailing list