如何在 acro 中添加外语翻译的缩写?

如何在 acro 中添加外语翻译的缩写?

acro包中,我可以通过如下方式添加foreign长格式的翻译:foreign

\DeclareAcronym{dsgvo}{
    short = DSGVO,
    long = {Datenschutzgrundverordnung}
    foreign = \enquote{General Data Protection Regulation},
    foreign-lang = english
}

这会产生如下“词汇表”条目:

欧盟数据保护条例Datenschutz-Grundverordnung(“通用数据保护条例”),第 4 条

不过,我还想为(英语)翻译添加缩写,即首字母缩略词,即我想做这样的事情:

\DeclareAcronym{dsgvo}{
    short = DSGVO,
    long = {Datenschutz-Grundverordnung},
    foreign = \enquote{General Data Protection Regulation},
    foreign-short = GDPR, % new line
    foreign-lang = english,
}

这可能吗?如果可以,怎么做?

最后,我想要一个这样的条目:

欧盟数据保护条例Datenschutz-Grundverordnung(“通用数据保护条例”,GDPR),第 4 条

其在内联条目中的提及方式也是相同的。

答案1

编辑答案,v3 的解决方案acro

从版本 3 开始acro您可以添加首字母缩写词属性:

\DeclareAcroProperty{foreign-short}

它可以像任何其他属性一样使用:

\DeclareAcronym{dsgvo}{
  short = DSGVO,
  long = {Datenschutz-Grundverordnung},
  foreign = General Data Protection Regulation ,
  foreign-short = GDPR, % new line
  foreign-babel = english,
  foreign-format = \enquote
}

当然这还不够。为了在列表中打印新属性,您需要更改其模板(或完全创建一个新模板):

\RenewAcroTemplate[list]{description}{%
  \acroheading
  \acropreamble
  \begin{description}
    \acronymsmapF{
      \item [\acrowrite{short}\acroifT{alt}{/\acrowrite{alt}}]
        \acrowrite{long}%
        \acroifanyT{foreign,extra,foreign-short}{ (}%
        \acrowrite{foreign}%
        \acroifallT{foreign-short,foreign}{, }%
        \acrowrite{foreign-short}%
        \acroifanyT{foreign-short,foreign}{\acroifT{extra}{, }}%
        \acrowrite{extra}%
        \acroifanyT{foreign,extra,foreign-short}{)}%
        \acroifpagesT{%
          \acropagefill
          \acropages
            {\acrotranslate{page}\nobreakspace}%
            {\acrotranslate{pages}\nobreakspace}%
        }%
    }
    { \item \AcroRerun }
  \end {description}
}

如果您还想以首字母缩略词的第一个/完整形式使用它,那么您也需要更改它的模板:

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

这是一个完整的例子:

\documentclass{article}
\usepackage[english,ngerman]{babel}
\usepackage{csquotes}
\usepackage{acro}

\DeclareAcroProperty{foreign-short}

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

\RenewAcroTemplate[list]{description}{%
  \acroheading
  \acropreamble
  \begin{description}
    \acronymsmapF{
      \item [\acrowrite{short}\acroifT{alt}{/\acrowrite{alt}}]
        \acrowrite{long}%
        \acroifanyT{foreign,extra,foreign-short}{ (}%
        \acrowrite{foreign}%
        \acroifallT{foreign-short,foreign}{, }%
        \acrowrite{foreign-short}%
        \acroifanyT{foreign-short,foreign}{\acroifT{extra}{, }}%
        \acrowrite{extra}%
        \acroifanyT{foreign,extra,foreign-short}{)}%
        \acroifpagesT{%
          \acropagefill
          \acropages
            {\acrotranslate{page}\nobreakspace}%
            {\acrotranslate{pages}\nobreakspace}%
        }%
    }
    { \item \AcroRerun }
  \end {description}
}

\DeclareAcronym{dsgvo}{
  short = DSGVO,
  long = {Datenschutz-Grundverordnung},
  foreign = General Data Protection Regulation ,
  foreign-short = GDPR, % new line
  foreign-babel = english,
  foreign-format = \enquote
}

\begin{document}

\ac{dsgvo}

\printacronyms

\end{document}

在此处输入图片描述


原始答案,v2 的解决方案acro

您可以使用该extra属性。只需稍微调整一下样式,结果就会接近您想要的效果。精确的结果会更加复杂:

\documentclass{article}
\usepackage[main=ngerman,english]{babel}
\usepackage{csquotes}
\usepackage{acro}

\acsetup{
  foreign-format = \enquote ,
  list-foreign-format = \enquote ,
  % list-style = description , % default
  extra-style = paren ,
  page-style = comma ,
  pages = first
}

\DeclareAcroListStyle{description}{list}{
  foreign-sep = {, }
}

\shorthandon{"}

\DeclareAcronym{dsgvo}{
  short   = DSGVO,
  long    = {Datenschutz"=Grundverordnung} ,
  foreign = General Data Protection Regulation ,
  extra = GDPR ,
  foreign-lang = english
}

\begin{document}

\ac{dsgvo}

\printacronyms

\end{document}

在此处输入图片描述


目前尚不存在真正的foreign-short属性。但对我来说,这听起来像是一个合理的功能请求。欢迎随时在https://bitbucket.org/cgnieder/acro/issues/new也许与这个问题有关。

相关内容