-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwmref.sty
More file actions
97 lines (86 loc) · 2.1 KB
/
wmref.sty
File metadata and controls
97 lines (86 loc) · 2.1 KB
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
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{wmref}[2011/11/09]
\RequirePackage{xparse}
\RequirePackage{xifthen}
\RequirePackage[totoc]{idxlayout}
\RequirePackage{varindex}
\RequirePackage{xstring}
\RequirePackage{makeidx}
%\RequirePackage{xeindex}
%\RequirePackage{index}
%\RequirePackage{glossaries}
\RequirePackage{hyperref}
\RequirePackage{zref}
\RequirePackage[english,german]{translator}
\usedictionary{wmnotes}
\setindexprenote{\textbf{\translate{Bold (indexnote)}} \translate{indexnote (body)}}
\AtBeginDocument{
\catcode`\~=11\relax
}
\hypersetup{
pdfborder = 0 0 0 ,
hyperindex=false ,
pageanchor ,
plainpages
}
\newcommand*{\labelescape}[1]{
\makecommand*{\@tempstring}{#1}
\IfSubStr{\@tempstring}{|}{\StrBefore*{\@tempstring}{|}[\@tempstring]}{}
\IfSubStr{\@tempstring}{@}{\StrBefore*{\@tempstring}{@}[\@tempstring]}{}
\StrDel{\@tempstring}{ }[\@tempstring]
\StrDel{\@tempstring}{!}[\@tempstring]
\StrDel{\@tempstring}{,}[\@tempstring]
\StrDel{\@tempstring}{;}[\@tempstring]
\StrDel{\@tempstring}{$}
}
\zref@newprop{index}[]{}
\zref@newprop{indexformat}[]{}
\zref@addprops{main}{index,indexformat}
\newcommand{\fullexpand}[1]{\edef\ProcessedArgument{#1}}
% \wmindex
% #1 : *
% #2 : index format
% #3 : index
% #4 : index style
\DeclareDocumentCommand{\wmindex}{s O{ } m O{default}}{%
\IfBooleanTF{#1}{%
\varindex*{#3}{#2}[|#4]%
}{%
\varindex{#3}{#2}[|#4]%
}%
}
% \wm@index
% #1 : index format
% #2 : index
\DeclareDocumentCommand{\wm@index}{>{\fullexpand} O{} >{\fullexpand} m >{\fullexpand} O{}}{%
\wmindex[#1]{#2}[#3]%
}
% \wmlabel
% #1 : *
% #2 : label
% #3 : index
% #4 : index format
% #5 : index style
\DeclareDocumentCommand{\wmlabel}{s m o O{} O{def}}{%
\zref@setcurrent{index}{#3}%
\zref@setcurrent{indexformat}{#4}%
\zref@label{#2}%
\label{#2}%
\zref@setcurrent{index}{}%
\zref@setcurrent{indexformat}{}%
\IfNoValueTF{#3}{%
\ifthenelse{\isempty{#4}}{%
\wmindex{#3}[#5]%
}{%
\wmindex[#4]{#3}[#5]%
}%
}%
}
% \wmref
% #1 : *
% #2 : label
% #3 : text
\DeclareDocumentCommand{\wmref}{s m m}{%
\hyperref[#2]{#3}%
\wm@index[\zref@extract{#2}{indexformat}]{\zref@extract{#2}{index}}%
}