我正在使用 TeXworks 的 xepersian 包用波斯语撰写我的博士论文。尝试在论文末尾打印 3 个词汇表时,我遇到了 xindy 问题。更具体地说,在波斯语到英语词汇表中,当我尝试根据波斯语字母对词汇表条目进行分组时,它们没有分组,并且组标题无法正确识别。我对 Latex 还很陌生,可能我错过了一些简单的东西,请帮助我。以下是 MWE:
\documentclass[twoside]{thesis}
\usepackage[xetex,colorlinks,bookmarksnumbered,citecolor=darkred,urlcolor=darkgreen]{hyperref}
\usepackage{multicol}
\usepackage[all]{hypcap}
\usepackage[xindy,nonumberlist=true,nomain]{glossaries}
\usepackage{url}
\usepackage[localise,extrafootnotefeatures]{xepersian}
\usepackage{xifthen}% Provides \isempty test which is used for glossary
\settextfont[Scale=1]{XB Zar}
\setlatintextfont[Scale=1]{Linux Libertine}
\setdigitfont{Yas}
% Glossary
\glsdisablehyper % disable hyperlinks
% ========================================================
% defining styles
\newglossarystyle{persian-to-english}{%
\renewenvironment{theglossary}%
{\begin{multicols}{2}\begingroup \flushright \linespread{1.8}\selectfont}
{\endgroup \end{multicols}}%
\renewcommand*{\glossaryheader}{}%
\renewcommand*{\glsgroupheading}[1]{\begin{RTL} \subsection*{\rl{\glsgetgrouptitle{##1}}} \end{RTL}} %
\renewcommand*{\glsgroupskip}{}%
% \glossaryentryfield{label}{formatted name}{description}{symbol}{number list}
\renewcommand*{\glossaryentryfield}[5]{%
\glstarget{##1}{##2}% persian term
\dotfill%
\space \lr{##3} \\%translation term
}%
\renewcommand*{\glossarysubentryfield}[6]{%
\glossaryentryfield{##2}{##3}{##4}{##5}{##6}%
}%
}
\newglossarystyle{english-to-persian}{%
\renewenvironment{theglossary}%
{\begin{multicols}{2}\begingroup \flushright \linespread{1.8}\selectfont}%
{\endgroup \end{multicols}}%
\renewcommand*{\glossaryheader}{}%
\renewcommand*{\glsgroupheading}[1]{\begin{LTR} \subsection*{\glsgetgrouptitle{##1}} \end{LTR}}
\renewcommand*{\glsgroupskip}{}%
% \glossaryentryfield{label}{formatted name}{description}{symbol}{number list}
\renewcommand*{\glossaryentryfield}[5]{%
\glstarget{##1}{##2}%translation term
\dotfill%
\space \rl{##3} \\%persian term
}%
\renewcommand*{\glossarysubentryfield}[6]{%
\glossaryentryfield{##2}{##3}{##4}{##5}{##6}%
}%
}
\newglossarystyle{abbreviation-list}{%
\renewenvironment{theglossary}{}{}%
\renewcommand*{\glossaryheader}{}%
\renewcommand*{\glsgroupheading}[1]{\begin{LTR} \subsection*{\glsgetgrouptitle{##1}} \end{LTR}}%
\renewcommand*{\glsgroupskip}{\vskip 10mm}%
% \glossaryentryfield{label}{formatted name}{description}{symbol}{number list}
\renewcommand*{\glossaryentryfield}[5]{%
\glstarget{##1}{##3}%translation term
\dotfill%
\space \lr{##2} \\%persian term
}%
\renewcommand*{\glossarysubentryfield}[6]{%
\glossaryentryfield{##2}{##3}{##4}{##5}{##6}%
}%
}
% ========================================================
% defining glossary terms
\newglossary{p2e-terms}{fa.gls}{fa.glo}{واژهنامهی فارسی به انگلیسی} % persian to english
\newglossary{e2p-terms}{en.gls}{en.glo}{واژهنامهی انگلیسی به فارسی} % english to persian
\newglossary{ac-terms}{ac.gls}{ac.glo}{فهرست اختصارات} % abbreviation Glossary
\newcommand{\newterm}[5][]{% params: [key]{persian}{english}{persian-plural}{english-abbreviation}
\ifthenelse{\isempty{#1}}{\def\key{#2}}{\def\key{#1}}%
\newglossaryentry{ac:\key}{type={ac-terms}, name={#3}, description={#5}, sort={#5}}% abbreviation glossary
\newglossaryentry{en:\key}{type={e2p-terms}, name={#3}, description={#2}, sort={#3}}% english glossary
\newglossaryentry{fa:\key}{type={p2e-terms}, name={\rl{#2}}, plural={\rl{#4}}, description={#3}, user1={#5}, sort={#2}}% persian glossary
}
\defglsentryfmt[p2e-terms]{%
\ifdefempty\glsinsert{% use word itself
\ifglsused\glslabel{% subsequent usages
\glsifplural{%
\glscapscase{\glsentryplural{\glslabel}}%
{\Glsentryplural{\glslabel}}%
{\mfirstucMakeUppercase{\glsentryplural{\glslabel}}}%
}%
{%
\glscapscase{\glsentrytext{\glslabel}}%
{\Glsentrytext{\glslabel}}%
{\mfirstucMakeUppercase{\glsentrytext{\glslabel}}}%
}%
}%
{% first usage
\glsifplural{%
\glscapscase{\glsentryfirstplural{\glslabel}}%
{\Glsentryfirstplural{\glslabel}}%
{\mfirstucMakeUppercase{\glsentryfirstplural{\glslabel}}}%
}%
{%
\glscapscase{\glsentryfirst{\glslabel}}%
{\Glsentryfirst{\glslabel}}%
{\mfirstucMakeUppercase{\glsentryfirst{\glslabel}}}%
}%
\space(\lr{\glsentryuseri{\glslabel}\LTRfootnote{\glsentrydesc{\glslabel}}})
}%
}%
{% override word with glsinsert
\ifglsused\glslabel{% subsequent usages
\glsinsert%
}%
{% first usage
\glsinsert\space(\lr{\glsentryuseri{\glslabel}\LTRfootnote{\glsentrydesc{\glslabel}}})
}%
}%
}%
%\term[نمونههای]{key}
\newcommand{\term}[2][]{%
\glsadd{en:#2}%
\glsadd{ac:#2}%
\ifthenelse{\isempty{#1}}{\gls{fa:#2}}{\gls{fa:#2}[#1]}%
}
\newcommand{\termpl}[2][]{%
\glsadd{en:#2}%
\glsadd{ac:#2}%
\ifthenelse{\isempty{#1}}{\glspl{fa:#2}}{\glspl{fa:#2}[#1]}%
}
% ========================================================
% defining \printpersianglossary \printenglishglossary \printabbreviationglossary
\newcommand{\printpersianglossary}[1][واژهنامهی فارسی به انگلیسی]{%
\phantomsection%
\addcontentsline{toc}{chapter}{#1}%
\renewcommand{\glossarymark}[1]{\markboth{##1}}%
\RTLmulticolcolumns%
\printglossary[type={p2e-terms},style={persian-to-english},title={\rl{#1}}]%
}
\newcommand{\printenglishglossary}[1][واژهنامهی انگلیسی به فارسی]{%
\phantomsection%
\addcontentsline{toc}{chapter}{#1}%
\renewcommand{\glossarymark}[1]{\markboth{##1}}%
\begin{latin}%
\LTRmulticolcolumns
\printglossary[type={e2p-terms},style={english-to-persian},title={\rl{#1}}]%
\end{latin}%
}
\newcommand{\printabbreviationglossary}[1][فهرست اختصارات]{%
\phantomsection%
\addcontentsline{toc}{chapter}{#1}%
\renewcommand{\glossarymark}[1]{\markboth{##1}}%
\begin{latin}%
\LTRmulticolcolumns
\printglossary[type={ac-terms},style={abbreviation-list},title={\rl{#1}}]%
\end{latin}%
}
% ========================================================
%
\makeglossaries
\newterm[mac]{لایه کنترل دسترسی}{Medium access control}{}{MAC}
\newterm[wichan]{کانال بیسیم}{Wireless channel}{کانالهای بیسیم}{WiChan}
\newterm[rn]{گره رله}{Relay node}{}{RN}
\begin{document}
به عنوان نمونه ترتیب کلمات زیر در واژهنامه فارسی به انگلیسی درست نیست. اصلاً گروهبندی نمیشوند.
\term{mac}
\term{wichan}
\term{rn}
{%
\cleardoublepage\setlength{\baselineskip}{1cm}\printpersianglossary%
\cleardoublepage\printenglishglossary%
\cleardoublepage\printabbreviationglossary%
}
\end{document}