
저는 frenchlinks
XeLaTeX + Linux Libertine의 세심한 배려로 인해 하이퍼참조 옵션을 사용하고 있습니다.진실한페이지의 작은 대문자 링크. 문제는 생성된 PDF를 잘라내어 붙여넣을 때 유니코드 작은 대문자가 나오는 반면 저는 ASCII를 선호한다는 것입니다.
누구든지 이 MWE를 수정하는 방법을 제안할 수 있습니까? (제가 설정을 잘못했나요?)
\href
업데이트된 MWE의 경우 다음 에서 허용된 답변을 사용하여 패치를 시도했습니다. 매크로 내부의 인수 패치 (주사위 없음).
업데이트된 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}
원본 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}
답변1
매크로는
\hrefnew
새로운 기능으로 정의되지만/ActualText
본문은 수정되지 않은 기능을 사용하고 있습니다\href
.매크로는 로드되지 않은 패키지에서 제공되는
\href
정의되지 않은 내용을 사용하고 있습니다 .\normalexpandarg
xstring
plain
옵션이 있는 메소드를 사용하는 경우unicode
인수는 유효한UTF-16BE
문자열이어야 합니다. 이 경우hyperref
메소드를 사용하여 올바른 변환을 수행 하겠습니다pdfstringdef
.\BeginAccSupp{method=pdfstringdef,ActualText={#2}}
\href
변경된 catcode로 읽혀지는 첫 번째 인수를 특별하게 처리하기 때문에 재정의하기에 좋은 후보가 아닙니다. 따라서 더 나은 후보는 내부입니다 \href@
.
\makeatletter
\let\href@old\href@
\renewcommand*{\href@}[2]{%
\href@old{#1}{%
\BeginAccSupp{%
method=pdfstringdef,%
ActualText={#2},%
}%
#2%
\EndAccSupp{}%
}%
}
\makeatletter