将零件编号更改为阿拉伯语单词

将零件编号更改为阿拉伯语单词

类似地,

将章节编号更改为阿拉伯语单词

我怎样才能用阿拉伯语写出“第一部分”而不是“第 1 部分”:

将“part”一词替换为“الجزء”,因为“القسم”一词不合适。

我能够使用以下命令进行替换:

\gappto\captionsarabic{\renewcommand{\partname}{الجزء}}

但是,我不知道如何用字母书写的阿拉伯语翻译替换数字

以下是 MWE:


\documentclass[a4paper,12pt,twoside]{book}
\usepackage[a4paper,top=2.5cm,bottom=2.5cm,margin=2.5cm,bindingoffset=0.5cm]{geometry} 

\usepackage{hyperref} 

\usepackage{arabluatex}
\setcounter{secnumdepth}{6} 
\setcounter{tocdepth}{6}
    

\usepackage[bidi=basic,layout=lists.tabular]{babel}
\babelprovide[import=ar,mapdigits,main]{arabic}
\babelprovide[import=en,language=Default]{english}

\babelfont{rm}{Latin Modern Roman}
\babelfont[arabic]{rm}{Simplified Arabic}
\babelfont[english]{rm}{Times New Roman}








 %%%%%  END MACRO Litteral Numbering of chapters 
     
    \newcommand\words[1]{\expandafter\xwords\csname c@#1\endcsname}
    \def\xwords#1{\ifcase#1\or
    الأول\or
    الثاني\or
    الثالث\or
    الرابع\or
    الخامس\or
    السادس\or
    السابع\or
    الثامن\or
    التاسع\or
    العاشر\or
الحادي عشر\or 
الثاني عشر\or 
الثالث عشر\or 
الرابع عشر\or 
الخامس عشر\or 
السادس عشر\or  
السابع عشر\or
الثامن عشر\or 
التاسع عشر\or 
العشرون\or 
    \else
    I need more words أحتاج إلى المزيد من ترقيمات الأبواب بالحروف في ملف arbbook.cls\fi}

     
    %next three lines is to make chapter naming use the above wordings (literal numbering in Arabic words)

% The below commands so that chapter name apear in header as Chapter one instead of chapter1
\usepackage{etoolbox} 
\makeatletter
\pretocmd{\Hy@org@chapter}
  {\begingroup \renewcommand{\thechapter}{{\words{chapter}}}}
  {}
  {}
\patchcmd{\Hy@org@chapter} 
% Controls how chapter namin apear in table of contents
  {\addcontentsline{toc}{chapter}{\protect\numberline{\thechapter}#1}}
  {\addcontentsline{toc}{chapter}{\@chapapp\space\words{chapter}\space#1}}
  {}
  {}
\apptocmd{\Hy@org@chapter}
  {\endgroup}
  {}
  {}
\patchcmd{\@makechapterhead}
  {\thechapter}
  {\words{chapter}}
  {}
  {}
\makeatother
 
 


% The below commands so that part name apear in header as part one instead of part 1
\makeatletter
\pretocmd{\Hy@org@part}
  {\begingroup \renewcommand{\thepart}{{\words{part}}}}
  {}
  {}
\patchcmd{\Hy@org@part} 
% Controls how part namin apear in table of contents
  {\addcontentsline{toc}{part}{\protect\numberline{\thepart}#1}}
  {\addcontentsline{toc}{part}{\partname\space\words{part}\space#1}}
  {}
  {}
\apptocmd{\Hy@org@part}
  {\endgroup}
  {}
  {}
\patchcmd{\@makeparthead}
  {\thepart}
  {\words{part}}
  {}
  {}
\makeatother


% part Naming
\gappto\captionsarabic{\renewcommand{\partname}{الجزء}} %to name the part title   الجزء instead of القسم

% Chapter Naming
\gappto\captionsarabic{\renewcommand{\chaptername}{الباب}}
 
\gappto\captionsarabic{\renewcommand{\appendixname}{الملحق}}






\begin{document}

\part{تمهيد}
\chapter{شكر وتقدير} 
\subsection{سيشسي}
\subsubsection{شسيسشسي}


\end{document}

答案1

这是提供的设置区域相关计数器和重新定义字符串的一般机制babel。有一些简化,但请注意“单词”计数器出现在部分编号中(但是,您可以重新定义它)。需要相对较新的版本。

\documentclass[a4paper,12pt,twoside]{book}
\usepackage[a4paper,top=2.5cm,bottom=2.5cm,
            margin=2.5cm,bindingoffset=0.5cm]
           {geometry} 

\usepackage{hyperref} 

\setcounter{secnumdepth}{6} 
\setcounter{tocdepth}{6}

\usepackage[english, bidi=basic, layout=lists.tabular]{babel}
\babelprovide[
  import,
  mapdigits,
  main, % Space separated list. Use braces in multi-word items:
  counters/words = الأول الثاني الثالث الرابع الخامس السادس السابع
     الثامن التاسع العاشر {الحادي عشر} {الثاني عشر}]{arabic}

\babelfont{rm}{Simplified Arabic} % The main font for the main lang
\babelfont[english]{rm}{Latin Modern Roman} % Secondary font/lang

\renewcommand{\thepart}{\localecounter{words}{part}}
\renewcommand{\thechapter}{\localecounter{words}{chapter}}

\setlocalecaption{arabic}{part}{الجزء}
\setlocalecaption{arabic}{chapter}{الباب}
\setlocalecaption{arabic}{appendix}{الملحق}

\begin{document}

\part{تمهيد}
\chapter{شكر وتقدير} 
\subsection{سيشسي}
\subsubsection{شسيسشسي}

\end{document}

在此处输入图片描述

相关内容