2

I think I've a use case / misuse hat is not yet covered by the nice acro package: I want to manage default citations and footnotes for some words - so not really acronyms in this case. A short MWE below.

Expected is something like: "This is \acx*{Metacomputing} and with \acx*{Metacomputing} we can do stuff" --> "This is Metacomputing[1]^1 and with Metacomputing we can do stuff" (without an entry in the acronym list).

I switched from the acronym package and used there the \aclu*{Metacomputing} command. Any idea how to simulate this behavior with the acro package?

\documentclass{scrartcl}

\usepackage{filecontents}
\begin{filecontents*}{mwe.bib}
@article{Smar1992,
author = {Smarr, Larry and Catlett, Charles E},
journal = {Communications of the ACM},
number = {6},
pages = {44--52},
publisher = {ACM},
title = {{Metacomputing}},
volume = {35},
year = {1992}}
\end{filecontents*}
\usepackage{acro}
\usepackage[style=ieee]{biblatex}
\addbibresource{mwe.bib}
\acsetup{single,sort}

\DeclareAcronym{Metacomputing}{short={Metacomputing}, long={Metacomputing}, cite={Smar1992}, long-post={\protect\footnote{\url{http://example.org}}}}

\begin{document}

\begin{itemize}
  \item Expected: Metacomputing[1]; Metacomputing.
  \item Instead:
    \begin{itemize}
      \item ac: \ac{Metacomputing}; \ac{Metacomputing}. \acresetall
      \item ac*: \ac*{Metacomputing}; \ac*{Metacomputing}. \acresetall
      \item acflike: \acflike{Metacomputing}{}; \acflike{Metacomputing}{}. \acresetall
      \item acs: \acs{Metacomputing}; \acs*{Metacomputing}{}. \acresetall
      \item acl: \acl{Metacomputing}; \acl*{Metacomputing}{}. \acresetall
      \item acf: \acf{Metacomputing}; \acf*{Metacomputing}{}. \acresetall
    \end{itemize}
\end{itemize}

\printacronyms
\printbibliography
\end{document}

Best regards, Alex

4
  • I'll have a look at this at the weekend. (Did you ask the same/a simular thing on acro's bitbucket site?)
    – cgnieder
    Commented Apr 1, 2015 at 19:45
  • Nice, thanks. No, but via mail. But I thought this question might bring an added value to this community.
    – Alex
    Commented Apr 1, 2015 at 23:08
  • It would be rather easy to add commands \Aclc/\aclc which would be long forms that also add a citation if one is defined for the acronym. acro's class option would allow to exclude certain acronyms from the list.
    – cgnieder
    Commented Apr 3, 2015 at 17:01
  • Sounds good. I assume this includes also the footnote and the possibility to hide it from the list of acronyms? Further, spelling out the acronym without any footnote or citation can come handy (e.g. to use it in section headers).
    – Alex
    Commented Apr 3, 2015 at 20:29

1 Answer 1

2

You can define a command \aclu, say, which exactly does what you want:

Expected is something like:

This is \acx*{Metacomputing} and with \acx*{Metacomputing} we can do stuff

This is Metacomputing[1]^1 and with Metacomputing we can do stuff

(without an entry in the acronym list).

Update 2015/08/26: with v2.0 or greater

The following defines a new conditional switch which is set to true if the acronym is used for the first time. This can be used to insert the footnote depending on the value of the switch. This is necessary because \acifused always gives false inside of the acronym properties.

\newif\ifacrousefootnote
\newcommand\acfootnote[1]{\ifacrousefootnote\footnote{#1}\fi}

\ExplSyntaxOn
\NewAcroCommand \aclu
  {
    \acro_is_used:nF {#1}
      { \acrousefootnotetrue \acro_cite: }
    \acro_long:n {#1}
  }
\NewAcroCommand \Aclu
  {
    \acro_if_acronym_used:nF {#1}
      { \acrousefootnotetrue \acro_cite: }
    \acro_first_upper:
    \acro_long:n {#1}
  }
\ExplSyntaxOff

Another possible definition would be the following:

\ExplSyntaxOn
\NewDocumentCommand \aclu {sm}
  {
    \acro_begin:
      \acro_reset_specials:
      \acro_check_acronym:nn {#2} {false}
      \acro_if_acronym_used:nF {#2} { \acro_cite: }
      \acro_long:n {#2}
      \IfBooleanF #1 { \acro_mark_as_used:n {#2} }
    \acro_end:
  }
% upper case version:
\NewDocumentCommand \Aclu {sm}
  {
    \acro_begin:
      \acro_reset_specials:
      \acro_check_acronym:nn {#2} {false}
      \acro_first_upper:
      \acro_if_acronym_used:nF {#2} { \acro_cite: }
      \acro_long:n {#2}
      \IfBooleanF #1 { \acro_mark_as_used:n {#2} }
    \acro_end:
  }
\ExplSyntaxOff

With this \acifused actually can be used in the properties of an acronym.

If you also add a class to the acronym definition you can exclude it later from the list of printed acronyms. Full example that uses the first version of the macros:

\documentclass{article}

% for demonstration purposes only: make the page small!
\usepackage[paperheight=20\baselineskip]{geometry}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{Smar1992,
  author    = {Smarr, Larry and Catlett, Charles E},
  journal   = {Communications of the ACM},
  number    = {6},
  pages     = {44--52},
  publisher = {ACM},
  title     = {Metacomputing},
  volume    = {35},
  year      = {1992}
}
\end{filecontents*}
\usepackage{acro}[2015-04-08]
\usepackage[style=ieee]{biblatex}
\addbibresource{\jobname.bib}
\acsetup{single,sort}

% make \footnote and \url robust commands, needs package `etoolbox':
\robustify\footnote
\robustify\url

\newif\ifacrousefootnote
\newcommand\acfootnote[1]{\ifacrousefootnote\footnote{#1}\fi}

\ExplSyntaxOn
\NewAcroCommand \aclu
  {
    \acro_is_used:nF {#1}
      { \acrousefootnotetrue \acro_cite: }
    \acro_long:n {#1}
  }
\NewAcroCommand \Aclu
  {
    \acro_if_acronym_used:nF {#1}
      { \acrousefootnotetrue \acro_cite: }
    \acro_first_upper:
    \acro_long:n {#1}
  }
\ExplSyntaxOff

\DeclareAcronym{Metacomputing}{
  short     = {metacomputing} ,
  long      = {metacomputing} ,
  cite      = {Smar1992} ,
  long-post = {\acfootnote{\url{http://example.org}}} ,
  class     = exclude
}

\DeclareAcronym{foo}{
  short     = {foo} ,
  long      = {foo bar baz}
}

\begin{document}

\Ac{foo} and later \ac{foo}.

\Aclu{Metacomputing} and later \aclu{Metacomputing}.

\printacronyms[exclude-classes=exclude]

\printbibliography

\end{document}

With version 1.6a of acro:

\documentclass{article}

% for demonstration purposes only: make the page small!
\usepackage[paperheight=20\baselineskip]{geometry}

\usepackage{filecontents}
\begin{filecontents*}{mwe.bib}
@article{Smar1992,
  author    = {Smarr, Larry and Catlett, Charles E},
  journal   = {Communications of the ACM},
  number    = {6},
  pages     = {44--52},
  publisher = {ACM},
  title     = {Metacomputing},
  volume    = {35},
  year      = {1992}
}
\end{filecontents*}
\usepackage{acro}[2015-04-08]
\usepackage[style=ieee]{biblatex}
\addbibresource{mwe.bib}
\acsetup{single,sort}

% make \footnote and \url robust commands, needs package `etoolbox':
\robustify\footnote
\robustify\url

\ExplSyntaxOn
\NewDocumentCommand \aclu {sm}
  {
    \group_begin:
      \acro_check_acronym:nn {#2} {false}
      \acro_if_acronym_used:nTF {#2} {} { \acro_cite: }
      \acro_long:n {#2}
      \IfBooleanF #1 { \acro_mark_as_used:n {#2} }
    \group_end:
  }
% upper case version:
\NewDocumentCommand \Aclu {sm}
  {
    \group_begin:
      \acro_check_acronym:nn {#2} {false}
      \acro_upper:
      \acro_if_acronym_used:nTF {#2} {} { \acro_cite: }
      \acro_long:n {#2}
      \IfBooleanF #1 { \acro_mark_as_used:n {#2} }
    \group_end:
  }
\ExplSyntaxOff

\DeclareAcronym{Metacomputing}{
  short     = {metacomputing} ,
  long      = {metacomputing} ,
  cite      = {Smar1992} ,
  long-post = {\acifused{Metacomputing}{}{\footnote{\url{http://example.org}}}} ,
  class     = exclude
}

\DeclareAcronym{foo}{
  short     = {foo} ,
  long      = {foo bar baz}
}

\begin{document}

\Ac{foo} and later \ac{foo}.

\Aclu{Metacomputing} and later \aclu{Metacomputing}.

\printacronyms[exclude-classes=exclude]

\printbibliography

\end{document}

enter image description here

4
  • Splendid. Tested it in a larger document and at first sight it seems to work as expected. You might want to add such a command natively without the need to define it first.
    – Alex
    Commented Apr 16, 2015 at 11:32
  • Addendum: I'm looking for somethings like \acclean{short} that behaves exactly like \ac but omits the "cite" and "long-post" annotations. An idea?
    – Alex
    Commented May 21, 2015 at 6:41
  • @Alex it is quite doable to omit the citation but it is impossible to omit long-pre
    – cgnieder
    Commented Jul 29, 2015 at 14:42
  • I'm coming back to this. In the MWE using a simple \ac command does not show a footnote in case the acronym foo would have a long-post defined, analog to the Metacomputing acronym.
    – Alex
    Commented Mar 16, 2017 at 10:18

You must log in to answer this question.

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