0

Regarding the \FormatChar Macro, proposed in Emphasizing Arabic text characters

Upon its use, the formatted character gets separated ah shown below, is there a way to fix it, whereas the \formatchars macro within the same post is working fine.


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

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

\babelfont{rm}{Amiri}

\usepackage{tikz} \usepackage{ulem}

\def\connecti{i} \def\connectr{r} \def\connectl{l} \def\connectb{b}

\makeatletter \def\FormatChar#1#2#3#4{% \let\joineri@firstofone \let\joinerii@firstofone \def\formatcs{#1} \def\temp{#3}% \if\temp\connectb% \else \if\temp\connectr% \let\joinerii@gobble% \else \if\temp\connectl% \let\joineri@gobble% \else
\if\temp\connecti% \let\joineri@gobble\let\joinerii@gobble% \else @latex@error {\temp is not available for contextual forms} \fi% \fi% \fi%
\fi% \xFormatChar{#2}#4} \def\xFormatChar#1#2{\ifnum#1=1 \joineri{^^^^200d} \formatcs{\joineri{^^^^200d}#2\joinerii{^^^^200d}} \joinerii{^^^^200d}\expandafter@gobbletwo \else#2\fi\xFormatChar{\numexpr#1-1\relax}} \makeatother

\tikzset{charboxstyle/.style={draw=red,inner sep=0pt,fill=yellow}}

\newcommand{\charbox}[1]{% \tikz[baseline=(x.base)]\node(x)[charboxstyle]{#1};% }

\begin{document}

%\FormatChar{#1}{#2}{#3}{#4} % #1: Command % #2: Position of char (number) % #3: Contextual forms r , l , b , i % #4: Word

\Huge

\FormatChar{\uline}{1}{l} {جنوب} % \FormatChar{\textcolor{blue}}{2}{b} {جنوب} % \FormatChar{\textcolor{red}}{3}{r} {جنوب} % \FormatChar{\charbox}{4}{i} {جنوب} % \tikzset{charboxstyle/.append style={dashed,draw=blue,fill=green,text=orange}} % \FormatChar{\charbox}{1}{l} {جنوب}

\end{document}

enter image description here

Silva
  • 743
  • Did you use XeLaTeX or LuaLaTeX? Do you have an up-to-date distribution with recent (2020) versions of babel, tikz and the compilers? Do you use MikTeX or TeX Live or MacTeX, locally or online (Overleaf)? – Marijn Aug 16 '20 at 14:05
  • @Marijn, I am using Lualatex, with the last updated version. – Silva Aug 16 '20 at 14:16
  • 1
    I have corrected the example in the link It was missing some % in the definition of macro, You can try. – Salim Bou Aug 16 '20 at 15:17

0 Answers0