cgnieder / acro

acronyms for LaTeX
LaTeX Project Public License v1.3c
41 stars 9 forks source link

Add 'full-style' as property and option #178

Closed peanutfun closed 4 years ago

peanutfun commented 4 years ago

I want to use the acro package for formula symbols. Their names and the symbols themselves are usually written without parentheses. However, I do not find a "proper" way of doing this with acro. One can define custom templates and insert them for the first or the single use via first-style and single-style, respectively, but there seems to be no way of changing the full style.

Example:

\DeclareAcronym{density}{
  short = \ensuremath{\rho},
  long = density
}

\begin{document}
The \ac{density} is defined as $\ac{density} = 1$, a very convenient value of \acl{density}!
\end{document}

What I want:

The density ρ is defined as ρ = 1, a very convenient value of density!

What I get:

The density (ρ) is defined as ρ = 1, a very convenient value of density!

Ideally, I would like to set something like

\NewAcroTemplate{long-short-phy}{
  \acrowrite{long} \acrowrite{short}
}

\DeclareAcronym{density}{
  short = \ensuremath{\rho},
  long = density
  full-style = long-short-phy  % This option does not exist
}

There are workarounds, e.g. using acl{density} acs{density}, but this defeats the purpose of the package in my perception.

Would it be possible to add an option full-style for specifying templates for the full version of the acronym?

cgnieder commented 4 years ago

What you're looking for actually exists and is called first-style:

\documentclass{article}

\usepackage{acro}
\NewAcroTemplate{long-short-phy}{%
  \acrowrite{long} \acrowrite{short}%
}

\DeclareAcronym{density}{
  short = \ensuremath{\rho},
  long = density ,
  first-style = long-short-phy
}

\begin{document}

The \ac{density} is defined as $\ac{density} = 1$, a very convenient value of \acl{density}!

\end{document}

image