I produce in the end of a book written in arabic, a Right-To-Left language, two dictionaries of technical terms with their english version, using the glossaries package, one dictionary sorted by its arabic (numbered) entries and the other sorted by the english entries.

I want to make the output of the \gls commands, defined by \defglsentryfmt, as its number in the glossary if it have been used before and in footnote its english translation for the first use. The commands are good at all else if the entries are in boxes like those produced by tcolorbox, where the footnotes are not produced...

I found a solution for this problem (it seems to be!) by using the \ifglsused command, in a special use... Before every box, I set a test number, \TestGlossNumber, to 1, to indicate that the glossary entry will be used in a box and I recall it immediately after the box, then I put the output of the \gls entry under the condition {\TestGlossNumber=1} in the \ifglsused command, and then after the box, I recall the \TestGlossNumber to 0, for remaining the normal conditions..

Here is the .tex file used:


\usepackage{multicol} % Multi-columning
\usepackage[most]{tcolorbox} %So called package for boxing and so...
before=\par\smallskip\centering,width=\textwidth,arc=0pt,outer arc=0pt,#1}% 


%%%%%%%%%%%%%%  Arabic Commands and fonts
\newfontfamily\englishfont[Scale=1]{Times New Roman}
\setmonofont{Courier New}

%%  Horizontal english LTR footnotes with the manyfoot package    
%%%%%%%%%%%%  ENGLISH LTR

%%% The glossaries 
\newglossary[aoc]{ARDico}{aox}{aoo}{\LR{The entries in arabic order}}
\newglossary[eoc]{ENDico}{eox}{eoo}{\LR{The entries in english order}}


        \LR{#2}  \hfill\glsrefentry{adic-#1}
    description={#1  \hfill \LR{#2} \vspace*{2pt}\hrule\vspace*{2pt}}

%%%%%%% The format of the output link   
\ifglsused{\glslabel}%% For the used gls entries
{\ifthenelse{\equal{\TestGlossNumber}{1}}%% For use in a box
{\Footnotetextbox{\value{footnoteC}}{\glsentrytext{\glslabel}}} %% gls Entries in a box.. ifthenelse TRUE
{$^{\textcolor{red}{\glsrefentry{\glslabel}}}$} %% Usual gls entries...  ifthenelse FALSE
{%% For the unused gls entries

\newcommand{\putgls}[1]{\gls{adic-#1}\gls{edic-#1}} %% For calling the gls entries

%%% My glossary own style for writing 2-columns index in left-to-right mode
 \setlength{\parskip}{0pt plus 0.3pt}%


%% Some glossary entries

A first entry\putgls{Aword1}. A second entry\putgls{Aword4}

A first repeated entry\putgls{Aword1}. A second repeated entry\putgls{Aword4}

Another entry\putgls{Aword3}. And another\putgls{Aword2}. 
\vspace*{-\baselineskip} %%% To avoid the vertical space produced by \putgls commands..


And another\putgls{Aword5}. And another\putgls{Aword6}

%%%%        DICTIONARIES

and its compilation, after having produced the glossaries, in command prompt, by the usual commands... enter image description here

My questions are:

1/ Is there a problem for my purpose ? If not, is it the good way to do the job? More precisely, is there a macro doing that in a more elegant way, using the powerfull of the Latex programmation ?

2/ I don't understand whence came the commands \stepcounter{footnoteC} and, after, \addtocounter{footnoteC}{-1}, what I found by "groping"...

3/ Other question. Why the english glossary is opening with "idxitem" ? How can I eliminate it ?

  • Regarding your third question: In the line \let\item\@idxitem, the character @ is no letter, hence the line actually is the let statement \let\item\@ followed by the seven characters idxitem, which then appear in your document. You have to put the command \makeatletterbefore \newglossarystyle{LTRmcolindex} and the command \makeatother after the corresponding closing brace some lines below. Or even better, put all your definitions into a separate file called e.g. mydefs.sty and include it with \usepackage{mydefs} in the preamble. Then you don't need the \makeat... commands. – gernot Sep 5 '16 at 22:00
  • You are right. I tried it and it has good behavior now. Thanks. – Faouzi Bellalouna Sep 5 '16 at 22:06

Your Answer

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

Browse other questions tagged or ask your own question.