[Tex/LaTex] How to render individual acronyms in lower case when used inline, but mixed case in the list of acronyms

acronymscapitalization

I would like to output acronyms with the first letter of a word in upper case when they are printed to the list of acronyms. However, it certain cases I would like to print the written out form in lower case (english language) when I add them to a paragraph using the \ac{} or \acf{} commands. A third case would be to use the mixed letter variant somewhere in the document.

Examples:

% 1) In the list of acronyms.
Spatial Reference System (SRS)

% 2) In a paragraph.
... the spatial reference system (SRS) is important because ... 

% 3) Somewhere else in the document.
... it may happen that you still want to use the 
mixed variant when writing about the Spatial Reference System (SRS) ....

Question:

  • How would you configure acronyms to distiguish between those three cases?

Best Answer

You have to tell acronym both spellings:

\documentclass{article}
\usepackage{acronym}
\usepackage{etoolbox}
\makeatletter
\newif\if@in@acrolist
\AtBeginEnvironment{acronym}{\@in@acrolisttrue}
\newrobustcmd{\LU}[2]{\if@in@acrolist#1\else#2\fi}

\newcommand{\ACF}[1]{{\@in@acrolisttrue\acf{#1}}}
\makeatother

\begin{document}
\begin{acronym}
\acro{SRS}{\LU{S}{s}patial \LU{R}{r}eference \LU{S}{s}ystem}
\acro{DC}{\LU{D}{d}irect \LU{C}{c}urrent}
\end{acronym}

Batteries run on \ac{DC} and \ac{SRS} are different things.
\end{document}

The macro \LU just takes the alternate forms as its arguments; the \AtBeginEnvironment instruction tells this macro that the first argument is to be used, since the conditional \if@in@acrolist returns true. In normal text the conditional returns false (note that at the end of the acronym environment the setting of the conditional will be automatically reverted, because environments form groups).

enter image description here

I've added a macro \ACF that acts similarly to \acf (printing the full version along with the acronym) that uses the uppercase version.

Related Question