4

Using an alphabetical counter in arabic by the command \alph, it gives for the first letter of alphabet the arabic letter ا which is not so "beautiful" to use... I want to use the letter أ instead of this letter. How can I change the first letter of the counter \alph?

I write an ECM for this question

\documentclass[14pt,a4paper]{book}
\usepackage{extsizes}
\usepackage{multicol}
\usepackage{amsmath,amssymb}
\usepackage[most]{tcolorbox}
\usepackage{array}

\usepackage{polyglossia}
\setmainlanguage[numerals=maghrib]{arabic}
\setotherlanguage{english}

\newfontfamily\arabicfont[Script=Arabic,Scale=1.2,AutoFakeSlant=-0.02]{Traditional Arabic}
\setsansfont[Script=Arabic,Scale=1.5]{Traditional Arabic}

\tikzstyle{boxwhite} =
    [draw=white, thick, scale=.7, fill=white,% 
    line width=0.3pt, text=black, rectangle,
    font=\Large,
    left, minimum height=.5cm]

\newtcolorbox[auto counter, 
number within=section,
number freestyle={\noexpand\arabic{section}\noexpand\alph{\tcbcounter}}]{example}[2][]{%
enhanced,
left=-5pt,
right=-5pt,
colback=white,
colframe=white,
top=-.6cm,
bottom=.6cm,
enlarge top by=\baselineskip/2+1mm,
enlarge top at break by=0mm,pad at break=2mm,
fontupper=\normalsize,
label={#2},
overlay unbroken and first={%
\node[boxwhite]
at ([xshift=1.6cm,yshift=-2.5mm]frame.north east)
{\strut\RL{\setlength{\extrarowheight}{-30.5pt}\textbf{$\begin{array}{c}
\hline
\rule{0pt}{2ex}
\mbox{\RL{مثال}}
\\
\mbox{\large\thetcbcounter}
\rule{0pt}{1.5ex}
\end{array}$}}};},
breakable,
before=\par\smallskip\centering,
width=\textwidth,       %%% change the width here.
arc=0pt,outer arc=0pt,
#1}%

\begin{document}
\setcounter{section}{1}
 \begin{example}{ex1}
\LR{Example one.}
\end{example}
 \begin{example}{ex2}
\LR{Example two.}
\end{example}
 \begin{example}{ex3}
\LR{Example three.}
\end{example}
\end{document}

which gives this..

enter image description here

The first number 1ا , using the first letter of alphabet, is not beautiful for me. I prefer this one 1أ with the letter أ , using "another" first letter of alphabet. How can I change it...only for the first letter..

4
  • 1
    This depends on several factors. Can you add a minimal example of code?
    – egreg
    Nov 28, 2014 at 17:08
  • 1
    Could you supply the entire alphabetic numbering sequence?
    – Werner
    Nov 28, 2014 at 17:08
  • 2
    And off-topic: Please accept the answers to many of your questions... so much effort by other users here...
    – user31729
    Nov 28, 2014 at 17:09
  • I'll try to do but I don't understand very well the way of that... Thanks Nov 28, 2014 at 17:48

1 Answer 1

4

Here's a minimal example; the package enumitem is loaded just to have an application of \alph, the important code you have to add is

\usepackage{etoolbox}

\makeatletter
% patch \abj@num@i@iso
\patchcmd\abj@num@i@iso{^^^^0627}{^^^^0623}{}{}
\makeatother

Maybe some other macros where ا appears should be changed in a similar way (let us know). I use the ^^^^ notation just for convenience, as I'm not used to RTL editors. I use Scheherazade because I don't have your font, but it shouldn't matter.

\documentclass[a4paper]{book}

\usepackage{polyglossia}
\setmainlanguage[numerals=maghrib]{arabic}
\setotherlanguage{english}

\usepackage{enumitem} % for showing \alph
\usepackage{etoolbox}

\newfontfamily\arabicfont[Script=Arabic,Scale=1.2,AutoFakeSlant=-0.02]{Scheherazade}

\makeatletter
% patch \abj@num@i@iso
\patchcmd\abj@num@i@iso{^^^^0627}{^^^^0623}{}{}
\makeatother

\begin{document}

\begin{enumerate}[label=\alph*]
\item \LR{Example one.}
\item \LR{Example two.}
\item \LR{Example three.}
\end{enumerate}
\end{document}

enter image description here

3
  • Ok your answer is what I wanted. Thanks. But there is a problem connected.. using the command \setenumerate[0]{label=\textbf{\small(\Alph*)},align=left,leftmargin=0pt,labelwidth=-5pt,itemsep=0pt} the enumeration changes by the same in the first item, ا by أ. How can we have not this for enumerate ? Nov 28, 2014 at 20:08
  • @FaouziBellalouna There's no difference in Arabic between uppercase and lowercase, so \Alph and \alph do exactly the same thing.
    – egreg
    Nov 28, 2014 at 20:52
  • yes I know..because there's no capital letters in arabic...Your solution is acceptable for me at all. I'll use it thks Nov 28, 2014 at 21:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .