[texhax] document broken under windows

Heiko Oberdiek heiko.oberdiek at googlemail.com
Sat Oct 9 01:43:45 CEST 2010


On Fri, Oct 08, 2010 at 11:55:34PM +0200, Heiko Oberdiek wrote:

> When I compile the file using \pdfobjcompresslevel=0, then xpdf doesn't show
> an error, however using \pdfobjcompresslevel=2 I got errors using xpdf:
>   Error (35708): Dictionary key must be a name object
>   Error (39036): Illegal character ')'
>   Error (39039): Dictionary key must be a name object
> Therefore I suspect a bug in luatex 0.63.0.
> Workaround:
> Disabling object compression of PDF-1.5:
> 
> \ifcsname pdfobjcompresslevel\endcsname
>   \pdfobjcompresslevel=0
> \fi

The error is caused by an unmatched parenthesis in:

 \tonode[\experimental](latex25)(0,\layer)<Will Robertson ... :) )>{\LaTeX2.5}
                                                               ^
I would consider it a bug in cooltooltips that does not take precautions
that arbitrary user contents might break PDF syntax.
You have already hyperref loaded, thus I would use \pdfstringdef
for conversion the description string to a PDF string:

\makeatletter
\renewcommand*{\ctip at make@Text}[3][0 1 0]{%
  \pdfstringdef\ctip at Subj{#2}%
  \pdfstringdef\ctip at Contents{#3}%
  \pdfannot width 0pt height 0pt depth 0pt {
    /Subtype /Text
    /C [#1]
    /Subj (\ctip at Subj)
    /Contents (\ctip at Contents)
    /NM (ctip Text \ctip at tip@number)
    /AP <<
      /N \ctip at empty@icon\space 0 R
      /D \ctip at empty@icon\space 0 R
      /R \ctip at empty@icon\space 0 R
    >>
    /Open false
  }%
}
\makeatother


While investigating I found other errors:

* \NewDocumentCommand\tonode{
      O{\normalimportant}
      D(){no label given}
      D(){no position given}
      D<>{no description given}
      m}{
%% test if we are in the short or full view
  \gdef\nodecolor{#1}
  \bool_if:NTF\short{
  %% short view
    \tl_if_eq:NNT#1{\vip}{   %% then check if this is an important node
      \node[coolnode]
        (#2) at (#3) {   
        \cooltooltip{#2}{#4}{#4}{}{#5\strut}
      };
    }
  }{
  %% long view
    \node[coolnode] (#2) at (#3) {
      \cooltooltip{#2}{#4}{#4}{}{#5\strut}
    };
  %% and the text view, to be added only once!
  \AtEndDocument{\subsubsection*{\color{blue}#5}\parbox{\textwidth}{#4}}
  }
}

The third mandatory argument of \cooltooltip is a *URL*! You shouldn't
add the description there. Unhappily cooltooltip doesn't remove
the link annotation if the url is empty.

\makeatletter
\renewcommand*{\ctip at make@Widget}[3][0 1 0]{%
  \setlength{\@tempdima}{\wd\ctip at content@box}%
  \addtolength{\@tempdima}{\fboxsep}%
  \setlength{\@tempdimb}{\ht\ctip at content@box}%
  \addtolength{\@tempdimb}{0.5\fboxsep}%
  \setlength{\@tempdimc}{\dp\ctip at content@box}%
  \addtolength{\@tempdimc}{0.5\fboxsep}%
  \hspace*{-0.5\fboxsep}%
  \begingroup
    \def\x{#2}%
  \expandafter\endgroup\ifx\x\@empty
    \let\ctip at action@object\relax   
  \else
    \immediate
    \pdfobj { 
      <<
        /Type /Action
        /S /URI
        /URI (#2)
      >>
    }%  
    \edef\ctip at action@object{\the\pdflastobj\space 0 R}%
    \makebox[0pt][l]{%
      \advance\fboxrule by 0.9999pt
      \pdfannot width \@tempdima   
                height \@tempdimb  
                depth \@tempdimc { 
        /Subtype /Link
        /A \ctip at action@object
        /Border [0 0 \strip at pt\fboxrule]
        /C [#1]
      }%
    }%  
  \fi   
  \pdfannot width \@tempdima
            height \@tempdimb
            depth \@tempdimc {
    /Subtype /Widget
    /FT /Btn
    /T (ctip Field \ctip at tip@number)
    /TU (#3)
    /DA (/Helv 10 Tf 0 0 0 rg)
    /Ff 65536
    /BS <<   
      /Type /Border
      /W \strip at pt\fboxrule
    >>
    /MK <<
      /BC [#1]
      /TP 1   
    >>
    /AA <<
      /E <<
        /Type /Action
        /S /JavaScript
        /JS (\ctip at enter@js)
      >>
      /X <<
        /Type /Action
        /S /JavaScript
        /JS (\ctip at exit@js)
      >>
      /U <<
        /Type /Action
        /S /JavaScript
        /JS (\ctip at unfocus@js)
        \ifx\ctip at action@object\relax
        \else
          /Next \ctip at action@object
        \fi
      >>   
    >>     
  }        
  \xdef\ctip at form@fields{\ctip at form@fields\space\the\pdflastannot\space 0 R}
}
\makeatother

\NewDocumentCommand\tonode{
  O{\normalimportant}
  D(){no label given}
  D(){no position given}
  D<>{no description given}
  m
}{
%% test if we are in the short or full view
  \gdef\nodecolor{#1}
  \bool_if:NTF\short{
  %% short view
    \tl_if_eq:NNT#1{\vip}{   %% then check if this is an important node
      \node[coolnode]
        (#2) at (#3) {
        \cooltooltip{#2}{#4}{}{}{#5\strut}
      };
    }
  }{
  %% long view
    \node[coolnode] (#2) at (#3) {
      \cooltooltip{#2}{#4}{}{}{#5\strut}
    };
  %% and the text view, to be added only once!
  \AtEndDocument{\subsubsection*{\color{blue}#5}\parbox{\textwidth}{#4}}
  }
}

* Spivak's
  You are using U+2019 (RIGHT SINGLE QUOTATION MARK) that's the
  wrong character. The apostrophe is U+0027 (APOSTROPHE).
* AMS-\TeX to LaTeX 2.09 => AMS-TeX to LaTeX 2.09

Yours sincerely
  Heiko Oberdiek


More information about the texhax mailing list