summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/oberdiek/luacolor.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/oberdiek/luacolor.dtx')
-rw-r--r--Master/texmf-dist/source/latex/oberdiek/luacolor.dtx230
1 files changed, 162 insertions, 68 deletions
diff --git a/Master/texmf-dist/source/latex/oberdiek/luacolor.dtx b/Master/texmf-dist/source/latex/oberdiek/luacolor.dtx
index 8f240d19396..22a22834df4 100644
--- a/Master/texmf-dist/source/latex/oberdiek/luacolor.dtx
+++ b/Master/texmf-dist/source/latex/oberdiek/luacolor.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2007, 2009, 2010 by
+% Copyright (C) 2007, 2009-2011 by
% Heiko Oberdiek <heiko.oberdiek at googlemail.com>
%
% This work may be distributed and/or modified under the
@@ -21,7 +21,8 @@
% 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.
+% oberdiek.luacolor.lua, luacolor.lua,
+% oberdiek.luacolor-pre065.lua, luacolor-pre065.lua.
%
% Distribution:
% CTAN:macros/latex/contrib/oberdiek/luacolor.dtx
@@ -57,6 +58,8 @@
% TDS:tex/latex/oberdiek/luacolor.sty
% TDS:scripts/oberdiek/oberdiek.luacolor.lua
% TDS:scripts/oberdiek/luacolor.lua
+% TDS:scripts/oberdiek/oberdiek.luacolor-pre065.lua
+% TDS:scripts/oberdiek/luacolor-pre065.lua
% TDS:doc/latex/oberdiek/luacolor.pdf
% TDS:doc/latex/oberdiek/test/luacolor-test1.tex
% TDS:doc/latex/oberdiek/test/luacolor-test2.tex
@@ -78,7 +81,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: luacolor 2010/03/09 v1.2 Coloring based on LuaTeX's node attributes (HO)}
+\Msg{* Package: luacolor 2011/03/29 v1.4 Coloring based on LuaTeX's node attributes (HO)}
\Msg{************************************************************************}
\keepsilent
@@ -89,7 +92,7 @@
This is a generated file.
-Copyright (C) 2007, 2009, 2010 by
+Copyright (C) 2007, 2009-2011 by
Heiko Oberdiek <heiko.oberdiek at googlemail.com>
This work may be distributed and/or modified under the
@@ -110,7 +113,8 @@ 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.
+ oberdiek.luacolor.lua, luacolor.lua,
+ oberdiek.luacolor-pre065.lua, luacolor-pre065.lua.
\endpreamble
\let\MetaPrefix\DoubleperCent
@@ -135,6 +139,8 @@ and the derived files
\usedir{scripts/oberdiek}%
\file{oberdiek.luacolor.lua}{\from{luacolor.dtx}{lua}}%
\file{luacolor.lua}{\from{luacolor.dtx}{lua}}%
+ \file{oberdiek.luacolor-pre065.lua}{\from{luacolor.dtx}{lua,pre065}}%
+ \file{luacolor-pre065.lua}{\from{luacolor.dtx}{lua,pre065}}%
}
\catcode32=13\relax% active space
@@ -148,7 +154,8 @@ and the derived files
\Msg{*}
\Msg{* And install the following script files:}
\Msg{*}
-\Msg{* oberdiek.luacolor.lua, luacolor.lua}
+\Msg{* oberdiek.luacolor.lua, luacolor.lua,}
+\Msg{* oberdiek.luacolor-pre065.lua, luacolor-pre065.lua}
\Msg{*}
\Msg{* To produce the documentation run the file `luacolor.drv'}
\Msg{* through LaTeX.}
@@ -165,7 +172,7 @@ and the derived files
%<*driver>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{luacolor.drv}%
- [2010/03/09 v1.2 Coloring based on LuaTeX's node attributes (HO)]%
+ [2011/03/29 v1.4 Coloring based on LuaTeX's node attributes (HO)]%
\documentclass{ltxdoc}
\usepackage{holtxdoc}[2008/08/11]
\usepackage{paralist}
@@ -175,7 +182,7 @@ and the derived files
%</driver>
% \fi
%
-% \CheckSum{343}
+% \CheckSum{455}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -196,7 +203,7 @@ and the derived files
% \GetFileInfo{luacolor.drv}
%
% \title{The \xpackage{luacolor} package}
-% \date{2010/03/09 v1.2}
+% \date{2011/03/29 v1.4}
% \author{Heiko Oberdiek\\\xemail{heiko.oberdiek at googlemail.com}}
%
% \maketitle
@@ -266,28 +273,37 @@ and the derived files
% \subsection{Catcodes and identification}
%
% \begin{macrocode}
-\begingroup
- \catcode123 1 % {
- \catcode125 2 % }
+\begingroup\catcode61\catcode48\catcode32=10\relax%
+ \catcode13=5 % ^^M
+ \endlinechar=13 %
+ \catcode123=1 % {
+ \catcode125=2 % }
+ \catcode64=11 % @
\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
+ \endlinechar=\the\endlinechar\relax
+ \catcode13=\the\catcode13\relax
+ \catcode32=\the\catcode32\relax
+ \catcode35=\the\catcode35\relax
+ \catcode61=\the\catcode61\relax
+ \catcode64=\the\catcode64\relax
+ \catcode123=\the\catcode123\relax
+ \catcode125=\the\catcode125\relax
}%
}%
-\x
-\catcode35 6 % #
-\catcode64 11 % @
-\catcode123 1 % {
-\catcode125 2 % }
+\x\catcode61\catcode48\catcode32=10\relax%
+\catcode13=5 % ^^M
+\endlinechar=13 %
+\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=\the\catcode#1\relax
}%
- \catcode#1 #2\relax
+ \catcode#1=#2\relax
}
\TMP@EnsureCode{34}{12}% "
\TMP@EnsureCode{39}{12}% '
@@ -301,21 +317,19 @@ and the derived files
\TMP@EnsureCode{47}{12}% /
\TMP@EnsureCode{58}{12}% :
\TMP@EnsureCode{60}{12}% <
-\TMP@EnsureCode{61}{12}% =
\TMP@EnsureCode{62}{12}% >
+\TMP@EnsureCode{91}{12}% [
+\TMP@EnsureCode{93}{12}% ]
\TMP@EnsureCode{95}{12}% _ (other!)
\TMP@EnsureCode{96}{12}% `
-\edef\LuaCol@AtEnd{%
- \LuaCol@AtEnd
- \noexpand\endinput
-}
+\edef\LuaCol@AtEnd{\LuaCol@AtEnd\noexpand\endinput}
% \end{macrocode}
%
% Package identification.
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{luacolor}%
- [2010/03/09 v1.2 Coloring based on LuaTeX's node attributes (HO)]
+ [2011/03/29 v1.4 Coloring based on LuaTeX's node attributes (HO)]
% \end{macrocode}
%
% \subsection{Check for \LuaTeX}
@@ -324,17 +338,22 @@ and the derived files
% \begin{macrocode}
\RequirePackage{infwarerr}[2007/09/09]%
\RequirePackage{ifluatex}[2009/04/10]%
+\RequirePackage{ifpdf}[2010/01/28]%
+\RequirePackage{ltxcmds}[2010/04/26]%
\RequirePackage{color}
% \end{macrocode}
% \begin{macrocode}
\ifluatex
- \RequirePackage{luatex}[2010/03/09]%
+ \ltx@ifpackageloaded{luatexbase-attr}{%
+ }{%
+ \RequirePackage{luatex}[2010/03/09]%
+ }%
\else
\@PackageError{luacolor}{%
This package may only be run using LuaTeX%
}\@ehc
\expandafter\LuaCol@AtEnd
-\fi
+\fi%
% \end{macrocode}
%
% \begin{macro}{\LuaCol@directlua}
@@ -355,15 +374,19 @@ and the derived files
\@PackageWarningNoLine{luacolor}{%
Colors are disabled by option `monochrome'%
}%
+ \def\set@color{}%
+ \def\reset@color{}%
+ \def\set@page@color{}%
+ \def\define@color#1#2{}%
\expandafter\LuaCol@AtEnd
-\fi
+\fi%
% \end{macrocode}
%
% \subsection{Find driver}
%
% \begin{macrocode}
\LuaCol@directlua{%
- require("oberdiek.luacolor")%
+ require("oberdiek.luacolor\ifnum\luatexversion<65 -pre065\fi")%
}
\RequirePackage{ifpdf}[2007/09/09]
\ifpdf
@@ -392,7 +415,7 @@ and the derived files
\@PackageInfoNoLine{luacolor}{%
Type of color \string\special: \reserved@a
}%
- \fi
+ \fi%
\endgroup
\fi
% \end{macrocode}
@@ -401,7 +424,16 @@ and the derived files
%
% \begin{macro}{\LuaCol@Attribute}
% \begin{macrocode}
-\newattribute\LuaCol@Attribute
+\ltx@IfUndefined{newluatexattribute}{%
+ \newattribute\LuaCol@Attribute
+}{%
+ \newluatexattribute\LuaCol@Attribute
+}
+\ltx@IfUndefined{setluatexattribute}{%
+ \let\LuaCol@setattribute\setattribute
+}{%
+ \let\LuaCol@setattribute\setluatexattribute
+}
\LuaCol@directlua{%
oberdiek.luacolor.setattribute(\number\allocationnumber)%
}
@@ -411,7 +443,7 @@ and the derived files
% \begin{macro}{\set@color}
% \begin{macrocode}
\protected\def\set@color{%
- \setattribute\LuaCol@Attribute{%
+ \LuaCol@setattribute\LuaCol@Attribute{%
\LuaCol@directlua{%
oberdiek.luacolor.get("\luatexluaescapestring{\current@color}")%
}%
@@ -449,8 +481,50 @@ and the derived files
\set@color
% \end{macrocode}
%
+% \subsection{\cs{pdfxform} support}
+%
% \begin{macrocode}
-\LuaCol@AtEnd
+\ifpdf
+ \ltx@IfUndefined{pdfxform}{%
+ \ifnum\luatexversion>36 %
+ \directlua{%
+ tex.enableprimitives('',{%
+ 'pdfxform','pdflastxform','pdfrefxform'%
+ })%
+ }%
+ \fi
+ }{}%
+ \ltx@IfUndefined{protected}{%
+ \ifnum\luatexversion>36 %
+ \directlua{tex.enableprimitives('',{'protected'})}%
+ \fi
+ }{}%
+ \ltx@IfUndefined{pdfxform}{%
+ \@PackageWarning{luacolor}{\string\pdfxform\space not found}%
+ }{%
+ \let\LuaCol@org@pdfxform\pdfxform
+ \begingroup\expandafter\expandafter\expandafter\endgroup
+ \expandafter\ifx\csname protected\endcsname\relax
+ \@PackageWarning{luacolor}{\string\protected\space not found}%
+ \else
+ \expandafter\protected
+ \fi
+ \def\pdfxform{%
+ \begingroup
+ \afterassignment\LuaCol@pdfxform
+ \count@=%
+ }%
+ \def\LuaCol@pdfxform{%
+ \luacolorProcessBox\count@
+ \LuaCol@org@pdfxform\count@
+ \endgroup
+ }%
+ }%
+\fi
+% \end{macrocode}
+%
+% \begin{macrocode}
+\LuaCol@AtEnd%
%</package>
% \end{macrocode}
%
@@ -508,7 +582,8 @@ end
function dvidetect()
local v = tex.box[0]
assert(v.id == node.id("hlist"))
- for v in node.traverse_id(node.id("whatsit"), v.list) do
+%<!pre065> for v in node.traverse_id(node.id("whatsit"), v.head) do
+%<pre065> for v in node.traverse_id(node.id("whatsit"), v.list) do
if v and v.subtype == 3 then -- special
local data = v.data
for pattern, driver in pairs(patterns) do
@@ -591,7 +666,8 @@ function traverse(list, color)
return color
end
%<debug>texio.write_nl("traverse: " .. node.type(list.id))
- local head = list.list
+%<!pre065> local head = list.head
+%<pre065> local head = list.list
for n in node.traverse(head) do
%<debug>texio.write_nl(" node: " .. node.type(n.id))
local type = type[n.id]
@@ -627,7 +703,8 @@ function traverse(list, color)
end
end
end
- list.list = head
+%<!pre065> list.head = head
+%<pre065> list.list = head
return color
end
% \end{macrocode}
@@ -702,6 +779,22 @@ end
\advance\count@ 1 %
\repeat
}
+\def\RangeCatcodeCheck#1#2#3{%
+ \count@=#1\relax
+ \loop
+ \ifnum#3=\catcode\count@
+ \else
+ \errmessage{%
+ Character \the\count@\space
+ with wrong catcode \the\catcode\count@\space
+ instead of \number#3%
+ }%
+ \fi
+ \ifnum\count@<#2\relax
+ \advance\count@ 1 %
+ \repeat
+}
+\def\space{ }
\expandafter\ifx\csname LoadCommand\endcsname\relax
\def\LoadCommand{\input luacolor.sty\relax}%
\fi
@@ -712,15 +805,20 @@ end
\RangeCatcodeInvalid{123}{255}%
\catcode`\@=12 %
\catcode`\\=0 %
- \catcode`\{=1 %
- \catcode`\}=2 %
- \catcode`\#=6 %
- \catcode`\[=12 %
- \catcode`\]=12 %
\catcode`\%=14 %
- \catcode`\ =10 %
- \catcode13=5 %
\LoadCommand
+ \RangeCatcodeCheck{0}{36}{15}%
+ \RangeCatcodeCheck{37}{37}{14}%
+ \RangeCatcodeCheck{38}{47}{15}%
+ \RangeCatcodeCheck{48}{57}{12}%
+ \RangeCatcodeCheck{58}{63}{15}%
+ \RangeCatcodeCheck{64}{64}{12}%
+ \RangeCatcodeCheck{65}{90}{11}%
+ \RangeCatcodeCheck{91}{91}{15}%
+ \RangeCatcodeCheck{92}{92}{0}%
+ \RangeCatcodeCheck{93}{96}{15}%
+ \RangeCatcodeCheck{97}{122}{11}%
+ \RangeCatcodeCheck{123}{255}{15}%
\RestoreCatcodes
}
\Test
@@ -741,7 +839,7 @@ end
\pdfoutput=0 %
\fi
\documentclass{minimal}
-\usepackage{luacolor}[2010/03/09]
+\usepackage{luacolor}[2011/03/29]
\csname @@end\endcsname
\end
%</test2>
@@ -753,7 +851,7 @@ end
% \end{macrocode}
% \begin{macrocode}
\documentclass{minimal}
-\usepackage{luacolor}[2010/03/09]
+\usepackage{luacolor}[2011/03/29]
\usepackage{qstest}
\IncludeTests{*}
\LogTests{log}{*}{*}
@@ -764,25 +862,6 @@ end
%</test3>
% \end{macrocode}
%
-% \subsection{Short test for \plainTeX}
-%
-% \begin{macrocode}
-%<*test4>
-\input luacolor.sty\relax
-\newluastate\TestLuaState
-\newattribute\TestAttr
-\setattribute\TestAttr{10}
-\unsetattribute\TestAttr
-\newcatcodetable\TestCTa
-\begingroup
- \SetCatcodeRange{`A}{`Z}{12}%
-\endgroup
-\BeginCatcodeRegime\__CT__LaTeX
-\EndCatcodeRegime
-\end
-%</test4>
-% \end{macrocode}
-%
% \section{Installation}
%
% \subsection{Download}
@@ -845,6 +924,8 @@ end
% luacolor.sty & tex/latex/oberdiek/luacolor.sty\\
% oberdiek.luacolor.lua & scripts/oberdiek/oberdiek.luacolor.lua\\
% luacolor.lua & scripts/oberdiek/luacolor.lua\\
+% oberdiek.luacolor-pre065.lua & scripts/oberdiek/oberdiek.luacolor-pre065.lua\\
+% luacolor-pre065.lua & scripts/oberdiek/luacolor-pre065.lua\\
% luacolor.pdf & doc/latex/oberdiek/luacolor.pdf\\
% test/luacolor-test1.tex & doc/latex/oberdiek/test/luacolor-test1.tex\\
% test/luacolor-test2.tex & doc/latex/oberdiek/test/luacolor-test2.tex\\
@@ -982,6 +1063,19 @@ end
% \item
% Adaptation for package \xpackage{luatex} 2010/03/09 v0.4.
% \end{Version}
+% \begin{Version}{2010/12/13 v1.3}
+% \item
+% Support for \cs{pdfxform} added.
+% \item
+% Loaded package \xpackage{luatexbase-attr} recognized.
+% \item
+% Update for \hologo{LuaTeX}: `list' fields renamed to `head' in v0.65.0.
+% \end{Version}
+% \begin{Version}{2011/03/29 v1.4}
+% \item
+% Avoid whatsit insertion if option \xoption{monochrome} is used
+% (thanks Manuel P\'egouri\'e-Gonnard).
+% \end{Version}
% \end{History}
%
% \PrintIndex