I'm trying to typeset a dictionnary, using Arabic script. I would like to create a list of words in three columns, with Arabic word in right column aligned to the right, its Polish translation aligned to the left and transcripion in italic aligned to the left. In none of this columns there would be a lot of text. I can do it with \tabular, but in this case I have to sort manually the alphabetic order. I'd like the dictionary to be sorted by Arabic words.

I've found this thread, which helped me to start, but unfortunately I'm not able to adapt it to my needs. Most important problem is sorting, since the only way I'm able to use this code is when the list is sorted by words in latin script. If I don't manage to get third column for translation, it would be lesser problem. (Well, would be also nice to get rid of the dot in each line:))

1st When I compile this:




\setmainfont[Ligatures=TeX]{Linux Libertine O}

\dictentry{on}{\textarabic{هو}} %
\dictentry{ja}{\textarabic{انا}} %
\dictentry{pies}{\textarabic{كلب}} %


the dictionary is sorted by first column, the Polish one.

2nd If I swich the arguments (to make tranlation being definition of Arabic word: \dictentry{\textarabic{هو}}{on}%) I'm getting folowing error:

! Missing \endcsname inserted.
<to be read again> 
l.23 \dictentry{\textarabic{هو}}{on}

3rd I was also trying putting everything in \begin{Arabic} environement. Then the sorting is fine but in the output there were some black squares in place of Arabic words.

Reading the documentation I've found out that makeindex is a good tool for latin script and other alphabets require xindy. After I've found in xindy documentation, that Arabic script is not supported, and after I've found also on this site a following thread, so it seems that creating a list sorted by Arabic word should be possible.

I don't have to typeset this dictionary with glossaries, if there is any other tool which fits better for it. For the moment the only sorting tool I've found I could use for Arabic was make index, but it creates an index and not dictionary.


Since I don't know where the problem may lay, I'm adding some information that might (or not) be relevant.

I'm using LaTeX on OS X 10.8.2. Since it looks like xindy can't only display arabic font, but it's able to sort it in a correct order, I've checked the content of /usr/local/texlive/2012/texmf/xindy/modules/lang/ where indeed there is no arabic. Still the sorting in my 3rd attempt was fine. (Another problem with \begin{Arabic} environement is that Arabic language column is on the left in the output, not on the right).


Here is a pdf showing one page of my dictionary, made using supertabular and sorted manually.

  • Maria, I suggest you split this question into two, and first try to focus on the sorting issue. Check if you can't isolate the sorting code the glossaries use. If you can, ask a question about just that code. If you can solve that you can probably hack the glossaries code to do your bidding. – einpoklum Dec 10 '12 at 9:01
  • @einpoklum Thanks a lot for your advice. Could you, please, explain a bit more what do you mean by Check if you can't isolate the sorting code the glossaries use? Asking my question I was feeling that probably there is more than one problem in one question, but I didn't want to make people thinking about a solution for me which wouldn't be the solution for my real problem. I hope I'm clear, my English is far from being perfect... – maria Dec 10 '12 at 14:05
  • Sorry for the late reply... the glossaries class is, well a bunch of files with LaTeX code. Some of it does the entry sorting. If you can look through the source you might be able to find the code which, separated from the rest of the class, sorts any sorts of entries you feed it. And even if you can't separate it yourself it might be useful to ask about it. Also, sometime you can split a problem into simpler sub-problems you can ask people about here, the combine the solutions into what you need or alternatively ask an integration question which refes to the other individual question pages. – einpoklum Dec 24 '12 at 11:45

The dot can be removed using the glossaries package option nopostdot. The Missing \endcsname inserted error is because you're trying to use \textarabic{...} as a label, but the label must be plain text. I don't have the required fonts installed, so I can't fully test it, but try the following:






\setmainfont[Ligatures=TeX]{Linux Libertine O}

  \glossarystyle{super}% base this style on 'super'
     \begin{supertabular}{ll}}% adjust column specifiers
  % switch name and description columns:
    \glsentryitem{##1}\glstarget{##1}{##3} & ##2\\}%



This switches the arguments round in \dictentry but also adds an optional argument that can be used to override the default label.

Edit: I've added the definition of the new style RLsuper. The reason for the double hashes ## is because this is a macro definition within a macro definition. I've adjusted the column specifiers at the start of the supertabular environment since the original specifiers used by the super style aren't really appropriate for a bilingual dictionary. With this new style, I've removed the reference to the location list and the post description terminator, so the package options nopostdot and nonumberlist are no longer needed.

| improve this answer | |
  • Thanks a lot! I've tried your code, is better now, the list is sorted by Arabic words and there is no dot. But still it's not what I need really, since Arabic column is on the left (and aligned to the left), which doesn't make sens in a dictionary of a language written form right to left. I'd like to try to improve it by myself, I guess I should work around `\newcommand{\dictenry} part, if you could advice me where I can find some explanation of how to use it, it would be great. I can imagine it should be hard to work on a code you're not able to use to check it's result. Thanks! – maria Dec 10 '12 at 14:14
  • @maria I suggest you define your own glossary style that puts the description in the left column and the name in the right column. (See the section "Defining your own glossary style" in the user manual.) Then use that style instead of super when you print the glossary. – Nicola Talbot Dec 10 '12 at 16:20
  • Thanks. I was trying to do it before posting my question, unfortunately it seems that the package is quite complex for me. If I'm not wrong, I should modify \glossarysubentryfield to switch the order, but I don't understand why in the example (p.126) there are 5 ## fields definiton and in the last line there is \glossaryentryfield{##2}{##3}{##4}{##5}{##6}? – maria Dec 10 '12 at 16:41
  • @maria I've edited the example to provide a new style. – Nicola Talbot Dec 10 '12 at 20:09
  • Thanks a lot. I've changed \begin{supertabular}{ll}} to \begin{supertabular}{lr}}, so the column with Arabic is aligned to the right. I hope that with the help of your examples it will be easier for me to understand how does it work. – maria Dec 10 '12 at 20:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.