9

I am currently using the acronym package to handle acronyms/abbreviations in my thesis.

I am writing in German, but I use a couple of English acronyms because either no German acronym exists or the English one simply more commonly used. So when introducing the acronym, I want/need to use the German word in text (as "long" form) but I want to include the English long form in parentheses alongside the (English) acronym. And of course, both German and English should show up in the list of acronyms.

  • German Term: Steuergerät
  • English Term: Electronic Control Unit
  • Acronym: ECU

So in my text I'd like to have:

.... Steuergerät( Electronic Control Unit, ECU) ....

and later simply have

.... ECU ....

In the list of acronyms, it should show up as:

ECU Steuergerät (Electronic Control Unit)

or

ECU Electronic Control Unit (Steuergerät)

Is there a way to include a translation in the long version of an acronym?

EDIT: As pointed out by @NicolaTalbot, the use case is the same than Using the glossaries package for English acronyms in German documents. Is there a way to achieve this with the acronym package as well or do I need to switch packages?

1 Answers1

8

As I already said in the comments: acro provides the foreign key for cases like this. Nonetheless: here is a way to achieve what you want with acronym. The usage is similar to acronym's \acroextra. The code below defines a command \acroforeign{<foreign long form>} that is to be placed inside the second mandatory argument of \acro:

enter image description here

\documentclass{article}
\usepackage{acronym}

% provides \AtBeginEnvironment, \patchcmd and \csdef: \usepackage{etoolbox}

\makeatletter \newcommand{\acroforeign}[1]{}

% patch the environment to print the foreign definition: \AtBeginEnvironment{acronym}{% \def\acroforeign#1{ (#1)}% }

% patch the acronym definition to safe the foreign definition: \expandafter\patchcmd\csname AC@\AC@prefix{}@acro\endcsname {\begingroup} {\begingroup\def\acroforeign##1{\csdef{ac@#1@foreign}{##1, }}} {} {\fail}

% % renew the first output to include the foreign definition if given: \renewcommand*{@acf}[2][\AC@linebreakpenalty]{% \ifAC@footnote \acsfont{\csname ac@#2@foreign\endcsname\AC@acs{#2}}% \footnote{\AC@placelabel{#2}\AC@acl{#2}{}}% \else \acffont{% \AC@placelabel{#2}\AC@acl{#2}% \nolinebreak[#1] % \acfsfont{(\acsfont{\csname ac@#2@foreign\endcsname\AC@acs{#2}})}% }% \fi \ifAC@starred\else\AC@logged{#2}\fi } \makeatother

\begin{document}

First: \ac{ECU}, \ac{BW}

Subsequent: \ac{ECU}, \ac{BW}

List: \begin{acronym}[ECU] \acro{ECU}{Steuerger&quot;at\acroforeign{Electronic Control Unit}} \acro{BW}{Baden-W&quot;urttemberg} \end{acronym}

\end{document}

cgnieder
  • 66,645
  • 2
    The acro package is working great. – Johannes S. Sep 30 '13 at 13:53
  • I am getting the error "Something's wrong--perhaps a missing \item. \end{acronym}" after copy and pasting cgnieders approach. Do you have any ideas, what I am doing wrong? – LN-12 Aug 25 '20 at 08:36
  • 1
    @LN-12 my answer was outdated. I added an updated version. – cgnieder Aug 26 '20 at 22:14
  • If I copy your solution for the acronym package it doesnt compile. I get undefined control sequence at \fail and \AC@prefix. Why is that ? I want to use acronym because I wrote my whole thesis with it and I dont want to switch back to acro. – HWilmer May 21 '22 at 10:52