# Creating left to right and right to left dictionaries using Glossaries package

I want to produce two bilingual dictionaries Arabic-English and English-Arabic. I've found this discussion which seems of some interest for my needs... So I build this file, based on it

\documentclass[twocolumn]{article}
\usepackage{fontspec}
\usepackage{polyglossia}

\newcommand*{\glossaryname}{Dictionary}

\usepackage[nonumberlist,nopostdot,xindy]{glossaries}

\newcommand{\dictentry}[3][\dictlabel]{%
\def\dictlabel{#2}%
\newglossaryentry{#1}{name=#3,description={#2}}%
}

\makeglossaries

\setmainlanguage{english}
\setotherlanguage[locale=mashriq]{arabic}
\setmainfont[Ligatures=TeX]{Linux Libertine O}

\newglossarystyle{RLsuper}{%
\glossarystyle{super}% base this style on 'super'
\renewenvironment{theglossary}%
{\end{supertabular}}%
% switch name and description columns:
\renewcommand*{\glossaryentryfield}[5]{%
\glsentryitem{##1}\glstarget{##1}{##3} & ##2\\}%
}

\begin{document}
%%% ENTRIES %%%%%%%%%%%
\dictentry{on}{\textarabic{هو}}%
\dictentry{ja}{\textarabic{انا}}%
\dictentry{pies}{\textarabic{كلب}}%
\dictentry{Dice}{\textarabic{زهرة نرد}}%
\dictentry{Commutative laws}{\textarabic{قوانين إبدالية}}%
\dictentry{Maximum likelihood estimate}{\textarabic{مقدر الاحتمال الأعظم}}%

\RTLdblcol
\printglossary[style=RLsuper]%

\end{document}


which gave on the first compilation a good pdf file (what I can't add to discussion because I don't know how!)...

But when I copy this file and create another file which is strictly the same, for a second try, the compilation gave me a blank pdf file... An empty file... So my questions are:

1. What happens between the two compilations?
2. I want to create two dictionaries, one sorted in Arabic order, and the same dictionary but sorted in the English alphabet order, how can I do this?
3. For long entries like "Maximum likelihood estimate", can I split the glossary output in two lines (produced by macros like this, based on something like \begin{tabular} m{2.5cm}m{2.5cm}} \end{tabular} for example...
4. A question which seems simple, but of interest for me... How can I insert things like rules for example between the entries... exactly \hrule\hrule...

I can't try it because it doesn't compile! More generally, where are stocked the entries after sorting? How can I do small changes on it directly?

• Try moving your definitions into the preamble. The first LaTeX run will produce an empty document since the document only contains the glossary which doesn't exist yet. You then need to run makeglossaries which should create the associated file that will be inserted into the document on the next LaTeX run. Aug 12, 2014 at 17:07
• I don't understand what you mean by "preamble"... If it's what is before \begin{document}, it's the case... Aug 12, 2014 at 19:07
• Other thing... I think that running makeglossaries is automatic... If it's not the case, what are the good commands? Aug 12, 2014 at 19:09
• I meant your entry definitions. Your \dictentry commands are in the document environment and since they use \newglossaryentry, this means you're defining entries in the document environment not in the preamble. Use \GlsSetXdyLanguage (described in Language and Encodings in the user manual) to set a different language for each glossary. You can check if makeglossaries ran correctly by looking for the log file .glg. Aug 13, 2014 at 10:46
• The glossaries package comes with a sample file that has English and French dictionaries (The source is sample-lang.tex and the corresponding PDF is sample-langdict.pdf.) You may be able to adapt that code for your example. Aug 13, 2014 at 10:49