blob: 66ca6997d8a16dfcdba06a8d0606d5d535410970 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
%%
%% This is file `ucshyper.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% ucs.dtx (with options: `ucshyper.sty')
%%
%% Copyright 2001 Dominique Unruh <unruh@ut.ee>
%% Copyright 2013 Wolfgang Jeltsch <wolfgang@cs.ioc.ee>
%%
%% This program is provided under the terms of the LaTeX Project Public License with some
%% modifications. See the file LICENSE for information.
%%
\ProvidesPackage{ucshyper}[2002/03/05
UCS: Unicode in Hyperref's PDF bookmarks]%
\ifx\pdfoutput\undefined
\PackageWarning{ucshyper}{ucshyper needs to be run with
pdflatex.\MessageBreak Disabling functionality}%
\expandafter\endinput\fi
\RequirePackage[pdftex,unicode]{hyperref}
\newif\ifucshyper@prerender\ucshyper@prerendertrue
\newif\ifucshyper@direct\ucshyper@directtrue
\DeclareOption{nodirect}{\ucshyper@directfalse}%
\DeclareOption{direct}{\ucshyper@directtrue}%
\DeclareOption{noprerender}{\ucshyper@prerenderfalse}%
\DeclareOption{prerender}{\ucshyper@prerendertrue}%
\ProcessOptions*%
\newcommand\UCSPU@tmp{}%
\newcommand\UCSPU[1]{%
\begingroup\let\UCSPU@tmp\relax\relax\ifx\UCSPU@tmp\relax
\ifx\utf@viii@map\undefined\else
\expandafter\utf@viii@map\expandafter{\number#1}\fi
\ifnum#1>"FFFF
\PackageError{ucshy}{UCSPU does not support codes greater than
\number"FFFF}\fi
\@tempcntb#1\divide\@tempcntb by'40000
\edef\uc@temp@a{\@backslashchar\number\@tempcntb}%
\multiply\@tempcntb by'40000 \@tempcnta#1\advance\@tempcnta by-\@tempcntb
\@tempcntb\@tempcnta\divide\@tempcntb by'4000
\edef\uc@temp@a{\uc@temp@a\number\@tempcntb}%
\multiply\@tempcntb by'4000\advance\@tempcnta by-\@tempcntb
\@tempcntb\@tempcnta\divide\@tempcntb by'400
\edef\uc@temp@a{\uc@temp@a\number\@tempcntb\@backslashchar}%
\multiply\@tempcntb by'400\advance\@tempcnta by-\@tempcntb
\@tempcntb\@tempcnta\divide\@tempcntb by'100
\edef\uc@temp@a{\uc@temp@a\number\@tempcntb}%
\multiply\@tempcntb by'100\advance\@tempcnta by-\@tempcntb
\@tempcntb\@tempcnta\divide\@tempcntb by'10
\edef\uc@temp@a{\uc@temp@a\number\@tempcntb}%
\multiply\@tempcntb by'10\advance\@tempcnta by-\@tempcntb
\@tempcntb\@tempcnta
\expandafter\xdef\csname UCS2PU\number#1\endcsname{%
\uc@temp@a\number\@tempcntb}%
\fi\endgroup
}
\newcommand\ucspu@err[1]{%
\csname[*** Insert \string\UCSPU{\number#1}
into preamble ***]\endcsname}
\@ifundefined{pdfstringdefPreHook}{\let\pdfstringdefPreHook\@empty}{}
\g@addto@macro\pdfstringdefPreHook{%
\ifucshyper@direct
\let\old@unichar\unichar
\def\unichar#1{%
\expandafter\ifx\csname UCS2PU\number#1\endcsname\relax
\ucspu@err{#1}\old@unichar{#1}\else
\csname UCS2PU\number#1\endcsname\fi
}%
\fi
\let\selectfont\empty
\let\fontencoding\@gobble
\let\selectlanguage\@gobble
\let\foreignlanguage\@gobble
}
\let\ucshyper@old@pdfstringdef\pdfstringdef
\def\pdfstringdef#1#2{%
\ifucshyper@prerender
\begingroup
\let\old@unichar\unichar
\let\uc@output\@gobbletwo
\fontencoding{PU}\enc@update
\def\unichar##1{\old@unichar{##1}\UCSPU{##1}}%
\edef\0{\string\0}%
\edef\1{\string\1}%
\edef\2{\string\2}%
\edef\3{\string\3}%
\edef\8{\string\8}%
\edef\9{\string\9}%
\Hy@pdfstringtrue
\PrerenderUnicode{#2}%
\endgroup
\fi
\ucshyper@old@pdfstringdef{#1}{#2}}
\newcommand\UCSPUrange[2]{%
\count255=#1\relax
\loop\ifnum\count255>#2\relax\else
\UCSPU{\count255}%
\advance\count255 by1\relax
\repeat}
\@onlypreamble\UCSPUrange
|