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

Bug#306586: hyperref: nests bookmarks incorrectly



Hello,

On Thu, Apr 28, 2005 at 07:41:48PM +0200, Hilmar Preusse wrote:

> On 27.04.05 Braun Gabor (braung@renyi.hu) wrote:
> 
> Hello Heiko,
> 
> The following bug we received at our BTS. As the behaviour changes as
> soon as I switch to another language I suspect that to be a bug in
> babel and submitted it at the LaTeX BTS
> (http://www.latex-project.org/cgi-bin/ltxbugs2html?pr=babel%2F3780).
> Would you be so kind to have a short look to see, if I'm wrong.

> > \usepackage[magyar]{babel}
> > \usepackage[bookmarksnumbered,bookmarksopen]{hyperref}

"magyar.ldf" redefines most of the essential commands
that also hyperref must change. A patch would have to
include many of hyperref/driver stuff/nameref, adopted
to magyar.ldf. Sorry. I definitely don't have the resources
to maintain mostly redundant recursive copies of hyperref
with exponential number of test files.
  See the changes that are necessary for the short test
file only:

\documentclass{article}
\usepackage{nameref}
\usepackage[magyar]{babel}
\usepackage[bookmarksnumbered,bookmarksopen]{hyperref}

\makeatletter
\let\Hy@magyar@saved@refstepcounter\refstepcounter
\addto\extrasmagyar{%
  \let\H@refstepcounter\refstepcounter
  \let\refstepcounter\Hy@magyar@saved@refstepcounter
  \expandafter\renewcommand\expandafter*\expandafter\@ssect
      \expandafter[\expandafter 5\expandafter]\expandafter{%
    \expandafter\def\expandafter\@currentlabelname\expandafter{%
      \expandafter #\expandafter 5\expandafter
    }%
    \@ssect{#1}{#2}{#3}{#4}{#5}%
    \phantomsection
  }%
  \expandafter\Hy@magyar@patch@sect\expandafter{%
    \@sect{#1}{#2}{#3}{#4}{#5}{#6}[{#7}]{#8}%
  }{#1#2#3#4#5#6[#7]#8}{#2}{#7}%
}
\def\Hy@magyar@patch@sect#1#2#3#4{%
  \def\@sect#2{%
    \setcounter{section@level}{#3}%
    \def\@currentlabelname{#4}%
    \ifnum #3>\c@secnumdepth
      \Hy@GlobalStepCount\Hy@linkcounter
      \xdef\@currentHref{section*.\the\Hy@linkcounter}%
    \fi
    #1%
    \ifnum #3>\c@secnumdepth
      \Hy@raisedlink{\hyper@anchorstart{\@currentHref}\hyper@anchorend}%
    \fi
  }%
}

\makeatother

\begin{document}

\section{First section}

\section{Second section}

\subsection{A subsection}

\end{document}


And missing are a lot: \label, captions, ...
And support for nameref without hyperref, different package orders,
language switchings ...

The easiest solution is perhaps to write an adopted magyar-hyper.ldf
with a restricted set of supported packages. The writer of this
file then only must compare the different versions (with and without
magyar) and try a merging of the definitions. But if something
changes in hyperef or magyar, then also magyar-hyper.ldf would have
to be checked and updated. As I already said, I don't have the
resources for this.

Also hyperref's README contains since 2003/11/17:

| babel/magyar.ldf: unsupported
|   magyar.ldf's redefinitions of many LaTeX internals conflict
|   with hyperref's redefinitions of these commands.

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



Reply to: