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:



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

In the \gls{USA} of 1980s\ldots

It says this and doesn’t get through:

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

Thanks for further help.

  • 3
    For the second part of your question, you may want to have a look at the glossaries-accsupp package - it seems to be quite new and is not very well documented, though. – diabonas May 18 '11 at 11:22
  • I'm not sure you should be using \textsc here in the first place: probably you should still type the acronym in uppercase but switch to an equivalent (pseudo-)font in which the uppercase letters are smaller. – ShreevatsaR Nov 5 '16 at 19:11

See package accsupp:

In the

of 1980s there was...
  • Great. That’s the answer. Now I have only a problem that it gives me an error when I use it inside a definition of an acronym using the glossaries package. – josefec May 18 '11 at 9:55
  • Make an small, complete example for tests. – Ulrike Fischer May 18 '11 at 10:40
  • 8
    Try \DeclareRobustCommand\acUSA .... And always load xunicode after xltxtra - if you load it at all which is unneeded as xltxtra will load it anyway. Actually nowadays also xltxtra is no longer really needed. fontspec should be enough. – Ulrike Fischer May 18 '11 at 11:03
  • 1
    Great, great, great, the greatest of all times. I sincerely thank you for your help. Now everything works like in a dream. :) – josefec May 18 '11 at 11:08
  • 1
    I guess you are looking for \expandafter\PDFreplace\expandafter{\USA}. I wouldn't bother to much that only a part of "OECD" can be selected. How often will someone try to do this? A user will probably always mark larger parts of the document. – Ulrike Fischer May 19 '11 at 7:30

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.