使用 Xelatex 编译时,acro 中的括号反转

使用 Xelatex 编译时,acro 中的括号反转

使用 Xelatex 编译时,acro 中的括号会被反转。

\documentclass[12pt, oneside]{book}
\usepackage[colorlinks]{hyperref}
\usepackage{acro}
\acsetup{
    list/sort = true , % <==============================================
%   page-style = comma , % <========================== removed from acro
%   extra-style = paren , % <========================= removed from acro
%list/display = all,
    make-links = true  % <==============================================
}
\DeclareAcronym{CDMA}{
    short            = CDMA ,
    long             = Code Division Multiple Access ,
    long-plural      = es,
    tag= foo % <========================================================
}
\DeclareAcronym{GSM}{
    short            = GSM ,
    long             = Global System for Mobile communication,
    tag= foo % <========================================================
}
\DeclareAcronym{NA}{
    short            = {\ensuremath{N_{\mathrm{A}}}} ,
    long             = Number of Avogadro ,
    extra            = see \S\ref{Chem} ,
    pdfstring        = NA,
    tag= foo
}
\DeclareAcronym{NAD+}{
    short            = {NAD\textsuperscript{+}} ,
    short-plural     = ,
    long             = Nicotinamide Adenine Dinucleotide ,
    pdfstring        = NAD+ ,
    tag= baz
}
\DeclareAcronym{NUA}{
    short            = NUA ,
    long             = Not Used Acronym,
    tag= baz
}
\DeclareAcronym{TDMA}{
    short            = TDMA ,
    long             = Time Division Multiple Access ,
    long-plural      = es,
    extra = reverse parentheses ,
    tag= baz
}
\DeclareAcronym{UA}{
    short            = UA ,
    long             = Used Acronym,
    tag= baz
}
\DeclareAcronym{lox}{
    short            = {\emph{LOX}} ,
    long             = Liquid Oxygen ,
    pdfstring        = LOX,
    tag= baz
}
\DeclareAcronym{lh2}{
    short            = {\emph{LH\textsubscript{2}}} ,
    long             = Liquid Hydrogen ,
    pdfstring        = LH2,
    tag= baz
}
\DeclareAcronym{IC}{
    short            = IC ,
    long             = Integrated Circuit,
    extra = Blocks Under Test ,
    tag= baz
}
\DeclareAcronym{BUT}{
    short            = BUT ,
    long             = Block Under Test ,
    long-plural-form = Blocks Under Test ,
    extra = Blocks Under Test ,
    tag= baz
}
\usepackage{xepersian}
\settextfont[Scale=1.3]{Amiri}
\setlatintextfont[Scale=1.3]{Arial}
\defpersianfont\Sayeh[Scale=1.5]{Arial}


\begin{document}
\printacronyms[name=Foo,include=foo]
\printacronyms[name=Baz,include=baz]
\newpage
\acs{GSM}
\ac{TDMA}
\acs{GSM}
\ac{CDMA}    
\ac{TDMA}
\ac{GSM} 
\acs{GSM}\ac{GSM}\ac{TDMA}.
\ac{CDMA}\acs{GSM}
 \acs{GSM} \ac{TDMA}
\end{document}

在此处输入图片描述

下一个屏幕截图显示了结果acro v2.11d,RTL 语言中的文本在内extra = ....,\acsetup我想从列表中删除括号。 在此处输入图片描述

 \DeclareAcronym{auc}{
  short = AUC,
  long = Area Under the ROC Curve ,
  %foreign = Geographical Information System ,
  %foreign-lang = english,
  extra = \hfill \rl{المساحة تحت منحنى "روك``},
  class = abbrev
}

答案1

当前acro列表模板在打印额外键之前/之后立即使用括号(例如https://github.com/cgnieder/acro/blob/9a56e414b0eb82ff89241decc66da9620f2292df/code/acro.definitions.code.tex#L195-L216)。这意味着(reverse parentheses)生成了,虽然我不熟悉xepersian/RTL 排版,但问题似乎是它被排版为两部分:(reverse然后parentheses)。如果我们改为插入一个零宽度空格,内容似乎会按正确的顺序排版(括号与额外文本分开显示),我们可以根据现有的

\documentclass{article}
\usepackage{acro}

\NewAcroTemplate[list]{descriptionRTL}{%
\acroheading
\acropreamble
\begin{description}
\acronymsmapF{%
\item[\acrowrite{short}\acroifT{alt}{/\acrowrite{alt}}]
\acrowrite{list}%
\acroifanyT{foreign,extra}{ (\hspace{0pt}}%
\acroifT{foreign}{\acrowrite{foreign}\acroifT{extra}{, }}%
\acroifT{extra}{\acrowrite{extra}}%
\acroifanyT{foreign,extra}{\hspace{0pt})}%
\acropagefill
\acropages
{\acrotranslate{page}\nobreakspace}
{\acrotranslate{pages}\nobreakspace}%
}
{\item\AcroRerun}
\end{description}
}

\acsetup{
list/template=descriptionRTL
}

\DeclareAcronym{TDMA}{
    short            = TDMA ,
    long             = Time Division Access ,
    long-plural      = es,
    %foreign = bar,
    extra = reverse parentheses ,
    tag= baz
}

\usepackage{xepersian}

\settextfont[Scale=1.3]{Amiri}
\setlatintextfont[Scale=1.3]{Arial}
\defpersianfont\Sayeh[Scale=1.5]{Arial}

\begin{document}
\printacronyms

\ac{TDMA}
\end{document}

与普通列表模板相比,唯一的变化description是添加了\hspace{0pt}\acroifanyT{foreign,extra}{ (\hspace{0pt}}%\acroifanyT{foreign,extra}{\hspace{0pt})}%

编译后的文档图像。RTL 格式的文本内容如下:首字母缩略词(反向括号)访问划分时间 TDMA (TDMA) 访问划分时间

可能有更好的方法在xepersian等中进行括号,如果是这样的话,修改列表模板(如上所示)就是在内实现这一点的方法acro

相关内容