在长条目中在从右到左和从左到右的两列之间切换

在长条目中在从右到左和从左到右的两列之间切换

在这里,我给出了使用索引制作英语-阿拉伯语词典的问题的答案,用于一本概率书,感谢这个非常有力的讨论...... 使用 polyglossia 中的 multiind 包在从右到左和从左到右之间切换两列

这个想法是按照阿拉伯语顺序和英语顺序对条目进行排序,然后,根据命令\RTLdblcol(从右到左双列)\LTRdblcol...我们获得了包含阿拉伯语和英语条目的两本词典...

我给出这个例子是为了观察当索引的条目太长时会发生什么(使用文件中的包)...

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

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

 \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.
\newcommand{\idxsechead}[1]{#1\gobble}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
\def\RLarabic#1{\selectlanguage{arabic}\RL{#1}\selectlanguage{english}}

\def\aeindex#1#2#3#4{%
  \index{dico-eng}{#3@\string\idxsechead{#4\hfill\RLarabic{#2}}|idxnopage}%
  \index{dico-ar}{#1@\string\idxsechead{\RLarabic{#2}\hfill\LR{#4}}|idxnopage}%
  }% 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}

并且,从现在起,“最大似然估计”条目太长了,为了获得更漂亮的条目,我手工处理了“dico-ar.ind”和“dico-eng.ind”排列的条目,并替换了条目

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

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

分别

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


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

当我们重新编译文件时,我们获得了更可接受的条目......

因此,我尝试制作一个宏来自动执行此操作...当我执行该命令并按照我为示例所做的操作时,我获得了该命令

\def\aeindex#1#2#3#4{%
  \index{dico-eng}{#3@\string\idxsechead{\begin{tabular}{b{3.5cm}b{2.5cm}}\selectlanguage{english}\LR{#4}&\RLarabic{#2}\end{tabular}
  \hrule\vspace*{5pt}}|idxnopage}%
  \index{dico-ar}{#1@\string\idxsechead{\begin{tabular}{m{3.5cm}m{2.5cm}}   \selectlanguage{arabic}\RLarabic{#2}&\selectlanguage{english}\LR{#4}\end{tabular}\hrule\vspace*{5pt}}|idxnopage}%
      }% End of \aeindex...

但是,在编译时,我收到了错误消息(针对每个条目),我完全不明白。

! 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.....

有人能帮我解决这个问题吗?谢谢。

相关内容