It helps to start with a very simple document and build up from there. I don't have your Hebrew font, so I'm going to use Keter YG instead.
Initial minimal example:
\documentclass{article}
\usepackage{fontspec}
\usepackage{libertine}
\setmainfont[Ligatures=TeX]{Linux Libertine}
\begin{document}
Deutsche
\end{document}
This produces an error:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
!
! The font "Linux Libertine" cannot be found.
!
! See the fontspec documentation for further information.
!
! For immediate help type H <return>.
!...............................................
The font name should be Linux Libertine O
. Once this is fixed, the example compiles fine, so now it can be extended to add Hebrew:
\documentclass{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage{libertine}
\setmainfont[Ligatures=TeX]{Linux Libertine O}
\setmainlanguage{german}
\setotherlanguage{hebrew}
\newfontfamily\hebrewfont[Script=Hebrew]{Keter YG}
\begin{document}
Deutsche
\begin{hebrew}
עִברִית
\end{hebrew}
\end{document}
This compiles fine, so now we can add glossaries
:
\documentclass{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage{libertine}
\setmainfont[Ligatures=TeX]{Linux Libertine O}
\setmainlanguage{german}
\setotherlanguage{hebrew}
\newfontfamily\hebrewfont[Script=Hebrew]{Keter YG}
\usepackage[xindy]{glossaries}
\begin{document}
Deutsche
\begin{hebrew}
עִברִית
\end{hebrew}
\end{document}
Now there's an error:
! LaTeX Error: Unable to properly define \@@leqno; primitive \leqno no longer primitive.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.2568 \@saveprimitive\leqno\@@leqno
The problem here is that glossaries
loads amsmath
but amsmath
expects \leqno
to be a primitive. Unfortunately polyglossia
's hebrew
setting redefines \leqno
so it's no longer a primitive. The simplest workaround is to load amsmath
first. (I'm not sure if this will cause a problem at a later date, but at least it gets rid of this error.)
So the modified example is:
\documentclass{article}
\usepackage{amsmath}
\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage{libertine}
\setmainfont[Ligatures=TeX]{Linux Libertine O}
\setmainlanguage{german}
\setotherlanguage{hebrew}
\newfontfamily\hebrewfont[Script=Hebrew]{Keter YG}
\usepackage[xindy]{glossaries}
\begin{document}
Deutsche
\begin{hebrew}
עִברִית
\end{hebrew}
\end{document}
The previous error has gone but there's another error:
! Package bidi Error: Oops! you have loaded package supertabular after
bidi package. Please load package supertabular before bidi package, and
then try to run xelatex on your document again.
The glossaries
package automatically loads some predefined styles, including the supertabular
styles in glossary-super.sty
. The simplest solution here is to instruct glossaries
to skip glossary-super
with the nosuper
option. There's a similar error for longtable
, which is used by glossary-long
. This can be omitted with nolong
:
\documentclass{article}
\usepackage{amsmath}
\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage{libertine}
\setmainfont[Ligatures=TeX]{Linux Libertine O}
\setmainlanguage{german}
\setotherlanguage{hebrew}
\newfontfamily\hebrewfont[Script=Hebrew]{Keter YG}
\usepackage[xindy,nosuper,nolong]{glossaries}
\begin{document}
Deutsche
\begin{hebrew}
עִברִית
\end{hebrew}
\end{document}
This restricts the available styles to the list and tree styles, but at least the example document now compiles. Since you've used tree
in your question, I'll use that, but if you really want one of the tabular styles then load the relevant tabular package early. For example:
\documentclass{article}
\usepackage{amsmath}
\usepackage{longtable}
\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage{libertine}
\setmainfont[Ligatures=TeX]{Linux Libertine O}
\setmainlanguage{german}
\setotherlanguage{hebrew}
\newfontfamily\hebrewfont[Script=Hebrew]{Keter YG}
\usepackage[xindy,nosuper]{glossaries}
\begin{document}
Deutsche
\begin{hebrew}
עִברִית
\end{hebrew}
\end{document}
Now it's possible to add an example entry and a glossary:
\documentclass{article}
\usepackage{amsmath}
\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage{libertine}
\setmainfont[Ligatures=TeX]{Linux Libertine O}
\setmainlanguage{german}
\setotherlanguage{hebrew}
\newfontfamily\hebrewfont[Script=Hebrew]{Keter YG}
\usepackage[xindy,nosuper,nolong,style=tree]{glossaries}
\makeglossaries
\newglossaryentry{האנאָרים}{name={\RL{האנאָרים}},description={‘Freuden, Vergnügen’, \textit{hannáah}, \textit{hanō-e}}}
\begin{document}
Deutsche
\begin{hebrew}
עִברִית
\gls{האנאָרים}
\end{hebrew}
\printglossaries
\end{document}
This compiles without error but with a warning:
Package glossaries Warning: No language module detected for `hebrew'.
(glossaries) Language modules need to be installed separately.
(glossaries) Please check on CTAN for a bundle called
(glossaries) `glossaries-hebrew' or similar.
The glossaries
package loads tracklang
to determine the document languages. It's picked up two languages: german
and hebrew
. There's support for German (glossaries-german
) but not for Hebrew, which is why there's a warning.
You can either ignore this warning (and supply your own translation) or copy glossaries-german.ldf
to glossaries-hebrew.ldf
and replace all instances of german
with hebrew
and all instances of German
with Hebrew
and replace the German text with the appropriate Hebrew translations.
If the file is called test.tex
then the build process is:
xelatex test
makeglossaries test
xelatex test
If you don't have Perl installed (makeglossaries
is a Perl script), you can use the lightweight Lua version makeglossaries-lite
instead:
xelatex test
makeglossaries-lite test
xelatex test
Both makeglossaries
and makeglossaries-lite
pick up information from the .aux
file, which tells them that the main document language is German, so makeglossaries
does:
xindy -L german -C din5007-utf8 -I xindy -M "test" -t "test.glg" -o "test.gls" "test.glo"
but makeglossaries-lite
isn't quite as clever and misses out the din5007
setting:
"xindy" -I xindy -L german -C utf8 -M "test.xdy" -t "test.glg" -o "test.gls" "test.glo"
So it's better to use makeglossaries
if you can. At this point the document looks like:
I'm guessing that you actually want the glossary sorted according to Hebrew (since the name
contains Hebrew characters). Since this isn't the main document language, you need to instruct makeglossaries
(or makeglossaries-lite
) to pass the hebrew
setting to xindy
. You also need to switch off the creation of the arabic number group. Like this:
\usepackage[xindy={language=hebrew,glsnumbers=false},nosuper,nolong,style=tree]{glossaries}
Now decide is the glossary a Hebrew glossary with German descriptions or a German glossary of Hebrew terms?
In the first case the language needs to be switched when the glossary is displayed. Since there's no Hebrew support for glossaries
, you need to set the title. As I can't speak Hebrew, I've just used Google translate to supply a title. Change it as appropriate. The German description needs to be set in German. This needs a custom style, which can be based on the tree
style. Since this style automatically switches to Hebrew (using the hebrew
environment) there's no need for \RL
in the name. (\gls
is also used in the hebrew
environment.)
\documentclass{article}
\usepackage{amsmath}
\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage{libertine}
\setmainfont[Ligatures=TeX]{Linux Libertine O}
\setmainlanguage{german}
\setotherlanguage{hebrew}
\newfontfamily\hebrewfont[Script=Hebrew]{Keter YG}
\usepackage[xindy={language=hebrew,glsnumbers=false},nosuper,nolong]{glossaries}
\makeglossaries
\newglossarystyle{hebrewgerman}
{% base it on the tree style:
\setglossarystyle{tree}%
% switch to hebrew
\renewenvironment{theglossary}%
{\setlength{\parindent}{0pt}%
\setlength{\parskip}{0pt plus 0.3pt}%
\begin{hebrew}
}%
{\end{hebrew}}%
\renewcommand{\glossentry}[2]{%
\hangindent0pt\relax
\parindent0pt\relax
\glsentryitem{##1}\glstreenamefmt{\glstarget{##1}{\glossentryname{##1}}}%
\ifglshassymbol{##1}{\space(\glossentrysymbol{##1})}{}%
\glstreepredesc
% put description and number list in German
\textgerman{\glossentrydesc{##1}\glspostdescription\space##2}\par
}%
}
\newglossaryentry{האנאָרים}{name={האנאָרים},description={‘Freuden, Vergnügen’, \textit{hannáah}, \textit{hanō-e}}}
\begin{document}
Deutsche
\begin{hebrew}
עִברִית
\gls{האנאָרים}
\end{hebrew}
\printglossary[title={מילון מונחים},style=hebrewgerman]
\end{document}
This produces:
This puts the description and number list in German. You can adapt the style according to your requirements.
If you want the second case, with German as the main language for the glossary, then a similar approach can be used:
\documentclass{article}
\usepackage{amsmath}
\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage{libertine}
\setmainfont[Ligatures=TeX]{Linux Libertine O}
\setmainlanguage{german}
\setotherlanguage{hebrew}
\newfontfamily\hebrewfont[Script=Hebrew]{Keter YG}
\usepackage[xindy={language=hebrew,glsnumbers=false},nosuper,nolong]{glossaries}
\makeglossaries
\newglossarystyle{germanhebrew}
{% base it on the tree style:
\setglossarystyle{tree}%
% switch to german
\renewenvironment{theglossary}%
{\setlength{\parindent}{0pt}%
\setlength{\parskip}{0pt plus 0.3pt}%
\begin{german}
}%
{\end{german}}%
\renewcommand{\glossentry}[2]{%
\hangindent0pt\relax
\parindent0pt\relax
\glsentryitem{##1}\glstreenamefmt{\glstarget{##1}{%
\texthebrew{\glossentryname{##1}}}}%
\ifglshassymbol{##1}{\space(\glossentrysymbol{##1})}{}%
\glstreepredesc\glossentrydesc{##1}\glspostdescription\space##2\par
}%
}
\newglossaryentry{האנאָרים}{name={האנאָרים},description={‘Freuden, Vergnügen’, \textit{hannáah}, \textit{hanō-e}}}
\begin{document}
Deutsche
\begin{hebrew}
עִברִית
\gls{האנאָרים}
\end{hebrew}
\printglossary[style=germanhebrew]
\end{document}
This produces:
There are various ways of integrating makeglossaries
into the build process.
TeXShop
Based on this answer, in order to use makeglossaries
with TeXShop you can create a file containing:
#!/bin/sh
bfname=$(dirname "$1")/"`basename "$1" .tex`"
xelatex "$1"
makeglossaries "$bfname"
xelatex "$1"
xelatex "$1"
Save it as glossaries.engine
and follow the rest of the instructions in the other answer. A better approach is to use arara
, described below.
Arara
Install arara
and add the following lines at the start of the document:
% xelatex
% makeglossaries
% xelatex
If the file is called test.tex
then in the terminal just do
arara test
You can also add arara
to TeXShop using a similar method to the above. Create a file called arara.engine
that contains:
#!/bin/sh
arara "$1"
Make it executable (from the terminal)
chmod a+x arara.engine
Copy or move the file to ~/Library/TeXShop/Engines
cp arara.engine ~/Library/TeXShop/Engines
Restart TeXShop and select arara
from the dropdown list next to the Typeset
button. (If you have a translated version, compare it against the image shown on the TeXShop home page.)
If you then need to add a bibliography, just add
% arara: bibtex
or
% arara: biber
to the comments at the start of the file.
Complete example:
% arara: xelatex
% arara: makeglossaries
% arara: xelatex
% arara: bibtex
% arara: xelatex
% arara: xelatex
\documentclass{article}
\usepackage{amsmath}
\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage{libertine}
\setmainfont[Ligatures=TeX]{Linux Libertine O}
\setmainlanguage{german}
\setotherlanguage{hebrew}
\newfontfamily\hebrewfont[Script=Hebrew]{Keter YG}
\usepackage[xindy={language=hebrew,glsnumbers=false},nosuper,nolong]{glossaries}
\makeglossaries
\newglossarystyle{germanhebrew}
{% base it on the tree style:
\setglossarystyle{tree}%
% switch to german
\renewenvironment{theglossary}%
{\setlength{\parindent}{0pt}%
\setlength{\parskip}{0pt plus 0.3pt}%
\begin{german}
}%
{\end{german}}%
\renewcommand{\glossentry}[2]{%
\hangindent0pt\relax
\parindent0pt\relax
\glsentryitem{##1}\glstreenamefmt{\glstarget{##1}{%
\texthebrew{\glossentryname{##1}}}}%
\ifglshassymbol{##1}{\space(\glossentrysymbol{##1})}{}%
\glstreepredesc\glossentrydesc{##1}\glspostdescription\space##2\par
}%
}
\newglossaryentry{האנאָרים}{name={האנאָרים},description={‘Freuden,
Vergnügen’, \textit{hannáah}, \cite{article-minimal}, \textit{hanō-e}}}
\begin{document}
Deutsche
\begin{hebrew}
עִברִית
\gls{האנאָרים}
\end{hebrew}
\printglossary[style=germanhebrew]
\bibliographystyle{plain}
\bibliography{xampl}
\end{document}
Another option is to use latexmk
. See, for example, How to make Latexmk use makeglossaries? (but make sure you don't use an answer that explicitly calls makeindex
as xindy
is required here).
Make sure you have the latest versions of all the required packages. You can add \listfiles
to the start of your document to show the version numbers and compare them against the versions shown on CTAN.
\documentclass{...}
and ending with\end{document}
.\makenoidxglossaries
. Use\makeglossaries
withxindy
.makeglossaries
script or invokexindy
manually to generate the glossary. Right now, we can't compile your example because we don't haveglossaries.tex
. Is that just the sample glossary entry you gave?There is probably also stuff we don't need in your example.