[Build-common-hackers] Bug#338879: #338879: cdbs: FTBFS: DVI file can't be opened

Frank Küster frank at debian.org
Thu Nov 17 13:18:32 UTC 2005


Hi all,

Isaac Clerencia <isaac at debian.org> wrote:

> Hi, dear teTeX maintainers :)
>
> cdbs fails to build from source because "latex" is generating a PDF file 
> instead of a .dvi .

This is a bug in db2latex-xsl.

> I've read in several threads and bugs (like #321942) that this happens to 
> buggy .tex documents.
>
> This .tex document has been generated from a .xml file using this command:
>    xsltproc --xinclude -o cdbs-doc.tex cdbs-doc-latex.xsl cdbs-doc.xml
>
> Basically cdbs-doc-latex.xsl includes the following stylesheet:
> <xsl:import href="http://db2latex.sourceforge.net/xsl/docbook.xsl"/>

Sorry, I don't speak xml, and I can't find "pdf" in there.  But I had a
look at the sources of db2latex-xsl, and it seems the main problem is
xsl/preamble.mod.xsl. However, there are many more occurences of
"pdfoutput" in the doc/reference directory, in contrib and in a lot of
test files in xsl/sample.  Without looking at any of these, I'm sure
they should be fixed.  And this is *not* a Debian-specific problem; it
was a bug all the time, and was only tolerated until recently.
teTeX-3.0 *and* texlive-2005 are more strict now, and it will happen on
every up-to-date unix-like system.

> You can look at the .tex file at: http://people.debian.org/~isaac/cdbs-doc.tex

Since I don't dare to create a patch against preamble.mod.xsl, attached
is one against cdbs-doc.tex instead.  This hunk needs some further
discussion:


-% Load hyperref package with pdf if needed 
+% Load hyperref package
 % --------------------------------------------
-\ifpdf
-\usepackage[pdftex,bookmarksnumbered,colorlinks,backref,bookmarks,breaklinks,linktocpage,plainpages=false,pdfstartview=FitH]{hyperref}
-\else
 \usepackage[bookmarksnumbered,colorlinks,backref,bookmarks,breaklinks,linktocpage,plainpages=false,]{hyperref}
-\fi

Hyperref detects by itself whether pdf or dvi output is requested,
therefore you do not need to check here.  However, this is the only
place in the document where PDF vs. DVI makes a difference:  if you
create a clickable link, and the text is so long that it needs to be
wrapped over the end of the line, you need to be careful.

With PDF output, you don't need the breaklinks option - it will do it
automatically.  With DVI output, you will get links that protrude into
the margin without the option, and nice line wrapping of links with it.
However, if you use the route latex/dvips/ps2pdf to create pdf files,
the links won't work.  This is basically a limitation of PS, although
there is a package that somehow implements a workaround, I forgot the
name.

So you need to decide - do you want to create DVI only for DVI viewers,
and to get PostScript files for printing? Then just use

\usepackage[bookmarksnumbered,colorlinks,backref,
  bookmarks,breaklinks,linktocpage,plainpages=false,
]{hyperref}

But if you need to create PDF files via latex/dvips/ps2pdf (instead of
pdflatex), you might be better off with

\usepackage[bookmarksnumbered,colorlinks,backref,
  bookmarks,linktocpage,plainpages=false,
]{hyperref}

but have to somehow make sure the links don't protrude too much into the
margin. 

In summary, at least in the cdbs-doc case, you do not need any checks
for PDF output *at*all*.  Everything is detected automatically.  But
when you need it (e.g. for some other packages loaded in other
documents), do the checks right and use \usepackage{idfpdf}, and not
wrong by checking the existence of \pdfoutput (nowadays, it is always
true in LaTeX, just set to 0 for DVI output and 1 for PDF).

Regards, Frank
-- 
Frank Küster
Inst. f. Biochemie der Univ. Zürich
Debian Developer

-------------- next part --------------
--- cdbs-doc.tex.orig	2005-11-17 13:54:47.754327096 +0100
+++ cdbs-doc.tex	2005-11-17 14:04:42.743874936 +0100
@@ -1,33 +1,26 @@
 % ------------------------------------------------------------	
 % Autogenerated LaTeX file for books	
 % ------------------------------------------------------------	
-\ifx\pdfoutput\undefined
 \documentclass[,a4paper,10pt,twoside,openright,]{report}
-\else
-\documentclass[pdftex,,a4paper,10pt,twoside,openright,]{report}
-\fi
+% passing the pdftex option is not needed in any package in teTeX that
+% I know of, thus a global option can only cause trouble.
 \label{id2415261}\usepackage{ifthen}
 % --------------------------------------------
 % Check for PDFLaTeX/LaTeX 
 % --------------------------------------------
-\newif\ifpdf
-\ifx\pdfoutput\undefined
-\pdffalse % we are not running PDFLaTeX
-\else
-\pdfoutput=1 % we are running PDFLaTeX
-\pdftrue
-\fi
+% currently not needed
+% \usepackage{ifpdf}              
 % --------------------------------------------
 % Load graphicx package with pdf if needed 
 % --------------------------------------------
-\ifpdf
-\usepackage[pdftex]{graphicx}
-\pdfcompresslevel=9
-\else
 \usepackage{graphicx}
-\fi
+% graphicx autodetects the driver needed, no option
+% \ifpdf\pdfcompresslevel=9\fi
+% compresslevel 9 is the default, no need to change this
 \usepackage{anysize}
 \marginsize{3cm}{2cm}{1.25cm}{1.25cm}
+% probably works without problems, but geometry.sty is usually recommended
+
 
 \makeatletter
 % redefine the listoffigures and listoftables so that the name of the chapter
@@ -127,13 +120,9 @@
 % ---------------
 \usepackage{palatino}
 % --------------------------------------------
-% Load hyperref package with pdf if needed 
+% Load hyperref package
 % --------------------------------------------
-\ifpdf
-\usepackage[pdftex,bookmarksnumbered,colorlinks,backref,bookmarks,breaklinks,linktocpage,plainpages=false,pdfstartview=FitH]{hyperref}
-\else
 \usepackage[bookmarksnumbered,colorlinks,backref,bookmarks,breaklinks,linktocpage,plainpages=false,]{hyperref}
-\fi
 % --------------------------------------------
 % ----------------------------------------------
 % Define a new LaTeX environment (adminipage)
@@ -183,11 +172,7 @@
  \vspace{.5em}
  \par
 }
-\ifpdf
-\DeclareGraphicsExtensions{.pdf,.png,.jpg}
-\else
-\DeclareGraphicsExtensions{.eps}
-\fi
+% graphics extenstions usable with dvi/pdf are defined automatically
 % --------------------------------------------
 % $latex.caption.swapskip enabled for $formal.title.placement support
 \newlength{\docbooktolatextempskip}


More information about the Build-common-hackers mailing list