2 %% This is file `ucshyper.sty',
3 %% generated with the docstrip utility.
5 %% The original source files were:
7 %% ucs.dtx (with options: `ucshyper.sty')
9 %% Copyright 2001 Dominique Unruh <dominique@unruh.de>
11 %% This program is provided under the terms of the LaTeX Project Public
12 %% License with some modifications.
13 %% See the file LICENSE (http://www.unruh.de/DniQ/latex/unicode/content/LICENSE)
16 \ProvidesPackage{ucshyper}[2002/03/05
17 UCS: Unicode in Hyperref's PDF bookmarks]%
18 \ifx\pdfoutput\undefined
19 \PackageWarning{ucshyper}{ucshyper needs to be run with
20 pdflatex.\MessageBreak Disabling functionality}%
21 \expandafter\endinput\fi
22 \RequirePackage[pdftex,unicode]{hyperref}
23 \newif\ifucshyper@prerender\ucshyper@prerendertrue
24 \newif\ifucshyper@direct\ucshyper@directtrue
25 \DeclareOption{nodirect}{\ucshyper@directfalse}%
26 \DeclareOption{direct}{\ucshyper@directtrue}%
27 \DeclareOption{noprerender}{\ucshyper@prerenderfalse}%
28 \DeclareOption{prerender}{\ucshyper@prerendertrue}%
30 \newcommand\UCSPU@tmp{}%
31 \newcommand\UCSPU[1]{%
32 \begingroup\let\UCSPU@tmp\relax\relax\ifx\UCSPU@tmp\relax
33 \ifx\utf@viii@map\undefined\else
34 \expandafter\utf@viii@map\expandafter{\number#1}\fi
36 \PackageError{ucshy}{UCSPU does not support codes greater than
38 \@tempcntb#1\divide\@tempcntb by'40000
39 \edef\uc@temp@a{\@backslashchar\number\@tempcntb}%
40 \multiply\@tempcntb by'40000 \@tempcnta#1\advance\@tempcnta by-\@tempcntb
41 \@tempcntb\@tempcnta\divide\@tempcntb by'4000
42 \edef\uc@temp@a{\uc@temp@a\number\@tempcntb}%
43 \multiply\@tempcntb by'4000\advance\@tempcnta by-\@tempcntb
44 \@tempcntb\@tempcnta\divide\@tempcntb by'400
45 \edef\uc@temp@a{\uc@temp@a\number\@tempcntb\@backslashchar}%
46 \multiply\@tempcntb by'400\advance\@tempcnta by-\@tempcntb
47 \@tempcntb\@tempcnta\divide\@tempcntb by'100
48 \edef\uc@temp@a{\uc@temp@a\number\@tempcntb}%
49 \multiply\@tempcntb by'100\advance\@tempcnta by-\@tempcntb
50 \@tempcntb\@tempcnta\divide\@tempcntb by'10
51 \edef\uc@temp@a{\uc@temp@a\number\@tempcntb}%
52 \multiply\@tempcntb by'10\advance\@tempcnta by-\@tempcntb
54 \expandafter\xdef\csname UCS2PU\number#1\endcsname{%
55 \uc@temp@a\number\@tempcntb}%
58 \newcommand\ucspu@err[1]{%
59 \csname[*** Insert \string\UCSPU{\number#1}
60 into preamble ***]\endcsname}
61 \@ifundefined{pdfstringdefPreHook}{\let\pdfstringdefPreHook\@empty}{}
62 \g@addto@macro\pdfstringdefPreHook{%
64 \let\old@unichar\unichar
66 \expandafter\ifx\csname UCS2PU\number#1\endcsname\relax
67 \ucspu@err{#1}\old@unichar{#1}\else
68 \csname UCS2PU\number#1\endcsname\fi
72 \let\fontencoding\@gobble
73 \let\selectlanguage\@gobble
74 \let\foreignlanguage\@gobble
76 \let\ucshyper@old@pdfstringdef\pdfstringdef
77 \def\pdfstringdef#1#2{%
80 \let\old@unichar\unichar
81 \let\uc@output\@gobbletwo
82 \fontencoding{PU}\enc@update
83 \def\unichar##1{\old@unichar{##1}\UCSPU{##1}}%
91 \PrerenderUnicode{#2}%
94 \ucshyper@old@pdfstringdef{#1}{#2}}
95 \newcommand\UCSPUrange[2]{%
97 \loop\ifnum\count255>#2\relax\else
99 \advance\count255 by1\relax
101 \@onlypreamble\UCSPUrange