我想在 Acro 包中使用波斯语或希伯来语和英语,但这样不太方便,而且对于首字母缩略词列表,我希望它能放在同一行。
%!TEX program = xelatex
\documentclass[12pt,a4paper, openany, notoc]{report}
\usepackage{ptext}
\usepackage{tocloft}
\usepackage[Kashida]{xepersian}
\settextfont[Scale=.8]{Arial}
\setlatintextfont[Scale=.8]{Arial}
\defpersianfont\Sayeh[Scale=1.5]{Arial}
\usepackage{acro}
\acsetup{
only-used = false,
first-style=default,%
hyperref =true,
%list-heading = section,
group-citation = true,
label = true,
only-used = false,
%short-format = {\scshape},
extra-style = default,
%page-style = comma ,%show linked pages but with a problem in arabic
sort = true ,
list-style = longtable-rev
}
\DeclareAcronym{rs}{
short = RS,
long = Remote Sensing ,
foreign = \rl{الاستشعار عن بعد} ,
%foreign-lang = Persian,
%extra = \begin{RTL} \rl{الاستشعار عن بعد} \end{RTL},
class = abbrev
}
\DeclareAcronym{gis}{
short = GIS,
long = Geographical Information Systems,
foreign = \rl{نظم المعلومات الجغرافية} ,
%foreign-lang = english,
%extra = \begin{RTL} \rl{نظم المعلومات الجغرافية} \end{RTL} ,
%foreign = \rl{نظم المعلومات الجغرافية} ,
class = abbrev
}
\begin{document}
\begin{LTR}
\makeatletter
\renewenvironment{description}%
{\list{}{\leftmargin=0pt
\labelwidth\z@ \itemindent-\leftmargin
\let\makelabel\descriptionlabel}}%
{\endlist}
\makeatother
\begin{description}
\printacronyms[include-classes=abbrev, name={Acronyms}]
\end{description}
\end{LTR}
\lr{text example}\\
\lr{\ac{rs}}\\
\lr{\ac{gis}}
\end{document}
答案1
您似乎正在使用旧版本的acro
。使用版本 3 语法和babel
LuaLaTeX,您可以定义acro
具有所需格式的新模板。
extra
例如,如果您需要将信息插入首字母缩略词列表,则需要进一步调整它。
%!TEX program = lualatex
\documentclass[12pt,a4paper, openany, notoc]{report}
\tracinglostchars=2
\usepackage[bidi=basic, layout=sectioning.tabular, english]{babel}
\usepackage{ptext}
\usepackage{tocloft}
\usepackage[version=3]{acro}
\usepackage{unicode-math}
\babelprovide[import=fa, onchar=ids fonts]{persian} % You can also call this farsi, or something else.
\defaultfontfeatures{ Scale=MatchLowercase,
Ligatures=TeX,
Renderer = HarfBuzz }
\babelfont{rm}
[Ligatures={Common,Rare}, Scale=1.0]{Libertinus Serif}
\babelfont{sf}
[Ligatures={Common,Rare}]{Libertinus Sans}
\babelfont{tt}
{Libertinus Mono}
\babelfont[persian]{rm}
{Amiri}
% Set \babelfont[persian]{sf} here, if needed.
\babelfont[persian]{tt}
{ALM Fixed}
\setmathfont{Libertinus Math}
\NewAcroTemplate{custom-inline}{%
\begin{otherlanguage}{english}%
\acrowrite{long}%
\acspace%
(\acrowrite{short}%
\acroifT{alt}{ \acrotranslate{or} \acrowrite{alt}}%
)%
\acroifT{foreign}{\acspace\acrowrite{foreign}}%
\end{otherlanguage}%
}
\NewAcroTemplate[list]{custom-description}{%
\acroheading%
\acropreamble%
\begin{description}
\acronymsmapF{%
\begin{otherlanguage}{english}
\item[\acrowrite{short}\acroifT{alt}{/\acrowrite{alt}}]
\acrowrite{list}%
\acroifT{foreign}{\hfill\acrowrite{foreign}}%
\end{otherlanguage}
}%
{\item\AcroRerun}
\end{description}
}
\acsetup{
list/template=custom-description,
list/sort=true,
list/display=used,
list/include=abbrev,
foreign/display=true,
make-links=true,
first-style=custom-inline,
subsequent-style=custom-inline
}
\DeclareAcronym{rs}{
short = RS,
long = Remote Sensing ,
foreign = {الاستشعار عن بعد} ,
foreign-babel = persian,
tag = abbrev
}
\DeclareAcronym{gis}{
short = GIS,
long = Geographical Information Systems,
foreign = {نظم المعلومات الجغرافية} ,
foreign-babel = persian,
tag = abbrev
}
\begin{document}
\printacronyms[name={Abbreviations}, include=abbrev]
{text example}\\
{\ac{rs}}\\
{\ac{gis}}
\end{document}
您可以使用任何系统或 OpenType 字体代替 Libertinus 和 Amiri;这些只是示例。要使用波斯语作为主要语言,请将其添加到main
的选项列表中\babelprovide[import=fa, main, onchar=ids fonts]{persian}
。要支持希伯来语,请添加\babelprovide[import=he, onchar=ids fonts]{hebrew}
,并可能定义\babelfont[hebrew]{rm}
,等等。
要继续在 XeLaTeX 中进行编译,请删除onchar=ids fonts
选项、Renderer=HarfBuzz
选项,然后更改bidi=basic
为bidi=default
。您将无法输入阿拉伯语或希伯来语文字,并且 Babel 会自动检测语言、更改方向和字体。