I'm using the frenchlinks
option for hyperref, which due to solicitous care of XeLaTeX + Linux Libertine, gives bona fide small-caps links on the page. The problem is, when I cut and paste out of the generated PDF, I get Unicode small-caps out, whereas I'd prefer ASCII.
Can anyone suggest how to modify this MWE? (Did I make a mistake in the setup?)
Note, for the updated MWE, I've tried to patch \href
using the accepted answer from Patching arguments inside a macro (no dice).
Updated MWE
\documentclass[article, a4paper, 12pt, oneside]{memoir}
\usepackage{xunicode}
\usepackage[MnSymbol]{mathspec}
%\defaultfontfeatures{Mapping=tex-text}
\setmainfont[Mapping= tex-text,
SmallCapsFont={Linux Libertine O},
SmallCapsFeatures= {Color=FFFFFF, RawFeature={+smcp,+hlig,+dlig}},
BoldFont={Linux Biolinum O Bold},
% BoldFeatures={Color = FFFFFF,SmallCapsFont={Linux Libertine Capitals O Bold},%
% SmallCapsFeatures = { Color=FFFFFF, RawFeature={+smcp,+hlig,+dlig}} },
ItalicFont={Linux Libertine O Italic},
ItalicFeatures={Color = FFFFFF, %
SmallCapsFont={Linux Libertine Capitals O Italic}, %
SmallCapsFeatures = {Color=FFFFFF}},
BoldItalicFont={Linux Biolinum O},
BoldItalicFeatures={ Color = FFFFFF, %
SmallCapsFont={Linux Libertine Capitals O Bold Italic}, %
SmallCapsFeatures = { Color=FFFFFF,RawFeature={+smcp,+hlig,+dlig}}} ]{Linux Libertine O}
\usepackage[linktoc=all,frenchlinks,pdfborderstyle={/S/U/W .5},citebordercolor={1 1 1},linkbordercolor={1 1 1},urlbordercolor={1 1 1}]{hyperref}
\usepackage{xstring}
\usepackage{accsupp}
\usepackage{etoolbox}
\catcode`\#=12
\newcommand{\newhref}{%
\normalexpandarg%
\patchcmd{\href}{#2}{%
\BeginAccSupp{method=pdfstring,ActualText={#2}}%
#2%
\EndAccSupp{}%
}{}{}%
}
\catcode`\#=6
\begin{document}
Sexy tex: \newhref{http://tex.stackexchange.com}{sxe}.
\end{document}
Original MWE
\documentclass[article, a4paper, 12pt, oneside]{memoir}
\usepackage{xunicode}
\usepackage[MnSymbol]{mathspec}
%\defaultfontfeatures{Mapping=tex-text}
\setmainfont[Mapping= tex-text,
SmallCapsFont={Linux Libertine O},
SmallCapsFeatures= {Color=FFFFFF, RawFeature={+smcp,+hlig,+dlig}},
BoldFont={Linux Biolinum O Bold},
% BoldFeatures={Color = FFFFFF,SmallCapsFont={Linux Libertine Capitals O Bold},%
% SmallCapsFeatures = { Color=FFFFFF, RawFeature={+smcp,+hlig,+dlig}} },
ItalicFont={Linux Libertine O Italic},
ItalicFeatures={Color = FFFFFF, %
SmallCapsFont={Linux Libertine Capitals O Italic}, %
SmallCapsFeatures = {Color=FFFFFF}},
BoldItalicFont={Linux Biolinum O},
BoldItalicFeatures={ Color = FFFFFF, %
SmallCapsFont={Linux Libertine Capitals O Bold Italic}, %
SmallCapsFeatures = { Color=FFFFFF,RawFeature={+smcp,+hlig,+dlig}}} ]{Linux Libertine O}
\usepackage[linktoc=all,frenchlinks,pdfborderstyle={/S/U/W .5},citebordercolor={1 1 1},linkbordercolor={1 1 1},urlbordercolor={1 1 1}]{hyperref}
\usepackage{xstring} % added as suggested in 1st given answer
\usepackage{accsupp}
\let\hrefold\href
\newcommand*{\hrefnew}[2]{%
\normalexpandarg%
\BeginAccSupp{method=plain,unicode,ActualText={#2}}%
\hrefold{#1}{#2}%
\EndAccSupp{}%
}
\begin{document}
Sexy tex: \href{http://tex.stackexchange.com}{sxe}.
\end{document}
\AccSupp
that I know of is Adobe Reader. Are you using it?