# Make small caps copyable as capital letters in PDF

I'm using pdflatex to typeset a document where the style guide mandates that acronyms be written in small caps. So for example, I might write,

Hearing aids do not cure \textsc{aids}.


to produce the text "Hearing aids do not cure AIDS."

The problem is that when I select and copy this text from the PDF, it gets rendered in the clipboard as "Hearing aids do not cure aids.", thus obscuring a crucial distinction in meaning.

I can reproduce this behaviour with several different PDF viewers, including Okular, Evince, and Adobe Reader.

How can I ensure that acronyms are visually rendered with small caps in the PDF, but rendered with actual capital letters when text is copied and pasted from the PDF? (Note that I also use small caps in my document headers, so I don't want to change the behaviour of \textsc generally.)

Here's something I came up with after noticing a related question, Making equations copyable in pdf. I'm not sure if this is the best way of doing things, but it seems to work:

\documentclass{article}
\usepackage{accsupp}

\newcommand*{\copyablesc}[1]{%
\BeginAccSupp{%
ActualText=\detokenize{#1},%
method=escape,
}%
\textsc{\lowercase{#1}}%
\EndAccSupp{}%
}

\begin{document}
Hearing aids do not cause \copyablesc{AIDS}.
\end{document}