bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

texinfo.tex: poorly nested PDF outlines if unnumbered sections


From: Christopher League
Subject: texinfo.tex: poorly nested PDF outlines if unnumbered sections
Date: 25 Apr 2002 15:29:24 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Greetings,

With the texinfo.tex included in texinfo-4.2 (dated 2002-03-26.08),
there is a problem in generating properly nested PDF outlines
(bookmarks) when unnumbered sections are used.  Here is an example
file, bug.texi:

    \input texinfo.tex
    @contents
    @chapter Copying
    @unnumberedsec GPL
    @unnumberedsubsec Preamble
    @unnumberedsubsec Terms
    @bye

I create bug.pdf as follows:

    texi2dvi --pdf bug.texi

Then view it in Acrobat Reader (gs/gv do not show the bookmarks).
The table of contents is nested correctly:

    1 Copying ................ 1
         GPL ................. 1
            Preamble ......... 1
            Terms ............ 1

The bookmarks are not:

    Copying
       GPL
    Preamble
    Terms

In the general case, it seems that once you have an unnumbered
header, nothing will appear underneath it.

I have fixed this, and a patch to texinfo.tex appears below.
Basically, the fix is to make \unnumbZZZentry work exactly like
\ZZZentry, except when you actually output the text in the table of
contents.  That is, \unnumbZZZentry needs to take the same number of
arguments so that the \pdfoutline can know how many headers appear
beneath it.

Since the numbered and unnumbered tags work exactly the same way
except in the one case, perhaps there is a good way to remove
redundancy, but for now this is just a minimal patch that fixes the
bug.

I don't believe these matter, but here are the versions of everything
else I'm using.
    acroread 4.0 x86 linux
    pdfTeX 3.14159-0.13d   
      (I know, it's old.  I use a newer one on my laptop
       and had the same trouble.. I don't know its exact
       version number...)

Thanks
--Chris    

P.S., by the way, the information about mailing list archives 
(at ftp://ftp-mailing-list-archives.gnu.org/) in the README is 
no longer accurate.


diff -u old/texinfo.tex new/texinfo.tex
--- old/texinfo.tex     Thu Apr 25 15:25:57 2002
+++ new/texinfo.tex     Thu Apr 25 15:26:47 2002
@@ -995,32 +995,28 @@
       \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
       %
       \def\chapentry ##1##2##3{}
-      \let\appendixentry = \chapentry
-      \def\unnumbchapentry ##1##2{}
       \def\secentry ##1##2##3##4{\advancenumber{chap##2}}
-      \def\unnumbsecentry ##1##2##3{\advancenumber{chap##2}}
       \def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}}
-      \def\unnumbsubsecentry ##1##2##3##4{\advancenumber{sec##2.##3}}
       \def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}}
-      \def\unnumbsubsubsecentry 
##1##2##3##4##5{\advancenumber{subsec##2.##3.##4}}
+      \let\appendixentry = \chapentry
+      \let\unnumbchapentry = \chapentry
+      \let\unnumbsecentry = \secentry
+      \let\unnumbsubsecentry = \subsecentry
+      \let\unnumbsubsubsecentry = \subsubsecentry
       \input \jobname.toc
       \def\chapentry ##1##2##3{%
         \pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}}
-      \let\appendixentry = \chapentry
-      \def\unnumbchapentry ##1##2{%
-        \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
       \def\secentry ##1##2##3##4{%
         \pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}}
-      \def\unnumbsecentry ##1##2##3{%
-        \pdfoutline goto name{\pdfmkpgn{##3}}{##1}}
       \def\subsecentry ##1##2##3##4##5{%
         \pdfoutline goto 
name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}}
-      \def\unnumbsubsecentry ##1##2##3##4{%
-        \pdfoutline goto name{\pdfmkpgn{##4}}{##1}}
       \def\subsubsecentry ##1##2##3##4##5##6{%
         \pdfoutline goto name{\pdfmkpgn{##6}}{##1}}
-      \def\unnumbsubsubsecentry ##1##2##3##4##5{%
-        \pdfoutline goto name{\pdfmkpgn{##5}}{##1}}
+      \let\appendixentry = \chapentry
+      \let\unnumbchapentry = \chapentry
+      \let\unnumbsecentry = \secentry
+      \let\unnumbsubsecentry = \subsecentry
+      \let\unnumbsubsubsecentry = \subsubsecentry
       \input \jobname.toc
     \endgroup\fi
   }}
@@ -3597,7 +3593,7 @@
 \unnumbchapmacro {#1}%
 \gdef\thischapter{#1}\gdef\thissection{#1}%
 \toks0 = {#1}%
-\edef\temp{\noexpand\writetocentry{\realbackslash 
unnumbchapentry{\the\toks0}}}%
+\edef\temp{\noexpand\writetocentry{\realbackslash 
unnumbchapentry{\the\toks0}{\the\chapno}}}%
 \temp
 \unnumbnoderef
 \global\let\section = \unnumberedsec
@@ -3639,7 +3635,7 @@
 \plainsecheading {#1}\gdef\thissection{#1}%
 \toks0 = {#1}%
 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbsecentry%
-  {\the\toks0}{\the\chapno}}}%
+  {\the\toks0}{\the\chapno}{\the\secno}}}%
 \temp
 \unnumbnoderef
 \nobreak
@@ -3678,7 +3674,7 @@
 \plainsubsecheading {#1}\gdef\thissection{#1}%
 \toks0 = {#1}%
 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsecentry%
-  {\the\toks0}{\the\chapno}{\the\secno}}}%
+  {\the\toks0}{\the\chapno}{\the\secno}{\the\subsecno}}}%
 \temp
 \unnumbnoderef
 \nobreak
@@ -3719,7 +3715,7 @@
 \plainsubsubsecheading {#1}\gdef\thissection{#1}%
 \toks0 = {#1}%
 \edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsubsecentry%
-  {\the\toks0}{\the\chapno}{\the\secno}{\the\subsecno}}}%
+  {\the\toks0}{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}%
 \temp
 \unnumbnoderef
 \nobreak
@@ -4012,11 +4008,11 @@
       \hyphenpenalty = 10000
       \advance\baselineskip by 1pt % Open it up a little.
       \def\secentry ##1##2##3##4{}
-      \def\unnumbsecentry ##1##2##3{}
       \def\subsecentry ##1##2##3##4##5{}
-      \def\unnumbsubsecentry ##1##2##3##4{}
       \def\subsubsecentry ##1##2##3##4##5##6{}
-      \def\unnumbsubsubsecentry ##1##2##3##4##5{}
+      \let\unnumbsecentry = \secentry
+      \let\unnumbsubsecentry = \subsecentry
+      \let\unnumbsubsubsecentry = \subsubsecentry
       \openin 1 \jobname.toc
       \ifeof 1 \else
         \closein 1
@@ -4073,21 +4069,21 @@
 }
 
 % Unnumbered chapters.
-\def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
-\def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno\bgroup#2\egroup}}
+\def\unnumbchapentry#1#2#3{\dochapentry{#1}{#3}}
+\def\shortunnumberedentry#1#2#3{\tocentry{#1}{\doshortpageno\bgroup#3\egroup}}
 
 % Sections.
 \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
-\def\unnumbsecentry#1#2#3{\dosecentry{#1}{#3}}
+\def\unnumbsecentry#1#2#3#4{\dosecentry{#1}{#4}}
 
 % Subsections.
 \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
-\def\unnumbsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
+\def\unnumbsubsecentry#1#2#3#4#5{\dosubsecentry{#1}{#5}}
 
 % And subsubsections.
 \def\subsubsecentry#1#2#3#4#5#6{%
   \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
-\def\unnumbsubsubsecentry#1#2#3#4#5{\dosubsubsecentry{#1}{#5}}
+\def\unnumbsubsubsecentry#1#2#3#4#5#6{\dosubsubsecentry{#1}{#6}}
 
 % This parameter controls the indentation of the various levels.
 \newdimen\tocindent \tocindent = 3pc




reply via email to

[Prev in Thread] Current Thread [Next in Thread]