缩写:仅显示长版本,且仅显示一次引文和/或脚注

缩写:仅显示长版本,且仅显示一次引文和/或脚注

我认为我有一个用例/误用帽尚未被 nice acro 包覆盖:我想管理某些单词的默认引用和脚注 - 因此在这种情况下不是真正的首字母缩略词。 下面是一个简短的 MWE。

预期内容如下:“这是 \acx*{Metacomputing},使用 \acx*{Metacomputing} 我们可以做一些事情” --> “这是 Metacomputing[1]^1,使用 Metacomputing 我们可以做一些事情”(没有首字母缩略词列表中的条目)。

我从 acronym 包切换过来,并在其中使用了 \aclu*{Metacomputing} 命令。知道如何使用 acro 包模拟此行为吗?

\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}

谨致问候,亚历克斯

答案1

你可以定义一个命令\aclu,它可以完成你想要的操作:

预期是这样的:

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

这就是元计算[1]^1,有了元计算,我们就能做一些事情

(在首字母缩略词列表中没有条目)。

更新 2015/08/26:使用 v2.0 或更高版本

下面定义了一个新的条件开关,如果缩写词首次使用,则设置为 true。这可用于根据开关的值插入脚注。这是必要的,因为\acifused缩写词属性中始终给出 false。

\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

另一个可能的定义如下:

\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

实际上\acifused用于首字母缩略词的属性中。

如果您还将一个类添加到首字母缩略词定义中,则可以稍后将其从打印的首字母缩略词列表中排除。使用宏的第一个版本的完整示例:

\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}

使用 1.6a 版本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}

在此处输入图片描述

相关内容