# Different Font for different Languages (mixed in glossaries)

I want to make a glossarie (using the glossaries-package) from Yiddish words (Hebrew script should be the Ezra SIL-font) from a main text. The description will be in German (Latin script = Linux Libertine). I have tried \begin{hebrew} … \end{hebrew} but it doesn't word (and makes the dokument bloated). Any suggestions? A glossarie entry looks like this:

\newglossaryentry{האנאָרים}{name={\RL{האנאָרים}},description={‘Freuden, Vergnügen’, \textit{hannáah} \parencite[90]{Tendlau1860}, \textit{hanō-e}}}


I hope it is not too messy:

\documentclass[10pt,a5paper,twoside]{scrbook}
\usepackage[onehalfspacing]{setspace}

\usepackage[bmargin=2.25cm]{geometry}

\usepackage{scrpage2}

\setkomafont{disposition}{\normalcolor\bfseries}

\clubpenalty=10000
\widowpenalty=10000

\usepackage{color}
\usepackage{times,multicol,multirow, bigdelim}

%%%FONTS AND LANGUAGES

\usepackage{fontspec}

\usepackage{libertine}
\setmainfont[Ligatures=TeX]{Linux Libertine}
\setmainlanguage{german}
\setotherlanguage{hebrew}
\newfontfamily\hebrewfont[Script=Hebrew]{Ezra SIL}

\usepackage{metalogo,hyperref}
\usepackage{polyglossia, xunicode}
\usepackage[parfill]{parskip}
\usepackage[series={A,B,C}]{reledmac}
\usepackage{reledpar}

\setgoalfraction{0.85}

\lineation{section}
\linenummargin{right}
%\setRlineflag{}

\linenumincrement*{5}
\firstlinenum*{0}
\maxchunks{10000}

%START GLOSSAR%%%%%%%%%%%%%%%
\usepackage[xindy]{glossaries}
\makenoidxglossaries
\input{glossaries.tex}
\setglossarystyle{tree}
%END GLOSSAR%%%%%%%%%%%%%%

\Xendbeforepagenumber{S.\,}
\Xendafterpagenumber{:\,}
\Xendlineprefixsingle{Z.\,}

\renewcommand{\thefootnoteA}{\fnsymbol{footnoteA}}

\newcommand\einzugjid{\hangindent=5mm\hangafter=1}

\newcommand\speaker[1]{\noindent{#1} \einzugjid
}

\newcommand\einzug{\hangindent=5mm\hangafter=1}

\newcommand\speakerd[1]{\noindent
{\textsc{#1}} \einzug
}

\usepackage[normalem]{ulem}

\usepackage{csquotes}
\usepackage[style=authoryear,language=ngerman]{biblatex} \bibliography{LitGrobsdorfEdition}
\DeclareFieldFormat{postnote}{#1}
\DeclareFieldFormat{multipostnote}{#1}

\begin{document}

\begin{pages}
\begin{Leftside}\begin{hebrew}
\setRTL
\beginnumbering

\pstart     {\RL{\speaker{יוקב.}
געלטע דאָס גִיט אָבער לאָסטיג
\edgls{האנאָרים}
?}}  \pend

\pstart  {\RL{\speaker{בויער.}
יאָ, דאָס גלעב אייך. הויא פערדיענסט דוא אַהך ניט פֵֿיעל. }}
\pend

\pstart   {\RL{\speaker{יוקב.}
פֿערדיענט אייכס דאָך אין אַה פֿירטעל יאָהר, וואָהס מייכ‘ס הויא    און מאָר קאָסט.
\textit{)}\textit{זייפצט}.\textit{(}
}} \pend

\endnumbering
\end{hebrew}
\end{Leftside}

\begin{Rightside}

\beginnumbering

\pstart  \speakerd{Person1.} {Gell}, Text…?  \pend

\pstart   \speakerd{Person 2.} Text…  \pend

\pstart    \speakerd{Person1.} Text…. \textit{(Seufzt.)} \pend

\endnumbering

\end{Rightside}

\end{pages}
\Pages

\printnoidxglossaries

\end{document}

• It would be great if I could set in the preamble which font to use for which language (if Latex can recognize what is hebrew and what latin…) Jul 28, 2017 at 21:04
• Please provide a complete example. Try to use a standard font. If that's not possible and the question requires a specific font (is font-dependent), provide a link, if possible. Otherwise, be clear about what is needed as your question will only be answerable by those with the commercial font in question.
– cfr
Jul 28, 2017 at 21:49
• You have clearly tried something and found that it doesn't work. Do you mind sharing that with us in a minimal (!) working example (MWE) that illustrates your problem? Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
– Troy
Jul 29, 2017 at 3:30
• If you're not using ASCII absolute don't use \makenoidxglossaries. Use \makeglossaries with xindy. Jul 29, 2017 at 13:24
• You need to run the makeglossaries script or invoke xindy manually to generate the glossary. Right now, we can't compile your example because we don't have glossaries.tex. Is that just the sample glossary entry you gave?There is probably also stuff we don't need in your example.
– cfr
Jul 29, 2017 at 22:37

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

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

• any idea how I can get the line numbers in the glossaries using reledpar (\lineation{section})? using \edgls doesn't work here Aug 16, 2017 at 15:35
• The answer: \usepackage[xindy={language=hebrew,glsnumbers=false},counter=pageline,nosuper,nolong]{glossaries} \glsSetCompositor{–}% Use - as separator \pretocmd{\gls}{\doedindexlabel}{}{}% Call \doedindexlabel at the begining of \gls Aug 16, 2017 at 16:32
• @לאהפּאַסטעך I don't recommended patching \gls. It's better to redefine \glslinkpostsetkeys instead. (\renewcommand{\glslinkpostsetkeys}{\doedindexlabel} or \appto\glslinkpostsetkeys{\doedindexlabel}) That way it will apply to all the indexing commands, such as \glspl, \Gls, \glsdisp, \glslink. Aug 17, 2017 at 9:48
• and how will I get the linenumbers with \glspl, \Gls, \glsdisp, \glslink? Aug 17, 2017 at 15:34
• @לאהפּאַסטעך I think it would be better to ask as a follow-up question with the MWE adapted to include reledpar. Aug 17, 2017 at 16:06