嵌套括号 - 缩写包

嵌套括号 - 缩写包

我正在使用首字母缩略词包进行翻译,但遇到了嵌套括号问题。

代码:

 \usepackage[printonlyused, withpage]{acronym}
 \acro{RTS}{Real-Time Systems}
    
 Sistemas de tempo real (\ac{RTS}) 

PDF(页码完美地出现在首字母缩略词列表中):

Sistemas de tempo real (Real-Time Systems (RTS))

有没有办法用“-”替换括号,以便最终的文本如下所示,并且页码仍在首字母缩略词列表中引用?

实时系统 (RTS)

我把文本翻倍并尝试了 \acf。最终文本没问题,但它会从首字母缩略词列表中删除页码。

代码:

\usepackage[printonlyused, withpage]{acronym} %adiciona lista de acrônimos.
\acro{RTS}{\textit{Real-Time System}}

Sistemas de tempo real (\textit{Real-Time Systems} - \acf{RTS}) 

PDF(页码未出现在首字母缩略词列表中):

Sistemas de tempo real (Real-Time Systems - RTS)

有什么提示吗?

谢谢

答案1

是的,但是它并不漂亮,并且重新定义了所有首字母缩略词的第一样式。

\documentclass{article}
\usepackage[printonlyused, withpage]{acronym}

\makeatletter
\renewcommand*{\@acf}[2][\AC@linebreakpenalty]{%
  \ifAC@footnote
    \acsfont{\AC@acs{#2}}%
    \footnote{\AC@placelabel{#2}\AC@acl{#2}{}}%
  \else
    \acffont{%
      \AC@placelabel{#2}\AC@acl{#2}%
      \nolinebreak[#1] --\nolinebreak[#1] %
      \acfsfont{\acsfont{\AC@acs{#2}}}%
    }%
  \fi
  \ifAC@starred\else\AC@logged{#2}\fi
}
\renewcommand*{\@Acf}[2][\AC@linebreakpenalty]{%
  \ifAC@footnote
    \acsfont{\AC@acs{#2}}%
    \footnote{\AC@placelabel{#2}\AC@Acl{#2}{}}%
    \else
    \acffont{%
      \AC@placelabel{#2}\AC@Acl{#2}%
      \nolinebreak[#1] --\nolinebreak[#1] %
      \acfsfont{\acsfont{\AC@acs{#2}}}%
    }%
  \fi
  \ifAC@starred\else\AC@logged{#2}\fi
}
\makeatother

\begin{document}
\begin{acronym}
\acro{RTS}{Real-Time Systems}
\end{acronym}

Sistemas de tempo real (\ac{RTS}) 

\end{document}

实时系统 (RTS)

acro它好多了,您可以在用户级别定义新的样式并在本地和全局设置它们,或者定义新的\ac类型命令。

\documentclass{article}
\usepackage{acro}

\DeclareAcronym{RTS}{
  short = RTS,
  long = Real-Time Systems,
  first-style = long-short-dashed
}
\DeclareAcronym{CD}{
  short = CD,
  long = compact disc,
}

\NewAcroTemplate{long-short-dashed}{%
\acroiffirstTF{%
  \acrowrite{long}%
    \acspace--\acspace%
    \acroifT{foreign}{\acrowrite{foreign}, }%
    \acrowrite{short}%
    \acroifT{alt}{ \acrotranslate{or} \acrowrite{alt}}%
    \acrogroupcite
  }%
  {\acrowrite{short}}%
}

\NewAcroCommand{\acd}{m}{\UseAcroTemplate{long-short-dashed}{#1}}

\begin{document}
\printacronyms[pages={display=all}]

Sistemas de tempo real (\ac*{RTS}) 

\ac{CD}\acreset{CD}

\acd*{CD}

\acsetup{first-style=long-short-dashed}
\ac{CD}

\end{document}

Sistemas de tempo real (实时系统) 光盘 (CD) 光盘 – CD 光盘 – CD

最重要的是,acro内置对foreign首字母缩略词的支持

\documentclass{article}
\usepackage{acro}

\DeclareAcronym{RTS}{
  short = RTS,
  long = sistemas de tempo real,
  foreign = Real-Time Systems,
}

\begin{document}
\printacronyms[pages={display=all}]

\Ac{RTS}

\end{document}

实时系统 (Real-Time Systems, RTS)

这似乎就是你想要做的,我们可以将样式改为破折号

\RenewAcroTemplate{long-short}{%
\acroiffirstTF{%
  \acrowrite{long}%
    \acspace(%
      \acroifT{foreign}{\acrowrite{foreign} -- }%
      \acrowrite{short}%
      \acroifT{alt}{ \acrotranslate{or} \acrowrite{alt}}%
      \acrogroupcite
    )
  }%
  {\acrowrite{short}}%
}

实时系统 (RTS)

相关内容