Hi Vafa,
On 11/05/2010, at 10:11 PM, Vafa Khalighi wrote:
Even more condensed:
\documentclass{article}
\makeatletter
\def\vafa#1{\ifcase#1\or ا\or ب\or ح\or ح\or خ\fi}
\l...@alph\vafa
\makeatother
\usepackage{hyperref}
\begin{document}
\tableofcontents
\section{Test}
\newpage
\appendix
\section{Another Test}
\end{document}
It seems that the actual problem is because of the presence of
Persian characters.
Isn't the problem more fundamental than this?
Strings cannot be put directly into a PDF document in UTF8 encoding.
It needs to be either Latin-1 + octal codes, or UTF16 as Hexadecimal.
So when writing destination names, and into the .out file for
bookmarks, you need to adjust your macros to produce strings
in one of these formats.
But in your example, it is the destination name that is
causing the problem, when constructing a value for
\theHsection
via \Alph {section} .
At the relevant place in the coding there is no reason at all
to be using unicode characters, as this number is only being
used internally.
So you should be adjusting a macro somewhere to *not* patch in
the Persian form of \...@alph but keep using the usual Latin form.
In particular, the following is wrong:
\l...@latinalph\@alph%
\l...@latinalph\@Alph%
\l...@alph\abjad%
\l...@alph\abjad%
This rebinding of \...@alph and \...@alph should not be done *globally*.
It should be a *local* rebinding, made only when creating numbers
for visual display, but not when the numbers are being used
to create destination and label names.
Alternatively, it may be easier to make the global change,
but *also* locate all the places where you need to switch back,
using:
\l...@alph\@latinalph
\l...@alph\\@latinAlph
Hyperref recognises commands \0 \1 \2 \3 \8 \9 which
allows octal codes \000 up to \377 (giving 0--255)
and \8** and \9*** for octal couplets to obtain 16-bit codes.
So if you were to be putting Persian numbers to be displayed within
PDF bookmarks, then you would need macros such as the following:
\def\...@oct@i#1{%
\ifcase#1\or\814\047\814\104\814\101\or\814\050\or\814\054\or\814\057%
\or\814\007\840\015\or\814\110\or\814\062\or\814\055\or\814
\067\fi%
\ifnum#1...@\abjad@zero\fi}
\def\...@oct@ii#1{%
\ifcase#1\or\814\315\or\814\241\or\814\104\or\814\105\or\814\106%
\or\814\063\or\814\071\or\814\101\or\814\065\fi
\ifnum#1...@\fi\abj@o...@i}
\def\...@oct@iii#1{%
\ifcase#1\or\814\102\or\814\061\or\814\064\or\814\052\or\814\053%
\or\814\056\or\814\060\or\814\066\or\814\070\fi
\ifnum#1...@\fi\abj@o...@ii}
\def\...@oct@iv#1{%
\ifcase#1\or\814\072\fi
\ifnum#1...@\fi\abj@o...@iii}
\pdfstringdefDisableCommands{%
\let\...@num@i\...@oct@i
\let\...@num@ii\...@oct@ii
\let\...@num@iii\...@oct@iii
\let\...@num@iv\...@oct@iv
}
I think I've got the octets correct.
If not, then Heiko might point out any errors.
--
Best wishes,
Vafa Khalighi
Hope this helps,
Ross
------------------------------------------------------------------------
Ross Moore r...@maths.mq.edu.au
Mathematics Department office: E7A-419
Macquarie University tel: +61 (0)2 9850 8955
Sydney, Australia 2109 fax: +61 (0)2 9850 8114
------------------------------------------------------------------------
--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
http://tug.org/mailman/listinfo/xetex