多語言和超引用問題

多語言和超引用問題

這是一個最小的例子,我不知道問題出在哪裡?

\documentclass[12pt,a4paper,openany]{book}


%%%%%%%%%%%%%%%%%%%
\usepackage{fancyhdr}
\pagestyle{fancy}

\usepackage{hyperref}
\hypersetup{
    colorlinks=true,
    linkcolor=blue,
    filecolor=magenta,
    urlcolor=cyan,
    citecolor=blue
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{polyglossia}
\setmainlanguage[numerals=maghrib]{arabic}
\setotherlanguage{english}
\newfontfamily\arabicfont[Script=Arabic,Scale=1.1,AutoFakeSlant=-0.03]{Amiri}
\setsansfont[Script=Arabic,Scale=1.1]{Amiri}

\makeatletter
\pretocmd{\@chapter}{\begingroup \renewcommand{\thechapter}{{\words{chapter}}}}{}{}
\apptocmd{\@chapter}{\endgroup}{}{}
\makeatother




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  MACRO FOR LITERAL NUMBERING %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand\words[1]{\expandafter\xwords\csname c@#1\endcsname}
\def\xwords#1{\ifcase#1\or
الأول\or
الثاني\or
الثالث\or
الرابع\or
\else
I need more words\fi}

\makeatletter
\patchcmd{\@makechapterhead}{\thechapter}{\words{chapter}}{}{}
\makeatother





%%%%%%%%%%%%%%%%%% REDEFINES \THECHAPTER IN CONTENTS
\makeatletter
\pretocmd{\@chapter}{\begingroup \renewcommand{\thechapter}{{\words{chapter}}}}{}{}
\apptocmd{\@chapter}{\endgroup}{}{}
\makeatother


\usepackage[Glenn]{fncychap}
\ChNumVar{\Large}% Dimension of the number of the chapter in the first page... instead of the default...\ChNumVar{\Huge}


\begin{document}

\chapter{واحد}

\end{document}

答案1

這可能是也可能不是一個合適的答案,但據我所知(作為一個不懂阿拉伯語的人),它給出的輸出與沒有的 MWE 相同hyperref(包括在 TOC 和標題中)。

我已改用babelLuaLaTeX 來解決bidi.並打了補丁\Hy@org@chapter。這是嵌入到自己的新宏中的原始\@chapter巨集。hyperref\@chapter

\documentclass[12pt,a4paper,openany]{book}
\usepackage{etoolbox}
\usepackage[nil,bidi=basic-r]{babel}
\babelprovide[import,main]{arabic}
\babelprovide[import]{english}
\babelfont[arabic]{rm}[Scale=1.1, AutoFakeSlant=-0.03]{Amiri}
\babelfont[arabic]{sf}[Scale=1.1]{Amiri}
\usepackage[Glenn]{fncychap}
\ChNumVar{\Large}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{hyperref}
\hypersetup{
  colorlinks=true,
  linkcolor=blue,
  filecolor=magenta,
  urlcolor=cyan,
  citecolor=blue
}
\newcommand\words[1]{\expandafter\xwords\csname c@#1\endcsname}
\def\xwords#1{%
  \ifcase#1\or
  الأول\or
  الثاني\or
  الثالث\or
  الرابع\or
  \else
  I need more words\fi}    
\makeatletter
\pretocmd{\Hy@org@chapter}
  {\begingroup \renewcommand{\thechapter}{{\words{chapter}}}}
  {}
  {}
\apptocmd{\Hy@org@chapter}
  {\endgroup}
  {}
  {}
\patchcmd{\@makechapterhead}
  {\thechapter}
  {\words{chapter}}
  {}
  {}
\makeatother    
\begin{document}    
\chapter{واحد}
\end{document}

微波能量輸出

相關內容