# Switch between right-to-left and left-to-right two-columns with long entries

I give here the answer of the problem of using indices for making dictionaries English-Arabic, for a book of probability, thanks to this very powerful discussion... Switch twocolumn between right-to-left and left-to-right with the package multiind in polyglossia

The idea is to order the entries in Arabic order, and in English order, and after, thanks to the commands \RTLdblcol (Right-to-Left-double-column) \LTRdblcol... we obtain the two dictionaries with Arabic and English entries...

I give this example to watch you what happens when the entries of index are too long (with the packages used in the file)...

\documentclass[14pt,a4paper]{extbook}%{article}%

\usepackage{titlesec}
\usepackage{titletoc}
\usepackage{etoolbox}
\usepackage{multicol}

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

\usepackage{boxedminipage}
\usepackage{slashbox}

\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}

\usepackage{multind}
\makeindex{dico-ar}
\makeindex{dico-eng}

%%% OBTAIN INDEX WITHOUT NUMBERS OF PAGE %%%%%
\newcommand{\idxnopage}[1]{{}} % This line deletes index page number.
\providecommand{\gobble}[1]{{}} % This line deletes a comma.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\RLarabic#1{\selectlanguage{arabic}\RL{#1}\selectlanguage{english}}

\def\aeindex#1#2#3#4{%
}% End of \aeindex...

\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   INDEX ENTRIES   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\aeindex{قانون ضرب}{قانون الضرب}{Multiplication rule}{Multiplication rule}
\aeindex{متساوية}{متساوية}{Equality}{Equality}
\aeindex{مقدر الاحتمال الأعظم}{مقدر الاحتمال الأعظم}{Maximum likelihood estimate}{Maximum likelihood estimate}

\aeindex{عد}{العد}{Counting}{Counting}
\aeindex{نتيجة}{نتيجة}{Outcome}{Outcome}
\aeindex{احتمال}{الاحتمال}{Probability}{The Probability}
\aeindex{تباديل}{التباديل}{Permutations}{Permutations}
\aeindex{توافيق}{التوافيق}{Combinations}{Combinations}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   END OF INDEX ENTRIES   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\RTLdblcol
\printindex{dico-ar}{معجم المصطلحات العلمية   المستخدمة في الكتاب}
\LTRdblcol
\printindex{dico-eng}{\hfill\LR{Mathematical terms  used in the book}}
\end{document}


And, from now, the entry "Maximum likelihood estimate" is too long for the line, and to obtain a more beautiful entry, I work with hand on the 'dico-ar.ind" and "dico-eng.ind" of arranged entries, and replaces the entries

\item \idxsechead{مقدر الاحتمال الأعظم\hfill \LR {Maximum likelihood estimate}},
\idxnopage{1}


and

\item \idxsechead{Maximum likelihood estimate\hfill \selectlanguage {arabic}\RL {مقدر الاحتمال الأعظم}\selectlanguage {english}},
\idxnopage{1}


by respectively

\item \idxsechead{\begin{tabular}{b{3.5cm}b{2.5cm}}\LR{Maximum likelihood estimate}&\selectlanguage{arabic} %%% English index
مقدر الاحتمال الأعظم
\selectlanguage{english}
\end{tabular}\hrule\vspace*{5pt}},
\idxnopage{1}

\selectlanguage{arabic}
مقدر الاحتمال الأعظم
&
\selectlanguage{english}Maximum likelihood estimate
\end{tabular}\hrule\vspace*{1pt}},
\idxnopage{1}


we obtain a more acceptable entries, when we recompile the file...

So, I tried to make a macro for doing this automatically... when I implement The command doing exactly what I've make for the example, I obtain the command

\def\aeindex#1#2#3#4{%
\hrule\vspace*{5pt}}|idxnopage}%
}% End of \aeindex...


but, on the compilation, I have the error messages (for each entry), that I absolutely not understand..

! Argument of \reserved@a has an extra }.
<inserted text>
\par
l.85 ...{Multiplication rule}{Multiplication rule}

I've run across a }' that doesn't seem to match anything.....
`