Is It Possible to Provide Alternative Text When Copying from PDF? – XeTeX and PDF

pdfsmall-capsxetex

I’m using XeLaTeX within MiKTeX and have the following problem.

Let there be some acronym, e.g. USA. I would like to write it in real small caps using \textsc{usa} but these are, of course, lower-case when copied from the PDF and pasting it, e.g. into a plain text file.

Is it possible to provide an alternative text that is the ‘actual’ text that is represented by these small caps and that is used when copying and pasting?

I mean something like when I have:

In the \textsc{usa} of 1980s there was ...

I would like it to be copied when hitting Ctrl+C as In the USA of 1980s there was ..., not as In the usa of 1980s there was ...


After an answer has been given:

Now there is only a problem that I can’t use this in the definition of acronym with the glossaries package. Minimum working example:

\documentclass[11pt]{article}

\usepackage{xunicode}
\usepackage{xltxtra}
\usepackage{accsupp}
\usepackage{glossaries}
\makeglossaries

\def \acUSA {\BeginAccSupp{method=plain,ActualText=USA}\textsc{usa}\EndAccSupp{}}
\newacronym{USA}{\acUSA}{United States of America}

\begin{document}
In the \gls{USA} of 1980s\ldots
\end{document}

It says this and doesn’t get through:

! Incomplete \iffalse; all text was ignored after line 10.
<inserted text> 
                \fi 

Thanks for further help.

Best Answer

See package accsupp:

\documentclass{article}
\usepackage{accsupp}
\begin{document}
In the
\textsc{%
 \BeginAccSupp{method=escape,ActualText=USA}%
  usa%
 \EndAccSupp{}}%

of 1980s there was...
\end{document}
Related Question