<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">% \iffalse meta-comment
% 
% Copyright (C) 2007, 2009 by
%    Heiko Oberdiek &lt;heiko.oberdiek at googlemail.com&gt;
% 
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.3c of this license or (at your option) any later
% version. This version of this license is in
%    http://www.latex-project.org/lppl/lppl-1-3c.txt
% and 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.
% 
% Distribution:
%    CTAN:macros/latex/contrib/oberdiek/luacolor.dtx
%    CTAN:macros/latex/contrib/oberdiek/luacolor.pdf
% 
% Unpacking:
%    (a) If luacolor.ins is present:
%           tex luacolor.ins
%    (b) Without luacolor.ins:
%           tex luacolor.dtx
%    (c) If you insist on using LaTeX
%           latex \let\install=y\input{luacolor.dtx}
%        (quote the arguments according to the demands of your shell)
% 
% Documentation:
%    (a) If luacolor.drv is present:
%           latex luacolor.drv
%    (b) Without luacolor.drv:
%           latex luacolor.dtx; ...
%    The class ltxdoc loads the configuration file ltxdoc.cfg
%    if available. Here you can specify further options, e.g.
%    use A4 as paper format:
%       \PassOptionsToClass{a4paper}{article}
% 
%    Programm calls to get the documentation (example):
%       pdflatex luacolor.dtx
%       makeindex -s gind.ist luacolor.idx
%       pdflatex luacolor.dtx
%       makeindex -s gind.ist luacolor.idx
%       pdflatex luacolor.dtx
% 
% Installation:
%    TDS:tex/latex/oberdiek/luacolor.sty
%    TDS:scripts/oberdiek/oberdiek.luacolor.lua
%    TDS:scripts/oberdiek/luacolor.lua
%    TDS:doc/latex/oberdiek/luacolor.pdf
%    TDS:doc/latex/oberdiek/test/luacolor-test1.tex
%    TDS:doc/latex/oberdiek/test/luacolor-test2.tex
%    TDS:doc/latex/oberdiek/test/luacolor-test3.tex
%    TDS:source/latex/oberdiek/luacolor.dtx
%
%&lt;*ignore&gt;
\begingroup
  \def\x{LaTeX2e}%
\expandafter\endgroup
\ifcase 0\ifx\install y1\fi\expandafter
         \ifx\csname processbatchFile\endcsname\relax\else1\fi
         \ifx\fmtname\x\else 1\fi\relax
\else\csname fi\endcsname
%&lt;/ignore&gt;
%&lt;*install&gt;
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
\Msg{* Package: luacolor 2009/04/10 v1.1 Coloring based on LuaTeX's node attributes (HO)}
\Msg{************************************************************************}

\keepsilent
\askforoverwritefalse

\let\MetaPrefix\relax
\preamble

This is a generated file.

Copyright (C) 2007, 2009 by
   Heiko Oberdiek &lt;heiko.oberdiek at googlemail.com&gt;

This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either
version 1.3c of this license or (at your option) any later
version. This version of this license is in
   http://www.latex-project.org/lppl/lppl-1-3c.txt
and 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.

\endpreamble
\let\MetaPrefix\DoubleperCent

\generate{%
  \file{luacolor.ins}{\from{luacolor.dtx}{install}}%
  \file{luacolor.drv}{\from{luacolor.dtx}{driver}}%
  \usedir{tex/latex/oberdiek}%
  \file{luacolor.sty}{\from{luacolor.dtx}{package}}%
  \usedir{doc/latex/oberdiek/test}%
  \file{luacolor-test1.tex}{\from{luacolor.dtx}{test1}}%
  \file{luacolor-test2.tex}{\from{luacolor.dtx}{test2}}%
  \file{luacolor-test3.tex}{\from{luacolor.dtx}{test3}}%
}
\def\MetaPrefix{-- }
\def\defaultpostamble{%
  \MetaPrefix^^J%
  \MetaPrefix\space End of File `\outFileName'.%
}
\def\currentpostamble{\defaultpostamble}%
\generate{%
  \usedir{scripts/oberdiek}%
  \file{oberdiek.luacolor.lua}{\from{luacolor.dtx}{lua}}%
  \file{luacolor.lua}{\from{luacolor.dtx}{lua}}%
}

\obeyspaces
\Msg{************************************************************************}
\Msg{*}
\Msg{* To finish the installation you have to move the following}
\Msg{* file into a directory searched by TeX:}
\Msg{*}
\Msg{*     luacolor.sty}
\Msg{*}
\Msg{* And install the following script files:}
\Msg{*}
\Msg{*     oberdiek.luacolor.lua, luacolor.lua}
\Msg{*}
\Msg{* To produce the documentation run the file `luacolor.drv'}
\Msg{* through LaTeX.}
\Msg{*}
\Msg{* Happy TeXing!}
\Msg{*}
\Msg{************************************************************************}

\endbatchfile
%&lt;/install&gt;
%&lt;*ignore&gt;
\fi
%&lt;/ignore&gt;
%&lt;*driver&gt;
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{luacolor.drv}%
  [2009/04/10 v1.1 Coloring based on LuaTeX's node attributes (HO)]%
\documentclass{ltxdoc}
\usepackage{holtxdoc}[2008/08/11]
\usepackage{paralist}
\begin{document}
  \DocInput{luacolor.dtx}%
\end{document}
%&lt;/driver&gt;
% \fi
%
% \CheckSum{343}
%
% \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
%   Lower-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
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&amp;
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \&lt;
%   Equals        \=     Greater than  \&gt;     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
% \GetFileInfo{luacolor.drv}
%
% \title{The \xpackage{luacolor} package}
% \date{2009/04/10 v1.1}
% \author{Heiko Oberdiek\\\xemail{heiko.oberdiek at googlemail.com}}
%
% \maketitle
%
% \begin{abstract}
% Package \xpackage{luacolor} implements color support based
% on \LuaTeX's node attributes.
% \end{abstract}
%
% \tableofcontents
%
% \section{Documentation}
%
% \subsection{Introduction}
%
% This package uses a \LuaTeX's attribute register to
% to annotate nodes with color information.
% If a color is set, then the attribute register
% is set to this color and all nodes created in its scope
% (current group) are annotated with this attribute.
% Now the color property behaves much the same way
% as the font property.
%
% \subsection{Usage}
%
% Package \xpackage{color} is loaded automatically by this
% package \xpackage{luacolor}. If you need a special driver
% option or you prefer package \xpackage{xcolor}, then load
% it before package \xpackage{luacolor}, for example:
% \begin{quote}
%   |\usepackage[dvipdfmx]{xcolor}|
% \end{quote}
% The package \xpackage{luacolor} is loaded without options:
% \begin{quote}
%   |\usepackage{luacolor}|
% \end{quote}
% It is able to detect PDF mode and DVI drivers are
% differentiated by its color specials. Therefore the
% package do need driver options.
%
% Then it redefines the color setting commands to set
% attributes instead of whatsits for color.
%
% At last the attribute annotations of the nodes in the
% output box must be analyzed to insert the necessary color whatsits.
% Currently \LuaTeX\ lacks an appropriate callback function.
% Therefore package \xpackage{atbegshi} is used to get control
% before a box is shipped out.
%
% \begin{declcs}{luacolorProcessBox} \M{box}
% \end{declcs}
% Macro \cs{luacolorProcessBox} processes the box \meta{box}
% in the previously described manner. It is automatically
% called for pages, but not for XForm objects.
% Before passing a box to \cs{pdfxform}, call \cs{luacolorProcessBox}
% first.
%
% \StopEventually{
% }
%
% \section{Implementation}
%
%    \begin{macrocode}
%&lt;*package&gt;
%    \end{macrocode}
%
% \subsection{Catcodes and identification}
%
%    \begin{macrocode}
\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}% &lt;
\TMP@EnsureCode{61}{12}% =
\TMP@EnsureCode{62}{12}% &gt;
\TMP@EnsureCode{95}{12}% _ (other!)
\TMP@EnsureCode{96}{12}% `
\edef\LuaCol@AtEnd{%
  \LuaCol@AtEnd
  \noexpand\endinput
}
%    \end{macrocode}
%
%    Package identification.
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{luacolor}%
  [2009/04/10 v1.1 Coloring based on LuaTeX's node attributes (HO)]
%    \end{macrocode}
%
% \subsection{Check for \LuaTeX}
%
%    Without \LuaTeX\ there is no point in using this package.
%    \begin{macrocode}
\RequirePackage{infwarerr}[2007/09/09]%
\RequirePackage{ifluatex}[2009/04/10]%
\RequirePackage{color}
%    \end{macrocode}
%    \begin{macrocode}
\ifluatex
  \RequirePackage{luatex}[2009/04/10]%
\else
  \@PackageError{luacolor}{%
    This package may only be run using LuaTeX%
  }\@ehc
  \expandafter\LuaCol@AtEnd
\fi
%    \end{macrocode}
%
%    \begin{macro}{\LuaCol@directlua}
%    \begin{macrocode}
\ifnum\luatexversion&lt;36 %
  \def\LuaCol@directlua{\directlua0 }%
\else
  \let\LuaCol@directlua\directlua
\fi
%    \end{macrocode}
%    \end{macro}
%
% \subsection{Check for disabled colors}
%
%    \begin{macrocode}
\ifcolors@
\else
  \@PackageWarningNoLine{luacolor}{%
    Colors are disabled by option `monochrome'%
  }%
  \expandafter\LuaCol@AtEnd
\fi
%    \end{macrocode}
%
% \subsection{Find driver}
%
%    \begin{macrocode}
\LuaCol@directlua{%
  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{%
      \LuaCol@directlua{%
        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
%    \end{macrocode}
%
% \subsection{Attribute setting}
%
%    \begin{macro}{\LuaCol@Attribute}
%    \begin{macrocode}
\newattribute\LuaCol@Attribute
\LuaCol@directlua{%
  oberdiek.luacolor.setattribute(\number\allocationnumber)%
}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\set@color}
%    \begin{macrocode}
\protected\def\set@color{%
  \setattribute\LuaCol@Attribute{%
    \LuaCol@directlua{%
      oberdiek.luacolor.get("\luaescapestring{\current@color}")%
    }%
  }%
}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\reset@color}
%    \begin{macrocode}
\def\reset@color{}
%    \end{macrocode}
%    \end{macro}
%
% \subsection{Whatsit insertion}
%
%    \begin{macro}{\luacolorProcessBox}
%    \begin{macrocode}
\def\luacolorProcessBox#1{%
  \LuaCol@directlua{%
    oberdiek.luacolor.process(\number#1)%
  }%
}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macrocode}
\RequirePackage{atbegshi}[2007/09/09]
\AtBeginShipout{%
  \luacolorProcessBox\AtBeginShipoutBox
}
%    \end{macrocode}
%
%    Set default color.
%    \begin{macrocode}
\set@color
%    \end{macrocode}
%
%    \begin{macrocode}
\LuaCol@AtEnd
%&lt;/package&gt;
%    \end{macrocode}
%
% \subsection{Lua module}
%
%    \begin{macrocode}
%&lt;*lua&gt;
%    \end{macrocode}
%    Box zero contains a \cs{hbox} with the color \cs{special}.
%    That is analyzed to get the prefix for the color setting
%    \cs{special}.
%    \begin{macrocode}
module("oberdiek.luacolor", package.seeall)
%    \end{macrocode}
%
% \subsubsection{Driver detection}
%
%    \begin{macrocode}
local ifpdf
if tonumber(tex.pdfoutput) &gt; 0 then
  ifpdf = true
else
  ifpdf = false
end
local prefix
local prefixes = {
  dvips   = "color ",
  dvipdfm = "pdf:sc ",
  truetex = "textcolor:",
  pctexps = "ps::",
}
local patterns = {
  ["^color "]            = "dvips",
  ["^pdf: *begincolor "] = "dvipdfm",
  ["^pdf: *bcolor "]     = "dvipdfm",
  ["^pdf: *bc "]         = "dvipdfm",
  ["^pdf: *setcolor "]   = "dvipdfm",
  ["^pdf: *scolor "]     = "dvipdfm",
  ["^pdf: *sc "]         = "dvipdfm",
  ["^textcolor:"]        = "truetex",
  ["^ps::"]              = "pctexps",
}
%    \end{macrocode}
%    \begin{macrocode}
local function info(msg, term)
  local target = "log"
  if term then
    target = "term and log"
  end
  texio.write_nl(target, "Package luacolor info: " .. msg .. ".")
  texio.write_nl(target, "")
end
%    \end{macrocode}
%    \begin{macrocode}
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
    if v and v.subtype == 3 then -- special
      local data = v.data
      for pattern, driver in pairs(patterns) do
        if string.find(data, pattern) then
          prefix = prefixes[driver]
          tex.write(driver)
          return
        end
      end
      info("\\special{" .. data .. "}", true)
      return
    end
  end
  info("Missing \\special", true)
end
%    \end{macrocode}
%
% \subsubsection{Color strings}
%
%    \begin{macrocode}
local map = {
  n = 0,
}
function get(color)
  local n = map[color]
  if not n then
    n = map.n + 1
    map.n = n
    map[n] = color
    map[color] = n
  end
  tex.write("" .. n)
end
%    \end{macrocode}
%
% \subsubsection{Attribute register}
%
%    \begin{macrocode}
local attribute
function setattribute(attr)
  attribute = attr
end
%    \end{macrocode}
%
% \subsubsection{Whatsit insertion}
%
%    \begin{macrocode}
function process(box)
  local color = ""
  local list = tex.getbox(box)
  traverse(list, color)
end
%    \end{macrocode}
%    \begin{macrocode}
local LIST = 1
local COLOR = 2
local type = {
  [node.id("hlist")] = LIST,
  [node.id("vlist")] = LIST,
  [node.id("rule")]  = COLOR,
  [node.id("glyph")] = COLOR,
  [node.id("disc")]  = COLOR,
}
local subtype = {
  [3] = COLOR, -- special
  [8] = COLOR, -- pdf_literal
}
local mode = 2 -- luatex.pdfliteral.direct
local WHATSIT = node.id("whatsit")
local SPECIAL = 3
local PDFLITERAL = 8
%    \end{macrocode}
%    \begin{macrocode}
function traverse(list, color)
  if not list then
    return color
  end
  if type[list.id] ~= LIST then
    texio.write_nl("!!! Error: Wrong list type: " .. node.type(list.id))
    return color
  end
%&lt;debug&gt;texio.write_nl("traverse: " .. node.type(list.id))
  local head = list.list
  for n in node.traverse(head) do
%&lt;debug&gt;texio.write_nl("  node: " .. node.type(n.id))
    local type = type[n.id]
    if type == LIST then
      color = traverse(n, color)
    elseif type == COLOR
           or (type == WHATSIT
               and subtype[n.subtype]) then
      local v = node.has_attribute(n, attribute)
      if v then
        local newColor = map[v]
        if newColor ~= color then
          color = newColor
          local newNode
          if ifpdf then
            newNode = node.new(WHATSIT, PDFLITERAL)
            newNode.mode = mode
            newNode.data = color
          else
            newNode = node.new(WHATSIT, SPECIAL)
            newNode.data = prefix .. color
          end
          if head == n then
            newNode.next = head
            local old_prev = head.prev
            head.prev = newNode
            head = newNode
            head.prev = old_prev
          else
            head = node.insert_before(head, n, newNode)
          end
        end
      end
    end
  end
  list.list = head
  return color
end
%    \end{macrocode}
%
%    \begin{macrocode}
%&lt;/lua&gt;
%    \end{macrocode}
%
% \section{Test}
%
%    \begin{macrocode}
%&lt;*test1&gt;
\documentclass{article}
\usepackage{color}
%&lt;/test1&gt;
%    \end{macrocode}
% \subsection{Catcode checks for loading}
%
%    \begin{macrocode}
%&lt;*test1&gt;
%    \end{macrocode}
%    \begin{macrocode}
\catcode`\{=1 %
\catcode`\}=2 %
\catcode`\#=6 %
\catcode`\@=11 %
\expandafter\ifx\csname count@\endcsname\relax
  \countdef\count@=255 %
\fi
\expandafter\ifx\csname @gobble\endcsname\relax
  \long\def\@gobble#1{}%
\fi
\expandafter\ifx\csname @firstofone\endcsname\relax
  \long\def\@firstofone#1{#1}%
\fi
\expandafter\ifx\csname loop\endcsname\relax
  \expandafter\@firstofone
\else
  \expandafter\@gobble
\fi
{%
  \def\loop#1\repeat{%
    \def\body{#1}%
    \iterate
  }%
  \def\iterate{%
    \body
      \let\next\iterate
    \else
      \let\next\relax
    \fi
    \next
  }%
  \let\repeat=\fi
}%
\def\RestoreCatcodes{}
\count@=0 %
\loop
  \edef\RestoreCatcodes{%
    \RestoreCatcodes
    \catcode\the\count@=\the\catcode\count@\relax
  }%
\ifnum\count@&lt;255 %
  \advance\count@ 1 %
\repeat

\def\RangeCatcodeInvalid#1#2{%
  \count@=#1\relax
  \loop
    \catcode\count@=15 %
  \ifnum\count@&lt;#2\relax
    \advance\count@ 1 %
  \repeat
}
\expandafter\ifx\csname LoadCommand\endcsname\relax
  \def\LoadCommand{\input luacolor.sty\relax}%
\fi
\def\Test{%
  \RangeCatcodeInvalid{0}{47}%
  \RangeCatcodeInvalid{58}{64}%
  \RangeCatcodeInvalid{91}{96}%
  \RangeCatcodeInvalid{123}{255}%
  \catcode`\@=12 %
  \catcode`\\=0 %
  \catcode`\{=1 %
  \catcode`\}=2 %
  \catcode`\#=6 %
  \catcode`\[=12 %
  \catcode`\]=12 %
  \catcode`\%=14 %
  \catcode`\ =10 %
  \catcode13=5 %
  \LoadCommand
  \RestoreCatcodes
}
\Test
\csname @@end\endcsname
\end
%    \end{macrocode}
%    \begin{macrocode}
%&lt;/test1&gt;
%    \end{macrocode}
%
% \subsection{Driver detection}
%
%    \begin{macrocode}
%&lt;*test2&gt;
\NeedsTeXFormat{LaTeX2e}
\ifcsname driver\endcsname
  \expandafter\PassOptionsToPackage\expandafter{\driver}{color}%
  \pdfoutput=0 %
\fi
\documentclass{minimal}
\usepackage{luacolor}[2009/04/10]
\csname @@end\endcsname
\end
%&lt;/test2&gt;
%    \end{macrocode}
%
%    \begin{macrocode}
%&lt;*test3&gt;
\NeedsTeXFormat{LaTeX2e}
%    \end{macrocode}
%    \begin{macrocode}
\documentclass{minimal}
\usepackage{luacolor}[2009/04/10]
\usepackage{qstest}
\IncludeTests{*}
\LogTests{log}{*}{*}
\makeatletter
%    \end{macrocode}
%    \begin{macrocode}
\@@end
%&lt;/test3&gt;
%    \end{macrocode}
%
% \subsection{Short test for \plainTeX}
%
%    \begin{macrocode}
%&lt;*test4&gt;
\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
%&lt;/test4&gt;
%    \end{macrocode}
%
% \section{Installation}
%
% \subsection{Download}
%
% \paragraph{Package.} This package is available on
% CTAN\footnote{\url{ftp://ftp.ctan.org/tex-archive/}}:
% \begin{description}
% \item[\CTAN{macros/latex/contrib/oberdiek/luacolor.dtx}] The source file.
% \item[\CTAN{macros/latex/contrib/oberdiek/luacolor.pdf}] Documentation.
% \end{description}
%
%
% \paragraph{Bundle.} All the packages of the bundle `oberdiek'
% are also available in a TDS compliant ZIP archive. There
% the packages are already unpacked and the documentation files
% are generated. The files and directories obey the TDS standard.
% \begin{description}
% \item[\CTAN{install/macros/latex/contrib/oberdiek.tds.zip}]
% \end{description}
% \emph{TDS} refers to the standard ``A Directory Structure
% for \TeX\ Files'' (\CTAN{tds/tds.pdf}). Directories
% with \xfile{texmf} in their name are usually organized this way.
%
% \subsection{Bundle installation}
%
% \paragraph{Unpacking.} Unpack the \xfile{oberdiek.tds.zip} in the
% TDS tree (also known as \xfile{texmf} tree) of your choice.
% Example (linux):
% \begin{quote}
%   |unzip oberdiek.tds.zip -d ~/texmf|
% \end{quote}
%
% \paragraph{Script installation.}
% Check the directory \xfile{TDS:scripts/oberdiek/} for
% scripts that need further installation steps.
% Package \xpackage{attachfile2} comes with the Perl script
% \xfile{pdfatfi.pl} that should be installed in such a way
% that it can be called as \texttt{pdfatfi}.
% Example (linux):
% \begin{quote}
%   |chmod +x scripts/oberdiek/pdfatfi.pl|\\
%   |cp scripts/oberdiek/pdfatfi.pl /usr/local/bin/|
% \end{quote}
%
% \subsection{Package installation}
%
% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting
% \docstrip\ archive. The files are extracted by running the
% \xfile{.dtx} through \plainTeX:
% \begin{quote}
%   \verb|tex luacolor.dtx|
% \end{quote}
%
% \paragraph{TDS.} Now the different files must be moved into
% the different directories in your installation TDS tree
% (also known as \xfile{texmf} tree):
% \begin{quote}
% \def\t{^^A
% \begin{tabular}{@{}&gt;{\ttfamily}l@{ $\rightarrow$ }&gt;{\ttfamily}l@{}}
%   luacolor.sty &amp; tex/latex/oberdiek/luacolor.sty\\
%   oberdiek.luacolor.lua &amp; scripts/oberdiek/oberdiek.luacolor.lua\\
%   luacolor.lua &amp; scripts/oberdiek/luacolor.lua\\
%   luacolor.pdf &amp; doc/latex/oberdiek/luacolor.pdf\\
%   test/luacolor-test1.tex &amp; doc/latex/oberdiek/test/luacolor-test1.tex\\
%   test/luacolor-test2.tex &amp; doc/latex/oberdiek/test/luacolor-test2.tex\\
%   test/luacolor-test3.tex &amp; doc/latex/oberdiek/test/luacolor-test3.tex\\
%   luacolor.dtx &amp; source/latex/oberdiek/luacolor.dtx\\
% \end{tabular}^^A
% }^^A
% \sbox0{\t}^^A
% \ifdim\wd0&gt;\linewidth
%   \begingroup
%     \advance\linewidth by\leftmargin
%     \advance\linewidth by\rightmargin
%   \edef\x{\endgroup
%     \def\noexpand\lw{\the\linewidth}^^A
%   }\x
%   \def\lwbox{^^A
%     \leavevmode
%     \hbox to \linewidth{^^A
%       \kern-\leftmargin\relax
%       \hss
%       \usebox0
%       \hss
%       \kern-\rightmargin\relax
%     }^^A
%   }^^A
%   \ifdim\wd0&gt;\lw
%     \sbox0{\small\t}^^A
%     \ifdim\wd0&gt;\linewidth
%       \ifdim\wd0&gt;\lw
%         \sbox0{\footnotesize\t}^^A
%         \ifdim\wd0&gt;\linewidth
%           \ifdim\wd0&gt;\lw
%             \sbox0{\scriptsize\t}^^A
%             \ifdim\wd0&gt;\linewidth
%               \ifdim\wd0&gt;\lw
%                 \sbox0{\tiny\t}^^A
%                 \ifdim\wd0&gt;\linewidth
%                   \lwbox
%                 \else
%                   \usebox0
%                 \fi
%               \else
%                 \lwbox
%               \fi
%             \else
%               \usebox0
%             \fi
%           \else
%             \lwbox
%           \fi
%         \else
%           \usebox0
%         \fi
%       \else
%         \lwbox
%       \fi
%     \else
%       \usebox0
%     \fi
%   \else
%     \lwbox
%   \fi
% \else
%   \usebox0
% \fi
% \end{quote}
% If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's
% TDS installing feature, then some files can already be in the right
% place, see the documentation of \docstrip.
%
% \subsection{Refresh file name databases}
%
% If your \TeX~distribution
% (\teTeX, \mikTeX, \dots) relies on file name databases, you must refresh
% these. For example, \teTeX\ users run \verb|texhash| or
% \verb|mktexlsr|.
%
% \subsection{Some details for the interested}
%
% \paragraph{Attached source.}
%
% The PDF documentation on CTAN also includes the
% \xfile{.dtx} source file. It can be extracted by
% AcrobatReader 6 or higher. Another option is \textsf{pdftk},
% e.g. unpack the file into the current directory:
% \begin{quote}
%   \verb|pdftk luacolor.pdf unpack_files output .|
% \end{quote}
%
% \paragraph{Unpacking with \LaTeX.}
% The \xfile{.dtx} chooses its action depending on the format:
% \begin{description}
% \item[\plainTeX:] Run \docstrip\ and extract the files.
% \item[\LaTeX:] Generate the documentation.
% \end{description}
% If you insist on using \LaTeX\ for \docstrip\ (really,
% \docstrip\ does not need \LaTeX), then inform the autodetect routine
% about your intention:
% \begin{quote}
%   \verb|latex \let\install=y\input{luacolor.dtx}|
% \end{quote}
% Do not forget to quote the argument according to the demands
% of your shell.
%
% \paragraph{Generating the documentation.}
% You can use both the \xfile{.dtx} or the \xfile{.drv} to generate
% the documentation. The process can be configured by the
% configuration file \xfile{ltxdoc.cfg}. For instance, put this
% line into this file, if you want to have A4 as paper format:
% \begin{quote}
%   \verb|\PassOptionsToClass{a4paper}{article}|
% \end{quote}
% An example follows how to generate the
% documentation with pdf\LaTeX:
% \begin{quote}
%\begin{verbatim}
%pdflatex luacolor.dtx
%makeindex -s gind.ist luacolor.idx
%pdflatex luacolor.dtx
%makeindex -s gind.ist luacolor.idx
%pdflatex luacolor.dtx
%\end{verbatim}
% \end{quote}
%
% \begin{History}
%   \begin{Version}{2007/12/12 v1.0}
%   \item
%     First public version.
%   \end{Version}
%   \begin{Version}{2009/04/10 v1.1}
%   \item
%     Fixes for changed syntax of \cs{directlua} in \LuaTeX\ 0.36.
%   \end{Version}
% \end{History}
%
% \PrintIndex
%
% \Finale
\endinput
</pre></body></html>