0

I have a 2-language doc (arabic and english). Sometimes it is primarily English, sometimes primarily Arabic.

When the doc was primarily Arabic, I changed the Arabic chapter headings with code (see below) I obtained from @ahmed-el-bokl.

\gappto\captionsarabic{\renewcommand{\chaptername}{الباب}}
\def\xwords#1{\ifcase\value{#1}\or
الأول\or
الثاني\or
الثالث\or
الرابع\or
الخامس\or
\else
أحتاج إلى المزيد من ترقيمات الأبواب بالحروف في ملف \fi}

However, some of my documents are primarily English, so I would like to execute Ahmed's code only if a flag (arabicstudent) is set, otherwise keep the document English. To do this I have a newcommand called whichlanguage inside which is a renewcommand which is only called if the flag is set.

Below is my MWE. But xetex sees the #1 inside the inner renewcommand and complains that I did not specify arguments in the outer newcommand.

How do I fix this?

\newcommand{\whichlanguage}
{
\ifarabicstudent
\setmainlanguage{arabic}

    %here is Ahmed's code again
    \gappto\captionsarabic{\renewcommand{\chaptername}{الباب}}
    \def\xwords#1{\ifcase\value{#1}\or
    الأول\or
    الثاني\or
    الثالث\or
    الرابع\or
    الخامس\or
    \else
    أحتاج إلى المزيد من ترقيمات الأبواب بالحروف في ملف \fi}

\else
\setmainlanguage{english}
\fi

}
Tim
  • 1,539

0 Answers0