3

I'm writing a book of probability in arabic, using polyglossia, and I want to increase the counter of some of my boxes ten by ten (the cause of this is that the arabic letters are numeroted with abjad, using unity in the nineth first letters, after using ten's for the nineth next, hundreds for the nineth's next, and thounsand for the 28-th and last letter... you can see this wikipedia in french, I've not another source...http://fr.wikipedia.org/wiki/Num%C3%A9ration_arabe).. A solution I've found is to increase the counter by 9, in every iteration, with the command phantom={\addtocounter{\tcbcounter}{9}}, but the label of this box is referred to the counter before this command... I saw that it's natural in the doc of the tcolorbox package.. So how can I refer the labels of my examples to the labels after add of 9 to my item... or some other idea. Thank you. Here's an example from my file..

\documentclass[14pt,a4paper]{extbook}

\usepackage{titlesec}


\usepackage{amsmath,amssymb}
\usepackage[most]{tcolorbox}


\usepackage{boxedminipage}
\usepackage{slashbox}

\usepackage{titlesec}


\usepackage{enumitem}

\usepackage{minitoc}

\usepackage{rotating}

\usepackage{fmultico}
\setlength{\columnseprule}{0.1pt}

\usepackage{fancyhdr}
\pagestyle{fancy}

\usepackage{pdflscape}

\usepackage{array}


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

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


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

\newcounter{example}

\newtcolorbox[auto counter, 
number within=section,
number freestyle={\noexpand\arabic{section}\noexpand\alph{\tcbcounter}}]{example}[2][]{
enhanced,
colback=white,
colframe=white,
top=-.7cm,
bottom=-2mm,
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.4cm,yshift=-.15cm]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,
width=1.048\textwidth,       
arc=0pt,outer arc=0pt,
enlarge left by=-.085\textwidth,
extrude right by=-5pt,
extrude left by=-5pt,
#1}%

\newtcolorbox[use counter from=example]{example9}[2][]{
enhanced,
phantom={\addtocounter{\tcbcounter}{9}},
colback=white,
colframe=white,
top=-.7cm,
bottom=-2mm,
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.4cm,yshift=-.15cm]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,
width=1.048\textwidth,      
arc=0pt,outer arc=0pt,
enlarge left by=-.085\textwidth,
extrude right by=-5pt,
extrude left by=-5pt,
#1}%
\begin{document}

\begin{example}{ex0:a}
First 
\end{example}
\begin{example}{ex0:b}
Second 
\end{example}
\begin{example}{ex0:c}
....
\end{example}
\begin{example}{ex0:d}
....
\end{example}
\begin{example}{ex0:e}
....
\end{example}
\begin{example}{ex0:f}
....
\end{example}
\begin{example}{ex0:g}
....
\end{example}
\begin{example}{ex0:h}
....
\end{example}
\begin{example}{ex0:i}
....
\end{example}
\begin{example}{ex0:j}
....
\end{example}
\begin{example9}{ex0:k}
\LR{A good numeroted}
\end{example9}
\begin{example}{ex0:l}
\LR{A bad numeroted}
\end{example}
\LR{but the reference \ref{ex0:k} of the ten-th exercise is bad...}

 \end{document}
8
  • Hello! A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it).
    – yo'
    Mar 24, 2014 at 9:40
  • 3
    Try to increase the counter by \addtocounter{\tcbcounter}{8}\refstepcounter{tcbcounter}} (Untested as your example is far from minimal and contains a reference to a font I don't have). Mar 24, 2014 at 9:44
  • @tohecz..Hello, Sorry but I don't understand your tip... I don't see the relation with my problem.. Mar 24, 2014 at 9:45
  • Hello Ulrike. your idea works very well. Thank you... But I don't understand why ! Your idea remains from what ? Mar 24, 2014 at 10:03
  • If you want to reference a counter you must increase it by \refstepcounter. This changes the internal command used by label. Nine \refsetcounter{tcbcounter} in a row would have worked too. Mar 24, 2014 at 11:11

1 Answer 1

4

If you want to reference a counter you must increase it by \refstepcounter. This changes the internal command used by label.

So you should increase the counter by

\addtocounter{\tcbcounter}{8}\refstepcounter{tcbcounter}}

so that the last step does the right things.

You must log in to answer this question.

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