[texhax] Hyperref query
Heiko Oberdiek
oberdiek at uni-freiburg.de
Tue May 11 21:29:07 CEST 2010
On Tue, May 11, 2010 at 09:10:11PM +1000, Vafa Khalighi wrote:
> As in polyglossia, if you create abjad numbering say by:
>
> \documentclass{article}
> \usepackage{hyperref}
> \usepackage{etoolbox}
> \makeatletter
> \providecommand*{\xpg at warning}[1]{%
> \PackageWarning{some dummy package}%
> {#1}}
> \ifcsdef{abjad}{}{%
> \def\abjad#1{%
> \ifnum#1>1999 \xpg at warning{Illegal value (#1) for abjad numeral} {#1}
> \else
> \ifnum#1<\z@\space\xpg at warning{Illegal value (#1) for abjad numeral}%
> \else
> \ifnum#1<10\expandafter\abj at num@i\number#1%
> \else
> \ifnum#1<100\expandafter\abj at num@ii\number#1%
> \else
> \ifnum#1<\@m\expandafter\abj at num@iii\number#1%
> \else
> \ifnum#1<\@M\expandafter\abj at num@iv\number#1%since #1<2000, we
> must have 1000
> \fi
> \fi
> \fi
> \fi
> \fi
> \fi
> }
> \def\abjad at zero{}
> \def\abj at num@i#1{%
> \ifcase#1\or ??????\or ??\or ??\or ??%
> \or ??\char"200D\or ??\or ??\or ??\or ??\fi
> \ifnum#1=\z@\abjad at zero\fi}
> \def\abj at num@ii#1{%
> \ifcase#1\or ??\or ??\or ??\or ??\or ??%
> \or ??\or ??\or ??\or ??\fi
> \ifnum#1=\z@\fi\abj at num@i}
> \def\abj at num@iii#1{%
> \ifcase#1\or ??\or ??\or ??\or ??\or ??%
> \or ??\or ??\or ??\or ??\fi
> \ifnum#1=\z@\fi\abj at num@ii}
> \def\abj at num@iv#1{%
> \ifcase#1\or ??\fi
> \ifnum#1=\z@\fi\abj at num@iii}
> }
> \let\@latinalph\@alph%
> \let\@latinAlph\@Alph%
> \let\@alph\abjad%
> \let\@Alph\abjad%
>
> \makeatother
> \begin{document}
> \tableofcontents
> \section{Test}
> \newpage
> \appendix
> \section{Another Test}
> \end{document}
>
> Then the section entry in the toc, does not link to the section in the
> appendix or if it links, it links to the first section. Could you please
> explain why this happens and if there could be a clean solution to this
> situation.
Thanks for the bug report.
\@alph is redefined, however it is also used for generating anchor
names. Because hyperref usually uses \theH<counter> instead of
\the<counter>, if \theH<counter> exists, an appropriate
definition of \theHchapter can be given, e.g.
\g at addto@macro\appendix{%
\gdef\thesection{\@latinAlph\c at section}%
}
hyperref 2010/05/11 v6.81c now checks \@alph and \@Alph for
the original LaTeX meaning. If they differ, hyperref now
uses a replacement in all cases (the string "alph"/"Alph",
followed by the arabic number).
Yours sincerely
Heiko Oberdiek
More information about the texhax
mailing list