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?

10
  • Welcome to TeX-SX! You may have a look at our starter page for a quick intro if you wish to familiarize yourself with our format. May 3, 2013 at 17:47
  • 3
    Do you mean something like Using the glossaries package for English acronyms in German documents? May 3, 2013 at 20:01
  • @NicolaTalbot Yes, that pretty much looks like what I am after...Is there a way to do this with the acronym package as well? May 4, 2013 at 6:09
  • 1
    @JohannesS.Sorry, I don't know how to do this with acronym as I've never used that package. If you do decide to switch, the glossaries package option shortcuts will enable commands like \ac and \acs. May 4, 2013 at 8:20
  • 2
    For what it's worth: the acro package v1.3 provides the foreign key for this.
    – cgnieder
    May 8, 2013 at 7:18

1 Answer 1

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\"at\acroforeign{Electronic Control Unit}}
  \acro{BW}{Baden-W\"urttemberg}
\end{acronym}

\end{document}
4
  • 2
    The acro package is working great. Sep 30, 2013 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, 2020 at 8:36
  • 1
    @LN-12 my answer was outdated. I added an updated version.
    – cgnieder
    Aug 26, 2020 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, 2022 at 10:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .