4

I want to use the an acronym defined with the acronym package inside the definition of a math operator. The math operator should appear in bold font. However, this does not work as the \acs command does not care about the surrounding \mathbf command.

MWE:

\documentclass{scrreprt}

\usepackage{amsmath}
\usepackage{hyperref}
\usepackage{acronym}

\DeclareMathOperator{\df}{\mathbf{\acs{DF}}}
\DeclareMathOperator{\dfnoacs}{\mathbf{DF}} % how it should look like

\begin{document}

\begin{acronym}
\acro{DF}{discount factor}
\end{acronym}

\begin{align*}
\df(...) &= ... \\
\dfnoacs(...) &= ...
\end{align*}

\end{document}

MWE

IMO, the usage of another argument to \acs like \acs{DF}{...}{discount factor} is not option as I do not want to use another style in the list of acronyms.

  • I don't think that the first appearance of the acronym in a math formula would make much sense. – egreg Sep 11 '16 at 15:42
  • @egreg I agree but the question is not about the first appearance of an acronym, it's about reusing the definition of the acronym. Consider I want to switch the representation from "DF" to "df" (lowercase) then I don't want to change my entire latex document and search up the places where I wrote "DF". It's better to use the generic acronym macro. – dnl Sep 11 '16 at 15:48
  • If you define \DeclareMathOperator{\df}{\mathbf{DF}}, then just changing DF into df would do the same as you ask for. – egreg Sep 11 '16 at 15:54
  • Well, but if I use \DeclareMathOperator{\df}{\mathbf{DF}} in math mode and \acs{DF} in text mode, there are still two places to change it. However, there are indeed math operator names that I don't want to introduce but put the name in the list of acronyms, so the first appearance is in the math operator (it's more like nomenclature). – dnl Sep 11 '16 at 16:11
  • Acronyms and math operators are very different things, in my opinion. – egreg Sep 11 '16 at 19:14
4

Just use \textbf instead of \mathbf:

Sample output

\documentclass{scrreprt}

\usepackage{amsmath}
\usepackage{hyperref}
\usepackage{acronym}

\DeclareMathOperator{\df}{\textbf{\acs{DF}}}
\DeclareMathOperator{\dfnoacs}{\mathbf{DF}} % how it should look like

\begin{document}

\begin{acronym}
\acro{DF}{discount factor}
\end{acronym}

\begin{align*}
\df(\dots) &= \dots \\
\dfnoacs(\dots) &= \dots
\end{align*}

\end{document}

However using the sans serif family too via

\DeclareMathOperator{\df}{\textbf{\sffamily\acs{DF}}}

will better match the appearance in text:

text version

new math version

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.