Bug#635382: texlive-latex-extra: ucshyper check for PDF mode buggy and not necessary anyway

2011-07-26 Thread Lionel Elie Mamane
On Mon, Jul 25, 2011 at 06:35:15PM +0200, Lionel Elie Mamane wrote:
 Package: texlive-latex-extra
 Tags: patch

 3) ucshyper does not actually need the output mode to be PDF, nor the
TeX implementation to be pdfTeX. I just _removed_ the above test,
as well as the following line:

 \RequirePackage[pdftex,unicode]{hyperref}

 So possibly this test should be changed to something like:

 \ifdefined\PrerenderUnicode\else%
 \PackageWarning{ucshyper}{ucshyper needs to be run with
 inputenc utf8x.\MessageBreak Disabling functionality}%
   \expandafter\endinput\fi

 _and_ still remove the

 \RequirePackage[pdftex,unicode]{hyperref}

 line so that users can choose their own hyperref driver freely. Maybe
 add instead:

 \ifdefined\hypersetup%
  \hypersetup{unicode=true}%
 \else%
   \PackageWarning{ucshyper}{ucshyper needs to be loaded after
   hyperref.\MessageBreak Disabling functionality}%
 \expandafter\endinput%
 \fi%

I downloaded the texlive-extra (Debian) source package; it contains
ucshyper.sty, which says it is generated from ucs.dtx, but does not
contain ucs.dtx. So

1) I cannot prepare a real proper patch.

2) This looks like an RC bug to me, not shipping the preferred form
   for modification in the source package.

Additionally, browsing the upstream SVN, I found neither ucs.dtx, nor
ucshyper.sty, but probably I just didn't look in the right place.

-- 
Lionel



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#635382: texlive-latex-extra: ucshyper check for PDF mode buggy and not necessary anyway

2011-07-25 Thread Lionel Elie Mamane
Package: texlive-latex-extra
Version: 2009-10
Severity: normal
Tags: patch

Near beginning of ucshyper.sty:

\ifx\pdfoutput\undefined
  \PackageWarning{ucshyper}{ucshyper needs to be run with
pdflatex.\MessageBreak Disabling functionality}%
  \expandafter\endinput\fi

This is buggy in several ways.

1) If another package loaded before ucshyper has used \@ifundefined
   to test the value of pdfoutput, then it is redefined to \relax
   instead of \undefined, and the above test will take the wrong
   branch.

2) Even if 1) is fixed, this tests whether the TeX implementation
   running is pdfTeX, while what it probably was intended to test for
   is whether the output produced is PDF... In other words, this test
   will not issue the warning if pdftex is running in DVI output mode;
   this is what happens in Debian when one runs /usr/bin/tex or
   /usr/bin/latex.

E.g. this document:

\documentclass{article}
\usepackage{ucshyper}
\begin{document}
foo
\end{document}

leads to this (La)TeX output (when run with plain latex):

LaTeX2e 2009/09/24
(...)
Package hyperref Warning: Wrong driver `hpdftex.def';
(hyperref)pdfTeX is not running in PDF mode.
(hyperref)Using default driver.

*hyperref using default driver hdvips*

(...)

! Undefined control sequence.
\pdfstringdef ...@pdfstringtrue \PrerenderUnicode 
  {#2}\endgroup \fi \ucshype...
l.5 \end{document}
  
? 


Luckily (as you probably already know), the ifpdf package takes care
of these details for you, so the above code should be replaced by
something like:

\RequirePackage{ifpdf}
\ifpdf\else%
\PackageWarning{ucshyper}{ucshyper needs to be run with
pdflatex.\MessageBreak Disabling functionality}%
  \expandafter\endinput\fi


See /usr/share/doc/texlive-doc/generic/FAQ-en/html/FAQ-ifpdf.html and
/usr/share/doc/texlive-doc/latex/oberdiek/ifpdf.pdf for more details.


However, there is a third issue even with 1) and 2) solved.


3) ucshyper does not actually need the output mode to be PDF, nor the
   TeX implementation to be pdfTeX. I just _removed_ the above test,
   as well as the following line:

\RequirePackage[pdftex,unicode]{hyperref}

and then I produce DVI with hyperref's dvipdfm option (driver
hdvipdfm), run it through dvipdfm and ucshyper still does its job like
a charm. For example this document:

\documentclass{article}
\usepackage[utf8x]{inputenc}
\usepackage[dvipdfm,bookmarks=true,unicode=true]{hyperref}
\usepackage{ucshyper}
\begin{document}
\section{\texorpdfstring{\ensuremath\lambda{}}{λ}}
\end{document}

latex it, run dvipdfm over the dvi, and the \lambda looks fine in
evince's side panel (Index).


So possibly this test should be changed to something like:

\ifdefined\PrerenderUnicode\else%
\PackageWarning{ucshyper}{ucshyper needs to be run with
inputenc utf8x.\MessageBreak Disabling functionality}%
  \expandafter\endinput\fi

_and_ still remove the

\RequirePackage[pdftex,unicode]{hyperref}

line so that users can choose their own hyperref driver freely. Maybe
add instead:

\ifdefined\hypersetup%
 \hypersetup{unicode=true}%
\else%
  \PackageWarning{ucshyper}{ucshyper needs to be loaded after
  hyperref.\MessageBreak Disabling functionality}%
\expandafter\endinput%
\fi%

I'd be tempted to promote the warnings to errors, actually.

##
minimal input file

See above

##
other files

##
 List of ls-R files

-rw-r--r-- 1 root root 1753 Jun 10 19:05 /var/lib/texmf/ls-R
-rw-rw-r-- 1 root staff 80 Jun 28  2010 /usr/local/share/texmf/ls-R
lrwxrwxrwx 1 root root 29 Jun 10 19:00 /usr/share/texmf/ls-R - 
/var/lib/texmf/ls-R-TEXMFMAIN
lrwxrwxrwx 1 root root 27 Oct 28  2010 /usr/share/texmf-texlive/ls-R - 
/var/lib/texmf/ls-R-TEXLIVE
lrwxrwxrwx 1 root root 27 Oct 28  2010 /usr/share/texmf-texlive/ls-R - 
/var/lib/texmf/ls-R-TEXLIVE
##
 Config files
lrwxrwxrwx 1 root root 20 Jun 10 19:00 /usr/share/texmf/web2c/texmf.cnf - 
/etc/texmf/texmf.cnf
-rw-r--r-- 1 root root 10081 Jun 10 19:05 /var/lib/texmf/web2c/fmtutil.cnf
-rw-r--r-- 1 root root 24192 Jun 10 19:05 /var/lib/texmf/web2c/updmap.cfg
-rw-r--r-- 1 root root 15119 Jun 10 19:05 
/var/lib/texmf/tex/generic/config/language.dat
##
 Files in /etc/texmf/web2c/
total 4
-rw-r--r-- 1 root root 283 Nov 10  2008 mktex.cnf
##
 md5sums of texmf.d
3875bf0f4a53a29b7f247399dc9833e2  /etc/texmf/texmf.d/05TeXMF.cnf
6e82a3d4c00ae7e4f86aa8dcf9438cf3  /etc/texmf/texmf.d/15Plain.cnf
c60a084820a0b73e3bfbf2e90bda437c  /etc/texmf/texmf.d/45TeXinputs.cnf
ea33127256c6a9f37145ae5b16fdb80c  /etc/texmf/texmf.d/55Fonts.cnf
afccf1d3f87057411166a77c58e00bd1  /etc/texmf/texmf.d/65BibTeX.cnf
9da7c1c7b1eaf06f941af91f48a23068  /etc/texmf/texmf.d/75DviPS.cnf
7ae52efac46feb97010986e57877d12e