From 61022469573c70d6e80ea4689ea626d3c6656534 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 15 May 2010 00:33:52 +0000 Subject: new latex package colordoc (13may10) git-svn-id: svn://tug.org/texlive/trunk@18270 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/colordoc/colordoc.sty | 161 ++++++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/colordoc/colordoc.sty (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/colordoc/colordoc.sty b/Master/texmf-dist/tex/latex/colordoc/colordoc.sty new file mode 100644 index 00000000000..63fe6ddad09 --- /dev/null +++ b/Master/texmf-dist/tex/latex/colordoc/colordoc.sty @@ -0,0 +1,161 @@ +%% +%% This is file `colordoc.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% colordoc.dtx (with options: `package') +%% +%% Copyright 2010 Federico Garcia +%% +\NeedsTeXFormat{LaTeX2e}[1995/12/01] +\ProvidesPackage{colordoc}[2010/04/18 Documentation in TeXnicolor (Federico Garcia)] +\let\doc@macrocode\macro@code +\def\@makebracesactive{\catcode`\{\active\catcode`\}\active} +\def\macro@name#1{% + \edef\macro@namepart{\macro@namepart#1}% Like in doc + \ifx\macro@namepart\colordoc@new\let\futuremacro@style\textnew\fi + \ifx\macro@namepart\colordoc@newif\@ifcheckallowedfalse\fi + \ifx\macro@namepart\colordoc@if\if@ifcheckallowed + \gdef\macro@style{\@openingbrace}% + \else\global\@ifcheckallowedtrue\fi\fi + \futurelet\next\more@macroname% Like in doc + } +\def\macro@finish{% + \ifx\macro@namepart\colordoc@newenvironment\let\futuremacro@style\relax\fi + \ifx\macro@namepart\colordoc@newcounter\let\futuremacro@style\relax\fi + \ifx\macro@namepart\colordoc@def\let\futuremacro@style\textnew\fi + \ifx\macro@namepart\colordoc@edef\let\futuremacro@style\textnew\fi + \ifx\macro@namepart\colordoc@gdef\let\futuremacro@style\textnew\fi + \ifx\macro@namepart\colordoc@xdef\let\futuremacro@style\textnew\fi + \ifx\macro@namepart\colordoc@renewcommand\let\futuremacro@style\textnew\fi + \ifx\macro@namepart\colordoc@providecommand\let\futuremacro@style\textnew\fi + \ifx\macro@namepart\colordoc@loop\let\macro@style\@openingbrace\@ifcheckallowedfalse\fi + \ifx\macro@namepart\colordoc@repeat\let\macro@style\@closingbrace\fi + \ifx\macro@namepart\colordoc@fi\let\macro@style\@closingbrace\fi + \ifx\macro@namepart\colordoc@else\def\macro@style{\@closingbrace\relax\@openingbrace}\fi + \ifx\macro@namepart\colordoc@csname\let\macro@style\@openingbrace\fi + \ifx\macro@namepart\colordoc@endcsname\let\macro@style\@closingbrace\fi + \macro@style\macro@namepart\global\let\macro@style\relax + \global\let\macro@style\futuremacro@style\global\let\futuremacro@style\relax + \ifnot@excluded% From here on like in doc + \edef\@tempa{\noexpand\SpecialIndex{\bslash\macro@namepart}}% + \@tempa \fi} +\newif\if@ifcheckallowed\@ifcheckallowedtrue +\def\colordoc@csname{csname} \def\colordoc@endcsname{endcsname} +\def\colordoc@def{def} \def\colordoc@edef{edef} +\def\colordoc@gdef{gdef} \def\colordoc@xdef{xdef} +\def\colordoc@if{if} \def\colordoc@else{else} \def\colordoc@fi{fi} +\def\colordoc@loop{loop} \def\colordoc@repeat{repeat} +\def\colordoc@new{new} \def\colordoc@newif{newif} +\def\colordoc@newcounter{newcounter}\def\colordoc@newenvironment{newenvironment} +\def\colordoc@providecommand{providecommand} +\def\colordoc@renewcommand{renewcommand} +\newif\ifcolorcode@ +\DeclareOption{numbers}{% + \def\macro@code{\doc@macrocode\@makebracesactive} + \colorcode@false + \let\colordoc@scheme\relax + \def\textnew#1{\textit{\underline#1\/}} + \def\@openingbrace#1{\global\advance\BraceLevel\@ne#1\textsubscript{\the\BraceLevel}} + \def\@closingbrace{\textsubscript{\the\BraceLevel}\global\advance\BraceLevel\m@ne} + } +\DeclareOption{numbered}{% + \def\macro@code{\doc@macrocode\@makebracesactive} + \colorcode@false + \let\colordoc@scheme\relax + \def\textnew#1{\textit{\underline#1\/}} + \def\@openingbrace#1{\advance\BraceLevel\@ne#1\textsubscript{\the\BraceLevel}} + \def\@closingbrace{\textsubscript{\the\BraceLevel}\advance\BraceLevel\m@ne} + } +\DeclareOption{nothing}{% + \let\@openingbrace\relax + \let\@closingbrace\relax + \colorcode@false + \let\colordoc@scheme\relax + \let\textnew\relax + } +\DeclareOption{braces}{% + \def\macro@code{\doc@macrocode\@makebracesactive} + \colorcode@true + \let\@colorcode\relax + \def\colordoc@scheme{\braces@colorscheme} + \def\@openingbrace#1{\@modinc\BraceLevel{\@bracecolor#1}} + \def\@closingbrace#1{{\@bracecolor#1}\@moddecr\BraceLevel} + } +\DeclareOption{contents}{% + \colorcode@true + \def\colordoc@scheme{\contents@colorscheme} + \def\macro@code{\doc@macrocode\@makebracesactive\@bracecolor} + \let\docendmacro@code\endmacro@code + \def\endmacro@code{\docendmacro@code\normalcolor} + \let\doctheCodelineNo\theCodelineNo + \def\theCodelineNo{\normalcolor\doctheCodelineNo} + \def\@openingbrace#1{#1\@modinc\BraceLevel + \global\let\@codecolor\@bracecolor\@codecolor} + \def\@closingbrace{\@moddecr\BraceLevel + \global\let\@codecolor\@bracecolor\@codecolor} + } +\DeclareOption*{\typeout{Unknown option (`\CurrentOption')}} +\ExecuteOptions{braces} +\ProcessOptions +\ifcolorcode@\RequirePackage{color}\else\RequirePackage{fixltx2e}\fi +\newcount\BraceLevel \BraceLevel\z@ +\bgroup +\catcode`\[\@ne\catcode`\]\tw@ +\@makebracesactive +\gdef{[\@openingbrace[\char'173]] +\gdef}[\@closingbrace[\char'175]] +\catcode`\|\z@\catcode`\%12 +\catcode`\ \active\catcode`\\\active +|gdef|xmacro@code#1% \end{macrocode}[#1|end[macrocode]] +|catcode`| 12|gdef|sxmacro@code#1% \end{macrocode*}[#1|end[macrocode*]]|egroup +\def\@modinc#1{% + \global\advance#1\@ne + \ifnum#1>\@colorlevels + \global#1\@ne\fi} +\def\@moddecr#1{% + \global\advance#1\m@ne + \ifnum#1>\z@\else + \global#1\@colorlevels\fi} +\def\@bracecolor{\@nameuse{@color\the\BraceLevel}} +\def\ColorLevels#1{% + \@colorlevels#1% + \@tempcnta\@colorlevels + \loop\ifnum\@tempcnta>\z@ + \expandafter\edef\csname @color\the\@tempcnta\endcsname{% + \noexpand\color{color-\the\@tempcnta}} + \advance\@tempcnta\m@ne + \repeat + } +\newcount\@colorlevels +\def\braces@colorscheme{% + \ColorLevels4 + \BraceLevel\z@ + \definecolor{color-0}{rgb}{0,0,0} + \definecolor{color-1}{cmyk}{1,.5,0,.3} + \definecolor{color-2}{cmyk}{0,1,0,.2} + \definecolor{color-3}{rgb}{0,.6,0} + \definecolor{color-4}{cmyk}{0,0,1,.6} + \def\textnew##1{\textit{\color{color-def}##1\/}} + \definecolor{color-def}{rgb}{0.8,0,0} + } +\def\contents@colorscheme{% + \ColorLevels5 + \BraceLevel\@ne + \definecolor{color-0}{rgb}{0,0,0} + \definecolor{color-1}{cmyk}{0,.5,0,0.6} + \definecolor{color-2}{rgb}{0,0,0} + \definecolor{color-3}{rgb}{.15,0.15,.75} + \definecolor{color-4}{rgb}{0,.47,0} + \definecolor{color-5}{cmyk}{0,0.72,1,.4} + \def\textnew##1{\textit{\color{color-def}##1\/}} + \definecolor{color-def}{rgb}{0.8,0,0} + } +\EnableCrossrefs +\let\macro@style\relax +\let\futuremacro@style\relax +\colordoc@scheme +\endinput +%% +%% End of file `colordoc.sty'. -- cgit v1.2.3