blob: 8054ff37dbba5f9b7791eba7d83adc34cda4e79d (
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
%%
%% This is file `luacolor.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% luacolor.dtx (with options: `package')
%%
%% This is a generated file.
%%
%% Copyright (C) 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3 of this license or (at your option) any later
%% version. The latest version of this license is in
%% http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status "maintained".
%%
%% This Current Maintainer of this work is Heiko Oberdiek.
%%
%% This work consists of the main source file luacolor.dtx
%% and the derived files
%% luacolor.sty, luacolor.pdf, luacolor.ins, luacolor.drv,
%% luacolor-test1.tex, luacolor-test2.tex, luacolor-test3.tex,
%% oberdiek.luacolor.lua, luacolor.lua.
%%
\begingroup
\catcode123 1 % {
\catcode125 2 % }
\def\x{\endgroup
\expandafter\edef\csname LuaCol@AtEnd\endcsname{%
\catcode35 \the\catcode35\relax
\catcode64 \the\catcode64\relax
\catcode123 \the\catcode123\relax
\catcode125 \the\catcode125\relax
}%
}%
\x
\catcode35 6 % #
\catcode64 11 % @
\catcode123 1 % {
\catcode125 2 % }
\def\TMP@EnsureCode#1#2{%
\edef\LuaCol@AtEnd{%
\LuaCol@AtEnd
\catcode#1 \the\catcode#1\relax
}%
\catcode#1 #2\relax
}
\TMP@EnsureCode{34}{12}% "
\TMP@EnsureCode{39}{12}% '
\TMP@EnsureCode{40}{12}% (
\TMP@EnsureCode{41}{12}% )
\TMP@EnsureCode{42}{12}% *
\TMP@EnsureCode{43}{12}% +
\TMP@EnsureCode{44}{12}% ,
\TMP@EnsureCode{45}{12}% -
\TMP@EnsureCode{46}{12}% .
\TMP@EnsureCode{47}{12}% /
\TMP@EnsureCode{58}{12}% :
\TMP@EnsureCode{60}{12}% <
\TMP@EnsureCode{61}{12}% =
\TMP@EnsureCode{62}{12}% >
\TMP@EnsureCode{95}{12}% _ (other!)
\TMP@EnsureCode{96}{12}% `
\edef\LuaCol@AtEnd{%
\LuaCol@AtEnd
\noexpand\endinput
}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{luacolor}%
[2007/12/12 v1.0 Coloring based on LuaTeX's node attributes (HO)]
\RequirePackage{infwarerr}[2007/09/09]%
\RequirePackage{ifluatex}[2007/12/12]%
\RequirePackage{color}
\ifluatex
\RequirePackage{luatex}[2007/12/12]%
\else
\@PackageError{luacolor}{%
This package may only be run using LuaTeX%
}\@ehc
\expandafter\LuaCol@AtEnd
\fi
\ifcolors@
\else
\@PackageWarningNoLine{luacolor}{%
Colors are disabled by option `monochrome'%
}%
\expandafter\LuaCol@AtEnd
\fi
\directlua0{%
require("oberdiek.luacolor")%
}
\RequirePackage{ifpdf}[2007/09/09]
\ifpdf
\else
\begingroup
\def\current@color{}%
\def\reset@color{}%
\setbox\z@=\hbox{%
\begingroup
\set@color
\endgroup
}%
\edef\reserved@a{%
\directlua0{%
oberdiek.luacolor.dvidetect()%
}%
}%
\ifx\reserved@a\@empty
\@PackageError{luacolor}{%
DVI driver detection failed because of\MessageBreak
unrecognized color \string\special
}\@ehc
\endgroup
\expandafter\expandafter\expandafter\LuaCol@AtEnd
\else
\@PackageInfoNoLine{luacolor}{%
Type of color \string\special: \reserved@a
}%
\fi
\endgroup
\fi
\newattribute\LuaCol@Attribute
\directlua0{%
oberdiek.luacolor.setattribute(\number\allocationnumber)%
}
\protected\def\set@color{%
\setattribute\LuaCol@Attribute{%
\directlua0{%
oberdiek.luacolor.get("\luaescapestring{\current@color}")%
}%
}%
}
\def\reset@color{}
\def\luacolorProcessBox#1{%
\directlua0{%
oberdiek.luacolor.process(\number#1)%
}%
}
\RequirePackage{atbegshi}[2007/09/09]
\AtBeginShipout{%
\luacolorProcessBox\AtBeginShipoutBox
}
\set@color
\LuaCol@AtEnd
\endinput
%%
%% End of file `luacolor.sty'.
|