~sbinet/star-tex

4bf55d042d941a4421f99178e31673b42b779a6d — Sebastien Binet 4 months ago 5a592cd
dvi,internal/tds: add Handler infrastructure and color handling

Signed-off-by: Sebastien Binet <s@sbinet.org>
A dvi/color.go => dvi/color.go +443 -0
@@ 0,0 1,443 @@
// Copyright ©2021 The star-tex Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package dvi

import (
	"bufio"
	"bytes"
	"fmt"
	"image/color"
	"io"
	"strconv"
	"strings"

	"star-tex.org/x/tex/kpath"
)

type colorHandler interface {
	Color() color.Color
	Background() color.Color
}

type nilColorHandler struct{}

func (nilColorHandler) Color() color.Color      { return color.Black }
func (nilColorHandler) Background() color.Color { return color.White }

var _ colorHandler = (*nilColorHandler)(nil)

// ColorHandler handles special DVI commands related with colors.
type ColorHandler struct {
	stack []color.Color
	r     colorReader
	names map[string]color.Color
}

var (
	_ Handler      = (*ColorHandler)(nil)
	_ colorHandler = (*ColorHandler)(nil)
)

func NewColorHandler(ktx kpath.Context) *ColorHandler {
	ch := &ColorHandler{
		stack: []color.Color{
			color.White,
			color.Black,
		},
	}
	ch.names = newColorNames(ktx, &ch.r)

	return ch
}

// Color returns the current color from the ColorHandler.
func (ch *ColorHandler) Color() color.Color {
	return ch.stack[len(ch.stack)-1]
}

// Background returns the current color background from the ColorHandler.
func (ch *ColorHandler) Background() color.Color {
	return ch.stack[0]
}

var (
	colorPrefix = []byte("color ")
	bkgPrefix   = []byte("background ")

	colorPushPrefix = []byte("color push ")
	colorPopPrefix  = []byte("color pop")
)

// Handle handles a special DVI command.
func (ch *ColorHandler) Handle(p []byte) error {
	if bytes.HasPrefix(p, colorPrefix) {
		return ch.handleColor(p)
	}

	if bytes.HasPrefix(p, bkgPrefix) {
		return ch.handleBkg(p)
	}

	return ErrSkipHandler
}

func (ch *ColorHandler) handleColor(p []byte) error {
	switch {
	case bytes.HasPrefix(p, colorPushPrefix):
		ch.stack = append(ch.stack, ch.colorFrom(p[len(colorPushPrefix):]))
	case bytes.HasPrefix(p, colorPopPrefix):
		ch.stack = ch.stack[:len(ch.stack)-1]
	default:
		// reset stack.
		ch.stack[0] = ch.colorFrom(p[6:])
		ch.stack = ch.stack[:1]
	}
	return nil
}

func (ch *ColorHandler) handleBkg(p []byte) error {
	ch.stack[0] = ch.colorFrom(p[len(bkgPrefix):])
	return nil
}

func (ch *ColorHandler) colorFrom(p []byte) color.Color {
	s := string(p)
	switch {
	case s == "Black":
		return color.Black

	case s == "White":
		return color.White

	case strings.HasPrefix(s, "gray "):
		ch.r.reset(p[5:])
		v := ch.r.f64()
		return color.Gray{Y: v}

	case strings.HasPrefix(s, "rgb "):
		ch.r.reset(p[4:])
		r := ch.r.f64()
		g := ch.r.f64()
		b := ch.r.f64()
		return color.RGBA{R: r, G: g, B: b, A: 255}

	case strings.HasPrefix(s, "Gray "):
		ch.r.reset(p[5:])
		v := ch.r.u8()
		return color.Gray{Y: v}

	case strings.HasPrefix(s, "RGB "):
		ch.r.reset(p[4:])
		r := ch.r.u8()
		g := ch.r.u8()
		b := ch.r.u8()
		return color.RGBA{R: r, G: g, B: b, A: 255}

	case strings.HasPrefix(s, "HTML "):
		ch.r.reset(p[5:])
		r, g, b := ch.r.hex()
		return color.RGBA{R: r, G: g, B: b, A: 255}

	case strings.HasPrefix(s, "cmy "):
		ch.r.reset(p[4:])
		c := ch.r.f64()
		m := ch.r.f64()
		y := ch.r.f64()
		return color.CMYK{C: c, M: m, Y: y}

	case strings.HasPrefix(s, "cmyk "):
		ch.r.reset(p[5:])
		c := ch.r.f64()
		m := ch.r.f64()
		y := ch.r.f64()
		k := ch.r.f64()
		return color.CMYK{C: c, M: m, Y: y, K: k}

	case strings.HasPrefix(s, "hsb "):
		ch.r.reset(p[4:])
		return ch.r.hsb()

	case strings.HasPrefix(s, "HSB "):
		ch.r.reset(p[4:])
		return ch.r.hsbi()

	default:
		// color name from a "well-known" file.
		name := strings.TrimSpace(s)
		c, ok := ch.names[name]
		if !ok {
			panic(fmt.Errorf("could not find color %q", name))
		}
		return c
	}
}

type colorReader struct {
	p []byte
	c int
}

func (cr *colorReader) reset(p []byte) {
	cr.p = p
	cr.c = 0
}

func (cr *colorReader) token() []byte {
	var (
		beg = cr.c
		end = cr.c
	)
	i := bytes.Index(cr.p[cr.c:], []byte(" "))
	switch i {
	case -1:
		end = len(cr.p)
		cr.c = end
	default:
		end = cr.c + i
		cr.c = end + 1
	}
	return cr.p[beg:end]
}

func (cr *colorReader) f64() uint8 {
	tok := cr.token()
	v, err := strconv.ParseFloat(string(tok), 64)
	if err != nil {
		panic(err) // FIXME(sbinet): warn only?
	}
	return toU8(v)
}

func (cr *colorReader) u8() uint8 {
	tok := cr.token()
	v, err := strconv.ParseInt(string(tok), 10, 8)
	if err != nil {
		panic(err) // FIXME(sbinet): warn only?
	}
	return uint8(v)
}

func (cr *colorReader) hex() (uint8, uint8, uint8) {
	tok := cr.token()
	b, err := strconv.ParseInt(string(tok), 16, 64)
	if err != nil {
		panic(err) // FIXME(sbinet): warn only?
	}
	r := b / 65536
	g := b / 256
	b -= g * 256
	g -= r * 256
	return uint8(r), uint8(g), uint8(b)
}

func (cr *colorReader) hsb() color.Color {
	data := []string{
		string(cr.token()),
		string(cr.token()),
		string(cr.token()),
	}
	return colorFrom("hsb", data)
}

func (cr *colorReader) hsbi() color.Color {
	data := []string{
		string(cr.token()),
		string(cr.token()),
		string(cr.token()),
	}
	return colorFrom("HSB", data)
}

func newColorNames(ktx kpath.Context, cr *colorReader) map[string]color.Color {
	names := make(map[string]color.Color)
	for _, name := range []string{"xcolor.sty", "dvipsnam.def", "svgnam.def", "x11nam.def"} {
		fname, err := ktx.Find(name)
		if err != nil {
			panic(err) // FIXME(sbinet): warn only ?
		}
		f, err := ktx.Open(fname)
		if err != nil {
			panic(err) // FIXME(sbinet): warn only ?
		}
		defer f.Close()

		colorNamesFrom(cr, f, fname, &names)
	}
	return names
}

func colorNamesFrom(cr *colorReader, f io.Reader, fname string, db *map[string]color.Color) {
	sc := bufio.NewScanner(f)
	for sc.Scan() {
		line := bytes.TrimSpace(sc.Bytes())
		switch {
		case bytes.HasPrefix(line, []byte(`\definecolorset`)):
			toks := brackets(string(line))
			models := strings.Split(toks[1], "/")
		definecolorset:
			for sc.Scan() {
				text := sc.Text()
				line := strings.Trim(text, ";%{ }")
				beg := strings.Index(line, ",")
				end := strings.Index(line, "/")
				name := strings.TrimSpace(line[:beg])
				data := strings.TrimSpace(line[beg+1 : end])
				(*db)[name] = colorFrom(models[0], strings.Split(data, ","))
				if strings.Contains(text, "}") {
					break definecolorset
				}
			}

		case bytes.HasPrefix(line, []byte(`\preparecolorset`)):
			// FIXME(sbinet): handle different models rgb/cmy/ ?
		preparecolorset:
			for sc.Scan() {
				line := strings.Trim(sc.Text(), ";%}")
				if strings.HasPrefix(line, `\endinput`) {
					break preparecolorset
				}
				toks := strings.Split(line, ",")
				r := atof(toks[1])
				g := atof(toks[2])
				b := atof(toks[2])
				(*db)[toks[0]] = color.RGBA{toU8(r), toU8(g), toU8(b), 255}
			}

		case bytes.HasPrefix(line, []byte(`\DefineNamedColor`)):
			// line should be of the form:
			// \DefineNamedColor{named}{GreenYellow}   {cmyk}{0.15,0,0.69,0}
			toks := brackets(string(line[len(`\DefineNamedColor`):]))
			name := toks[1]
			model := toks[2]
			toks = strings.Split(toks[3], ",")
			switch model {
			case "cmyk":
				c := atof(strings.TrimSpace(toks[0]))
				m := atof(strings.TrimSpace(toks[1]))
				y := atof(strings.TrimSpace(toks[2]))
				k := atof(strings.TrimSpace(toks[3]))
				(*db)[name] = color.CMYK{toU8(c), toU8(m), toU8(y), toU8(k)}
			case "rgb":
				r := atof(strings.TrimSpace(toks[1]))
				g := atof(strings.TrimSpace(toks[2]))
				b := atof(strings.TrimSpace(toks[3]))
				(*db)[name] = color.RGBA{toU8(r), toU8(g), toU8(b), 255}
			default:
				panic(fmt.Errorf("unknown color model %q in %q", model, line))
			}
		}
	}

	if err := sc.Err(); err != nil {
		panic(fmt.Errorf("could not scan %q: %+v", fname, err))
	}
}

func colorFrom(model string, data []string) color.Color {
	switch model {
	case "rgb":
		r := atof(data[0])
		g := atof(data[1])
		b := atof(data[2])
		return color.RGBA{R: toU8(r), G: toU8(g), B: toU8(b), A: 255}

	case "hsb", "HSB":
		hu := atof(data[0])
		sa := atof(data[1])
		br := atof(data[2])
		if model == "HSB" {
			hu /= 255
			sa /= 255
			br /= 255
		}

		var (
			r float64
			g float64
			b float64

			i = int(6 * hu)
			f = 6*hu - float64(i)
		)
		switch i {
		case 0:
			r = br * (1 - sa*0)
			g = br * (1 - sa*(1-f))
			b = br * (1 - sa*1)
		case 1:
			r = br * (1 - sa*f)
			g = br * (1 - sa*0)
			b = br * (1 - sa*1)
		case 2:
			r = br * (1 - sa*1)
			g = br * (1 - sa*0)
			b = br * (1 - sa*(1-f))
		case 3:
			r = br * (1 - sa*1)
			g = br * (1 - sa*f)
			b = br * (1 - sa*0)
		case 4:
			r = br * (1 - sa*(1-f))
			g = br * (1 - sa*1)
			b = br * (1 - sa*0)
		case 5:
			r = br * (1 - sa*0)
			g = br * (1 - sa*1)
			b = br * (1 - sa*f)
		default:
			r = br * (1 - sa*0)
			g = br * (1 - sa*1)
			b = br * (1 - sa*1)
		}
		return color.RGBA{R: toU8(r), G: toU8(g), B: toU8(b), A: 255}

	case "cmyk":
		c := atof(data[0])
		m := atof(data[1])
		y := atof(data[2])
		k := atof(data[3])
		return color.CMYK{C: toU8(c), M: toU8(m), Y: toU8(y), K: toU8(k)}

	case "gray":
		y := atof(data[0])
		return color.Gray{Y: toU8(y)}

	default:
		panic(fmt.Errorf("unknown color model=%q with data=%q", model, data))
	}
}

func toU8(v float64) uint8 {
	return uint8(255*v + 0.5)
}

func atof(s string) float64 {
	v, err := strconv.ParseFloat(s, 64)
	if err != nil {
		panic(err) // FIXME(sbinet): warn only?
	}
	return v
}

func brackets(s string) []string {
	var (
		vs []string
		o  strings.Builder
	)
	for _, v := range s {
		switch v {
		case '{', '}':
			if o.Len() > 0 {
				vs = append(vs, o.String())
			}
			o.Reset()
		case ' ':
			// ignore.
		default:
			o.WriteString(string(v))
		}
	}
	return vs
}

A dvi/color_test.go => dvi/color_test.go +285 -0
@@ 0,0 1,285 @@
// Copyright ©2021 The star-tex Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package dvi

import (
	"bytes"
	"errors"
	"image/color"
	"reflect"
	"testing"

	"star-tex.org/x/tex/kpath"
)

func TestColorHandler(t *testing.T) {
	ch := NewColorHandler(kpath.New())
	if !reflect.DeepEqual(ch.stack, []color.Color{color.White, color.Black}) {
		t.Fatalf("invalid color-handler stack: %+v", ch.stack)
	}
	for _, tc := range []struct {
		data  []byte
		stack []color.Color
		want  error
	}{
		{
			data:  []byte("background red"),
			stack: []color.Color{color.RGBA{R: 255, A: 255}, color.Black},
		},
		{
			data:  []byte("xxx some unknown special"),
			want:  ErrSkipHandler,
			stack: []color.Color{color.RGBA{R: 255, A: 255}, color.Black},
		},
		{
			data:  []byte("background white"),
			stack: []color.Color{color.Gray{Y: 255}, color.Black},
		},
		{
			data:  []byte("background White"),
			stack: []color.Color{color.White, color.Black},
		},
		{
			data:  []byte("color push Black"),
			stack: []color.Color{color.White, color.Black, color.Black},
		},
		{
			data:  []byte("color pop"),
			stack: []color.Color{color.White, color.Black},
		},
		{
			data:  []byte("color push White"),
			stack: []color.Color{color.White, color.Black, color.White},
		},
		{
			data:  []byte("color pop"),
			stack: []color.Color{color.White, color.Black},
		},
		{
			data:  []byte("color push gray 0.5"),
			stack: []color.Color{color.White, color.Black, color.Gray{Y: 128}},
		},
		{
			data:  []byte("color pop"),
			stack: []color.Color{color.White, color.Black},
		},
		{
			data:  []byte("color push rgb 1 0 0"),
			stack: []color.Color{color.White, color.Black, color.RGBA{R: 255, A: 255}},
		},
		{
			data:  []byte("color pop"),
			stack: []color.Color{color.White, color.Black},
		},
		{
			data:  []byte("color push Gray 100"),
			stack: []color.Color{color.White, color.Black, color.Gray{Y: 100}},
		},
		{
			data:  []byte("color pop"),
			stack: []color.Color{color.White, color.Black},
		},
		{
			data:  []byte("color push RGB 0 0 100"),
			stack: []color.Color{color.White, color.Black, color.RGBA{B: 100, A: 255}},
		},
		{
			data:  []byte("color pop"),
			stack: []color.Color{color.White, color.Black},
		},
		{
			data:  []byte("color push HTML ffaadd"),
			stack: []color.Color{color.White, color.Black, color.RGBA{R: 255, G: 170, B: 221, A: 255}},
		},
		{
			data:  []byte("color pop"),
			stack: []color.Color{color.White, color.Black},
		},
		{
			data:  []byte("color push cmy 0.2 0.3 0.4"),
			stack: []color.Color{color.White, color.Black, color.CMYK{C: 51, M: 77, Y: 102}},
		},
		{
			data:  []byte("color pop"),
			stack: []color.Color{color.White, color.Black},
		},
		{
			data:  []byte("color push cmyk 0.2 0.3 0.4 0.5"),
			stack: []color.Color{color.White, color.Black, color.CMYK{C: 51, M: 77, Y: 102, K: 128}},
		},
		{
			data:  []byte("color pop"),
			stack: []color.Color{color.White, color.Black},
		},
		{
			data:  []byte("color push hsb .66667 1 1"), // blue
			stack: []color.Color{color.White, color.Black, color.RGBA{B: 255, A: 255}},
		},
		{
			data:  []byte("color pop"),
			stack: []color.Color{color.White, color.Black},
		},
		{
			data:  []byte("color push hsb .5 1 .5"), // teal
			stack: []color.Color{color.White, color.Black, color.RGBA{G: 128, B: 128, A: 255}},
		},
		{
			data:  []byte("color pop"),
			stack: []color.Color{color.White, color.Black},
		},
		{
			data:  []byte("color push HSB 128 255 128"), // teal
			stack: []color.Color{color.White, color.Black, color.RGBA{G: 126, B: 128, A: 255}},
		},
		{
			data:  []byte("color pop"),
			stack: []color.Color{color.White, color.Black},
		},
		{
			data:  []byte("color push  BurntOrange"),
			stack: []color.Color{color.White, color.Black, color.CMYK{M: 130, Y: 255}},
		},
		{
			data:  []byte("color pop"),
			stack: []color.Color{color.White, color.Black},
		},
		{
			data:  []byte("color  BurntOrange"),
			stack: []color.Color{color.CMYK{M: 130, Y: 255}},
		},
		{
			data:  []byte("color pop"),
			stack: []color.Color{},
		},
	} {
		got := ch.Handle(tc.data)
		if !errors.Is(got, tc.want) {
			t.Fatalf("invalid handler output for %q:\ngot= %+v\nwant=%+v", tc.data, got, tc.want)
		}
		if !reflect.DeepEqual(ch.stack, tc.stack) {
			t.Fatalf("invalid handler stack for %q:\ngot= %+v\nwant=%+v", tc.data, ch.stack, tc.stack)
		}
	}
}

func TestBrackets(t *testing.T) {
	for _, tc := range []struct {
		line string
		want []string
	}{
		{
			line: ``,
			want: nil,
		},
		{
			line: `\DefineNamedColor{named}{GreenYellow}   {cmyk}{0.15,0,0.69,0}`,
			want: []string{`\DefineNamedColor`, "named", "GreenYellow", "cmyk", "0.15,0,0.69,0"},
		},
		{
			line: `\DefineNamedColor{named}{GreenYellow}   {cmyk}{0.15, 0, 0.69, 0}`,
			want: []string{`\DefineNamedColor`, "named", "GreenYellow", "cmyk", "0.15,0,0.69,0"},
		},
	} {
		t.Run("", func(t *testing.T) {
			got := brackets(tc.line)
			if !reflect.DeepEqual(got, tc.want) {
				t.Fatalf(
					"invalid tokens. line: %q\ngot= %q\nwant=%q",
					tc.line,
					got, tc.want,
				)
			}
		})
	}
}

func TestParsePrepareColorSet(t *testing.T) {
	raw := `%% in the same archive or directory.)
%%
\ProvidesFile{svgnam.def}
 [2016/05/11 v2.12 Predefined colors according to SVG 1.1 (UK)]
%%
%% ----------------------------------------------------------------
%% Copyright (C) 2003-2016 by Dr. Uwe Kern <xcolor at ukern dot de>
%% ----------------------------------------------------------------
%%
\def\colornameprefix{XC@}
\preparecolorset{rgb}{}{}{%
AliceBlue,.94,.972,1;%
AntiqueWhite,.98,.92,.844;%
YellowGreen,.604,.804,.196}
\endinput
%%
%% End of file
`
	got := make(map[string]color.Color)
	colorNamesFrom(&colorReader{}, bytes.NewReader([]byte(raw)), "file.def", &got)
	want := map[string]color.Color{
		"AliceBlue":    color.RGBA{R: 240, G: 248, B: 248, A: 255},
		"AntiqueWhite": color.RGBA{R: 250, G: 235, B: 235, A: 255},
		"YellowGreen":  color.RGBA{R: 154, G: 205, B: 205, A: 255},
	}

	if !reflect.DeepEqual(got, want) {
		t.Fatalf("invalid color names map:\ngot= %+v\nwant= %+v", got, want)
	}
}

func TestColorNames(t *testing.T) {
	ktx := kpath.New()
	names := newColorNames(ktx, &colorReader{})

	for _, tc := range []struct {
		name string
		want color.Color
	}{
		// from xcolor.sty.
		{
			name: "blue",
			want: color.RGBA{B: 255, A: 255},
		},
		{
			name: "cyan",
			want: color.CMYK{C: 255},
		},
		{
			name: "magenta",
			want: color.CMYK{M: 255},
		},
		{
			name: "darkgray",
			want: color.Gray{Y: 64},
		},
		{
			name: "gray",
			want: color.Gray{Y: 128},
		},
		// from dvipsnam.def
		{
			name: "BurntOrange",
			want: color.CMYK{M: 130, Y: 255},
		},
		// from svgnam.def
		{
			name: "YellowGreen",
			want: color.RGBA{R: 154, G: 205, B: 205, A: 255},
		},
		// from x11nam.def
		{
			name: "Purple0",
			want: color.RGBA{R: 160, G: 32, B: 32, A: 255},
		},
	} {
		t.Run(tc.name, func(t *testing.T) {
			got, ok := names[tc.name]
			if !ok {
				t.Fatalf("could not find %q", tc.name)
			}
			if !reflect.DeepEqual(got, tc.want) {
				t.Fatalf("invalid color:\ngot= %+v\nwant=%+v", got, tc.want)
			}
		})
	}
}

M dvi/dvi.go => dvi/dvi.go +23 -0
@@ 11,6 11,7 @@
package dvi // import "star-tex.org/x/tex/dvi"

import (
	"errors"
	"fmt"
	"image/color"
	"io"


@@ 73,3 74,25 @@ func Dump(r io.Reader, f func(cmd Cmd) error) error {

	return nil
}

// Handler handles special DVI XXXn commands.
// Users can customize how a DVI Machine will handle these commands.
//
// Special commands are usually written in DVI files with an opaque payload
// of bytes, starting with a "well known" prefix.
// Ex:
//   color push gray 0
//   color pop
//   color push  BurntOrange
//
// A Handler should return ErrSkipHandler if does not know how to handle a given
// special command data.
type Handler interface {
	// Handle handles a special DVI command.
	Handle(p []byte) error
}

// ErrSkipHandler is used as a return value from Handler.Handle to indicate
// that the Handler should be skipped and is not suited to handle that special
// command.
var ErrSkipHandler = errors.New("dvi: skip handler")

M dvi/machine.go => dvi/machine.go +26 -4
@@ 5,8 5,8 @@
package dvi

import (
	"errors"
	"fmt"
	"image/color"
	"io"
	"sort"
	"strings"


@@ 34,6 34,10 @@ type Machine struct {

	w   io.Writer
	buf []byte // 80-col buffer of text

	handlers []Handler // list of registered special handlers for CmdXXXn commands.

	color colorHandler // special handling of colors
}

// NewMachine creates a new DVI machine.


@@ 46,7 50,7 @@ func NewMachine(opts ...Option) Machine {
		}
	}

	return Machine{
	m := Machine{
		ktx:   cfg.ctx,
		rdr:   cfg.rdr,
		state: newState(),


@@ 56,7 60,19 @@ func NewMachine(opts ...Option) Machine {

		w:   cfg.out,
		buf: make([]byte, 0, 80-len("[]\n")),

		handlers: cfg.handlers,
		color:    nilColorHandler{},
	}

	for _, h := range m.handlers {
		if hh, ok := h.(colorHandler); ok {
			m.color = hh
			break
		}
	}

	return m
}

// Run executes the whole DVI program on this DVI machine.


@@ 932,7 948,7 @@ func (m *Machine) drawGlyph(op opCode, cmd int32) error {
		return err
	}

	m.rdr.DrawGlyph(cur.h, cur.v, *fnt, rune(cmd), color.Black)
	m.rdr.DrawGlyph(cur.h, cur.v, *fnt, rune(cmd), m.color.Color())

	adv, ok := fnt.advance(rune(cmd))
	if !ok {


@@ 959,7 975,7 @@ func (m *Machine) drawRule(op opCode, height, width int32) error {
	}

	cur := m.state.cur()
	m.rdr.DrawRule(cur.h, cur.v, width, height, color.Black)
	m.rdr.DrawRule(cur.h, cur.v, width, height, m.color.Color())

	if op == opPutRule {
		return nil


@@ 1145,6 1161,12 @@ func (m *Machine) outVMove(v int32) int32 {
}

func (m *Machine) handleSpecial(p []byte) error {
	for _, h := range m.handlers {
		err := h.Handle(p)
		if err == nil || !errors.Is(err, ErrSkipHandler) {
			return err
		}
	}
	return nil
}


M dvi/option.go => dvi/option.go +11 -0
@@ 20,6 20,8 @@ type config struct {

	xoff int32 // width offset
	yoff int32 // height offset

	handlers []Handler
}

func newConfig() *config {


@@ 64,3 66,12 @@ func WithOffsetY(v fixed.Int12_20) Option {
		return nil
	}
}

// WithHandlers specifies a list of Handlers a DVI Machine will use to
// handle the XXXn special commands.
func WithHandlers(hs ...Handler) Option {
	return func(cfg *config) error {
		cfg.handlers = hs
		return nil
	}
}

A internal/tds/tex/latex/graphics/dvipsnam.def => internal/tds/tex/latex/graphics/dvipsnam.def +90 -0
@@ 0,0 1,90 @@
%%
%% This is file `dvipsnam.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% drivers.dtx  (with options: `dvipsnames')
%% 
%% drivers.dtx Copyright (C) 1994      David Carlisle Sebastian Rahtz
%%             Copyright (C) 1995 1996 1997 1998 1999 David Carlisle
%%             Copyright (C) 2000-2020 David Carlisle, LaTeX3 Project
%%
%% This file is part of the Standard LaTeX `Graphics Bundle'.
%% It may be distributed under the terms of the LaTeX Project Public
%% License, as described in lppl.txt in the base LaTeX distribution.
%% Either version 1.3 or, at your option, any later version.
%%
\ProvidesFile{dvipsnam.def}
        [2016/06/17 v3.0m Driver-dependent file (DPC,SPQR)]
\DefineNamedColor{named}{GreenYellow}   {cmyk}{0.15,0,0.69,0}
\DefineNamedColor{named}{Yellow}        {cmyk}{0,0,1,0}
\DefineNamedColor{named}{Goldenrod}     {cmyk}{0,0.10,0.84,0}
\DefineNamedColor{named}{Dandelion}     {cmyk}{0,0.29,0.84,0}
\DefineNamedColor{named}{Apricot}       {cmyk}{0,0.32,0.52,0}
\DefineNamedColor{named}{Peach}         {cmyk}{0,0.50,0.70,0}
\DefineNamedColor{named}{Melon}         {cmyk}{0,0.46,0.50,0}
\DefineNamedColor{named}{YellowOrange}  {cmyk}{0,0.42,1,0}
\DefineNamedColor{named}{Orange}        {cmyk}{0,0.61,0.87,0}
\DefineNamedColor{named}{BurntOrange}   {cmyk}{0,0.51,1,0}
\DefineNamedColor{named}{Bittersweet}   {cmyk}{0,0.75,1,0.24}
\DefineNamedColor{named}{RedOrange}     {cmyk}{0,0.77,0.87,0}
\DefineNamedColor{named}{Mahogany}      {cmyk}{0,0.85,0.87,0.35}
\DefineNamedColor{named}{Maroon}        {cmyk}{0,0.87,0.68,0.32}
\DefineNamedColor{named}{BrickRed}      {cmyk}{0,0.89,0.94,0.28}
\DefineNamedColor{named}{Red}           {cmyk}{0,1,1,0}
\DefineNamedColor{named}{OrangeRed}     {cmyk}{0,1,0.50,0}
\DefineNamedColor{named}{RubineRed}     {cmyk}{0,1,0.13,0}
\DefineNamedColor{named}{WildStrawberry}{cmyk}{0,0.96,0.39,0}
\DefineNamedColor{named}{Salmon}        {cmyk}{0,0.53,0.38,0}
\DefineNamedColor{named}{CarnationPink} {cmyk}{0,0.63,0,0}
\DefineNamedColor{named}{Magenta}       {cmyk}{0,1,0,0}
\DefineNamedColor{named}{VioletRed}     {cmyk}{0,0.81,0,0}
\DefineNamedColor{named}{Rhodamine}     {cmyk}{0,0.82,0,0}
\DefineNamedColor{named}{Mulberry}      {cmyk}{0.34,0.90,0,0.02}
\DefineNamedColor{named}{RedViolet}     {cmyk}{0.07,0.90,0,0.34}
\DefineNamedColor{named}{Fuchsia}       {cmyk}{0.47,0.91,0,0.08}
\DefineNamedColor{named}{Lavender}      {cmyk}{0,0.48,0,0}
\DefineNamedColor{named}{Thistle}       {cmyk}{0.12,0.59,0,0}
\DefineNamedColor{named}{Orchid}        {cmyk}{0.32,0.64,0,0}
\DefineNamedColor{named}{DarkOrchid}    {cmyk}{0.40,0.80,0.20,0}
\DefineNamedColor{named}{Purple}        {cmyk}{0.45,0.86,0,0}
\DefineNamedColor{named}{Plum}          {cmyk}{0.50,1,0,0}
\DefineNamedColor{named}{Violet}        {cmyk}{0.79,0.88,0,0}
\DefineNamedColor{named}{RoyalPurple}   {cmyk}{0.75,0.90,0,0}
\DefineNamedColor{named}{BlueViolet}    {cmyk}{0.86,0.91,0,0.04}
\DefineNamedColor{named}{Periwinkle}    {cmyk}{0.57,0.55,0,0}
\DefineNamedColor{named}{CadetBlue}     {cmyk}{0.62,0.57,0.23,0}
\DefineNamedColor{named}{CornflowerBlue}{cmyk}{0.65,0.13,0,0}
\DefineNamedColor{named}{MidnightBlue}  {cmyk}{0.98,0.13,0,0.43}
\DefineNamedColor{named}{NavyBlue}      {cmyk}{0.94,0.54,0,0}
\DefineNamedColor{named}{RoyalBlue}     {cmyk}{1,0.50,0,0}
\DefineNamedColor{named}{Blue}          {cmyk}{1,1,0,0}
\DefineNamedColor{named}{Cerulean}      {cmyk}{0.94,0.11,0,0}
\DefineNamedColor{named}{Cyan}          {cmyk}{1,0,0,0}
\DefineNamedColor{named}{ProcessBlue}   {cmyk}{0.96,0,0,0}
\DefineNamedColor{named}{SkyBlue}       {cmyk}{0.62,0,0.12,0}
\DefineNamedColor{named}{Turquoise}     {cmyk}{0.85,0,0.20,0}
\DefineNamedColor{named}{TealBlue}      {cmyk}{0.86,0,0.34,0.02}
\DefineNamedColor{named}{Aquamarine}    {cmyk}{0.82,0,0.30,0}
\DefineNamedColor{named}{BlueGreen}     {cmyk}{0.85,0,0.33,0}
\DefineNamedColor{named}{Emerald}       {cmyk}{1,0,0.50,0}
\DefineNamedColor{named}{JungleGreen}   {cmyk}{0.99,0,0.52,0}
\DefineNamedColor{named}{SeaGreen}      {cmyk}{0.69,0,0.50,0}
\DefineNamedColor{named}{Green}         {cmyk}{1,0,1,0}
\DefineNamedColor{named}{ForestGreen}   {cmyk}{0.91,0,0.88,0.12}
\DefineNamedColor{named}{PineGreen}     {cmyk}{0.92,0,0.59,0.25}
\DefineNamedColor{named}{LimeGreen}     {cmyk}{0.50,0,1,0}
\DefineNamedColor{named}{YellowGreen}   {cmyk}{0.44,0,0.74,0}
\DefineNamedColor{named}{SpringGreen}   {cmyk}{0.26,0,0.76,0}
\DefineNamedColor{named}{OliveGreen}    {cmyk}{0.64,0,0.95,0.40}
\DefineNamedColor{named}{RawSienna}     {cmyk}{0,0.72,1,0.45}
\DefineNamedColor{named}{Sepia}         {cmyk}{0,0.83,1,0.70}
\DefineNamedColor{named}{Brown}         {cmyk}{0,0.81,1,0.60}
\DefineNamedColor{named}{Tan}           {cmyk}{0.14,0.42,0.56,0}
\DefineNamedColor{named}{Gray}          {cmyk}{0,0,0,0.50}
\DefineNamedColor{named}{Black}         {cmyk}{0,0,0,1}
\DefineNamedColor{named}{White}         {cmyk}{0,0,0,0}
\endinput
%%
%% End of file `dvipsnam.def'.

A internal/tds/tex/latex/xcolor/svgnam.def => internal/tds/tex/latex/xcolor/svgnam.def +186 -0
@@ 0,0 1,186 @@
%%
%% This is file `svgnam.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% xcolor.dtx  (with options: `svgnames')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from svgnam.def.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file xcolor.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%%
\ProvidesFile{svgnam.def}
 [2016/05/11 v2.12 Predefined colors according to SVG 1.1 (UK)]
%%
%% ----------------------------------------------------------------
%% Copyright (C) 2003-2016 by Dr. Uwe Kern <xcolor at ukern dot de>
%% ----------------------------------------------------------------
%%
\def\colornameprefix{XC@}
\preparecolorset{rgb}{}{}{%
AliceBlue,.94,.972,1;%
AntiqueWhite,.98,.92,.844;%
Aqua,0,1,1;%
Aquamarine,.498,1,.83;%
Azure,.94,1,1;%
Beige,.96,.96,.864;%
Bisque,1,.894,.77;%
Black,0,0,0;%
BlanchedAlmond,1,.92,.804;%
Blue,0,0,1;%
BlueViolet,.54,.17,.888;%
Brown,.648,.165,.165;%
BurlyWood,.87,.72,.53;%
CadetBlue,.372,.62,.628;%
Chartreuse,.498,1,0;%
Chocolate,.824,.41,.116;%
Coral,1,.498,.312;%
CornflowerBlue,.392,.585,.93;%
Cornsilk,1,.972,.864;%
Crimson,.864,.08,.235;%
Cyan,0,1,1;%
DarkBlue,0,0,.545;%
DarkCyan,0,.545,.545;%
DarkGoldenrod,.72,.525,.044;%
DarkGray,.664,.664,.664;%
DarkGreen,0,.392,0;%
DarkGrey,.664,.664,.664;%
DarkKhaki,.74,.716,.42;%
DarkMagenta,.545,0,.545;%
DarkOliveGreen,.332,.42,.185;%
DarkOrange,1,.55,0;%
DarkOrchid,.6,.196,.8;%
DarkRed,.545,0,0;%
DarkSalmon,.912,.59,.48;%
DarkSeaGreen,.56,.736,.56;%
DarkSlateBlue,.284,.24,.545;%
DarkSlateGray,.185,.31,.31;%
DarkSlateGrey,.185,.31,.31;%
DarkTurquoise,0,.808,.82;%
DarkViolet,.58,0,.828;%
DeepPink,1,.08,.576;%
DeepSkyBlue,0,.75,1;%
DimGray,.41,.41,.41;%
DimGrey,.41,.41,.41;%
DodgerBlue,.116,.565,1;%
FireBrick,.698,.132,.132;%
FloralWhite,1,.98,.94;%
ForestGreen,.132,.545,.132;%
Fuchsia,1,0,1;%
Gainsboro,.864,.864,.864;%
GhostWhite,.972,.972,1;%
Gold,1,.844,0;%
Goldenrod,.855,.648,.125;%
Gray,.5,.5,.5;%
Green,0,.5,0;%
GreenYellow,.68,1,.185;%
Grey,.5,.5,.5;%
Honeydew,.94,1,.94;%
HotPink,1,.41,.705;%
IndianRed,.804,.36,.36;%
Indigo,.294,0,.51;%
Ivory,1,1,.94;%
Khaki,.94,.9,.55;%
Lavender,.9,.9,.98;%
LavenderBlush,1,.94,.96;%
LawnGreen,.488,.99,0;%
LemonChiffon,1,.98,.804;%
LightBlue,.68,.848,.9;%
LightCoral,.94,.5,.5;%
LightCyan,.88,1,1;%
LightGoldenrod,.933,.867,.51;%
LightGoldenrodYellow,.98,.98,.824;%
LightGray,.828,.828,.828;%
LightGreen,.565,.932,.565;%
LightGrey,.828,.828,.828;%
LightPink,1,.712,.756;%
LightSalmon,1,.628,.48;%
LightSeaGreen,.125,.698,.668;%
LightSkyBlue,.53,.808,.98;%
LightSlateBlue,.518,.44,1;%
LightSlateGray,.468,.532,.6;%
LightSlateGrey,.468,.532,.6;%
LightSteelBlue,.69,.77,.87;%
LightYellow,1,1,.88;%
Lime,0,1,0;%
LimeGreen,.196,.804,.196;%
Linen,.98,.94,.9;%
Magenta,1,0,1;%
Maroon,.5,0,0;%
MediumAquamarine,.4,.804,.668;%
MediumBlue,0,0,.804;%
MediumOrchid,.73,.332,.828;%
MediumPurple,.576,.44,.86;%
MediumSeaGreen,.235,.7,.444;%
MediumSlateBlue,.484,.408,.932;%
MediumSpringGreen,0,.98,.604;%
MediumTurquoise,.284,.82,.8;%
MediumVioletRed,.78,.084,.52;%
MidnightBlue,.098,.098,.44;%
MintCream,.96,1,.98;%
MistyRose,1,.894,.884;%
Moccasin,1,.894,.71;%
NavajoWhite,1,.87,.68;%
Navy,0,0,.5;%
NavyBlue,0,0,.5;%
OldLace,.992,.96,.9;%
Olive,.5,.5,0;%
OliveDrab,.42,.556,.136;%
Orange,1,.648,0;%
OrangeRed,1,.27,0;%
Orchid,.855,.44,.84;%
PaleGoldenrod,.932,.91,.668;%
PaleGreen,.596,.985,.596;%
PaleTurquoise,.688,.932,.932;%
PaleVioletRed,.86,.44,.576;%
PapayaWhip,1,.936,.835;%
PeachPuff,1,.855,.725;%
Peru,.804,.52,.248;%
Pink,1,.752,.796;%
Plum,.868,.628,.868;%
PowderBlue,.69,.88,.9;%
Purple,.5,0,.5;%
Red,1,0,0;%
RosyBrown,.736,.56,.56;%
RoyalBlue,.255,.41,.884;%
SaddleBrown,.545,.27,.075;%
Salmon,.98,.5,.448;%
SandyBrown,.956,.644,.376;%
SeaGreen,.18,.545,.34;%
Seashell,1,.96,.932;%
Sienna,.628,.32,.176;%
Silver,.752,.752,.752;%
SkyBlue,.53,.808,.92;%
SlateBlue,.415,.352,.804;%
SlateGray,.44,.5,.565;%
SlateGrey,.44,.5,.565;%
Snow,1,.98,.98;%
SpringGreen,0,1,.498;%
SteelBlue,.275,.51,.705;%
Tan,.824,.705,.55;%
Teal,0,.5,.5;%
Thistle,.848,.75,.848;%
Tomato,1,.39,.28;%
Turquoise,.25,.88,.815;%
Violet,.932,.51,.932;%
VioletRed,.816,.125,.565;%
Wheat,.96,.87,.7;%
White,1,1,1;%
WhiteSmoke,.96,.96,.96;%
Yellow,1,1,0;%
YellowGreen,.604,.804,.196}
\endinput
%%
%% End of file `svgnam.def'.

A internal/tds/tex/latex/xcolor/x11nam.def => internal/tds/tex/latex/xcolor/x11nam.def +352 -0
@@ 0,0 1,352 @@
%%
%% This is file `x11nam.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% xcolor.dtx  (with options: `x11names')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from x11nam.def.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file xcolor.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%%
\ProvidesFile{x11nam.def}
 [2016/05/11 v2.12 Predefined colors according to Unix/X11 (UK)]
%%
%% ----------------------------------------------------------------
%% Copyright (C) 2003-2016 by Dr. Uwe Kern <xcolor at ukern dot de>
%% ----------------------------------------------------------------
%%
\def\colornameprefix{XC@}
\preparecolorset{rgb}{}{}{%
AntiqueWhite1,1,.936,.86;%
AntiqueWhite2,.932,.875,.8;%
AntiqueWhite3,.804,.752,.69;%
AntiqueWhite4,.545,.512,.47;%
Aquamarine1,.498,1,.83;%
Aquamarine2,.464,.932,.776;%
Aquamarine3,.4,.804,.668;%
Aquamarine4,.27,.545,.455;%
Azure1,.94,1,1;%
Azure2,.88,.932,.932;%
Azure3,.756,.804,.804;%
Azure4,.512,.545,.545;%
Bisque1,1,.894,.77;%
Bisque2,.932,.835,.716;%
Bisque3,.804,.716,.62;%
Bisque4,.545,.49,.42;%
Blue1,0,0,1;%
Blue2,0,0,.932;%
Blue3,0,0,.804;%
Blue4,0,0,.545;%
Brown1,1,.25,.25;%
Brown2,.932,.23,.23;%
Brown3,.804,.2,.2;%
Brown4,.545,.136,.136;%
Burlywood1,1,.828,.608;%
Burlywood2,.932,.772,.57;%
Burlywood3,.804,.668,.49;%
Burlywood4,.545,.45,.332;%
CadetBlue1,.596,.96,1;%
CadetBlue2,.556,.898,.932;%
CadetBlue3,.48,.772,.804;%
CadetBlue4,.325,.525,.545;%
Chartreuse1,.498,1,0;%
Chartreuse2,.464,.932,0;%
Chartreuse3,.4,.804,0;%
Chartreuse4,.27,.545,0;%
Chocolate1,1,.498,.14;%
Chocolate2,.932,.464,.13;%
Chocolate3,.804,.4,.112;%
Chocolate4,.545,.27,.075;%
Coral1,1,.448,.336;%
Coral2,.932,.415,.312;%
Coral3,.804,.356,.27;%
Coral4,.545,.244,.185;%
Cornsilk1,1,.972,.864;%
Cornsilk2,.932,.91,.804;%
Cornsilk3,.804,.785,.694;%
Cornsilk4,.545,.532,.47;%
Cyan1,0,1,1;%
Cyan2,0,.932,.932;%
Cyan3,0,.804,.804;%
Cyan4,0,.545,.545;%
DarkGoldenrod1,1,.725,.06;%
DarkGoldenrod2,.932,.68,.055;%
DarkGoldenrod3,.804,.585,.048;%
DarkGoldenrod4,.545,.396,.03;%
DarkOliveGreen1,.792,1,.44;%
DarkOliveGreen2,.736,.932,.408;%
DarkOliveGreen3,.635,.804,.352;%
DarkOliveGreen4,.43,.545,.24;%
DarkOrange1,1,.498,0;%
DarkOrange2,.932,.464,0;%
DarkOrange3,.804,.4,0;%
DarkOrange4,.545,.27,0;%
DarkOrchid1,.75,.244,1;%
DarkOrchid2,.698,.228,.932;%
DarkOrchid3,.604,.196,.804;%
DarkOrchid4,.408,.132,.545;%
DarkSeaGreen1,.756,1,.756;%
DarkSeaGreen2,.705,.932,.705;%
DarkSeaGreen3,.608,.804,.608;%
DarkSeaGreen4,.41,.545,.41;%
DarkSlateGray1,.592,1,1;%
DarkSlateGray2,.552,.932,.932;%
DarkSlateGray3,.475,.804,.804;%
DarkSlateGray4,.32,.545,.545;%
DeepPink1,1,.08,.576;%
DeepPink2,.932,.07,.536;%
DeepPink3,.804,.064,.464;%
DeepPink4,.545,.04,.312;%
DeepSkyBlue1,0,.75,1;%
DeepSkyBlue2,0,.698,.932;%
DeepSkyBlue3,0,.604,.804;%
DeepSkyBlue4,0,.408,.545;%
DodgerBlue1,.116,.565,1;%
DodgerBlue2,.11,.525,.932;%
DodgerBlue3,.094,.455,.804;%
DodgerBlue4,.064,.305,.545;%
Firebrick1,1,.19,.19;%
Firebrick2,.932,.172,.172;%
Firebrick3,.804,.15,.15;%
Firebrick4,.545,.1,.1;%
Gold1,1,.844,0;%
Gold2,.932,.79,0;%
Gold3,.804,.68,0;%
Gold4,.545,.46,0;%
Goldenrod1,1,.756,.145;%
Goldenrod2,.932,.705,.132;%
Goldenrod3,.804,.608,.112;%
Goldenrod4,.545,.41,.08;%
Green1,0,1,0;%
Green2,0,.932,0;%
Green3,0,.804,0;%
Green4,0,.545,0;%
Honeydew1,.94,1,.94;%
Honeydew2,.88,.932,.88;%
Honeydew3,.756,.804,.756;%
Honeydew4,.512,.545,.512;%
HotPink1,1,.43,.705;%
HotPink2,.932,.415,.655;%
HotPink3,.804,.376,.565;%
HotPink4,.545,.228,.385;%
IndianRed1,1,.415,.415;%
IndianRed2,.932,.39,.39;%
IndianRed3,.804,.332,.332;%
IndianRed4,.545,.228,.228;%
Ivory1,1,1,.94;%
Ivory2,.932,.932,.88;%
Ivory3,.804,.804,.756;%
Ivory4,.545,.545,.512;%
Khaki1,1,.965,.56;%
Khaki2,.932,.9,.52;%
Khaki3,.804,.776,.45;%
Khaki4,.545,.525,.305;%
LavenderBlush1,1,.94,.96;%
LavenderBlush2,.932,.88,.898;%
LavenderBlush3,.804,.756,.772;%
LavenderBlush4,.545,.512,.525;%
LemonChiffon1,1,.98,.804;%
LemonChiffon2,.932,.912,.75;%
LemonChiffon3,.804,.79,.648;%
LemonChiffon4,.545,.536,.44;%
LightBlue1,.75,.936,1;%
LightBlue2,.698,.875,.932;%
LightBlue3,.604,.752,.804;%
LightBlue4,.408,.512,.545;%
LightCyan1,.88,1,1;%
LightCyan2,.82,.932,.932;%
LightCyan3,.705,.804,.804;%
LightCyan4,.48,.545,.545;%
LightGoldenrod1,1,.925,.545;%
LightGoldenrod2,.932,.864,.51;%
LightGoldenrod3,.804,.745,.44;%
LightGoldenrod4,.545,.505,.298;%
LightPink1,1,.684,.725;%
LightPink2,.932,.635,.68;%
LightPink3,.804,.55,.585;%
LightPink4,.545,.372,.396;%
LightSalmon1,1,.628,.48;%
LightSalmon2,.932,.585,.448;%
LightSalmon3,.804,.505,.385;%
LightSalmon4,.545,.34,.26;%
LightSkyBlue1,.69,.888,1;%
LightSkyBlue2,.644,.828,.932;%
LightSkyBlue3,.552,.712,.804;%
LightSkyBlue4,.376,.484,.545;%
LightSteelBlue1,.792,.884,1;%
LightSteelBlue2,.736,.824,.932;%
LightSteelBlue3,.635,.71,.804;%
LightSteelBlue4,.43,.484,.545;%
LightYellow1,1,1,.88;%
LightYellow2,.932,.932,.82;%
LightYellow3,.804,.804,.705;%
LightYellow4,.545,.545,.48;%
Magenta1,1,0,1;%
Magenta2,.932,0,.932;%
Magenta3,.804,0,.804;%
Magenta4,.545,0,.545;%
Maroon1,1,.204,.7;%
Maroon2,.932,.19,.655;%
Maroon3,.804,.16,.565;%
Maroon4,.545,.11,.385;%
MediumOrchid1,.88,.4,1;%
MediumOrchid2,.82,.372,.932;%
MediumOrchid3,.705,.32,.804;%
MediumOrchid4,.48,.215,.545;%
MediumPurple1,.67,.51,1;%
MediumPurple2,.624,.475,.932;%
MediumPurple3,.536,.408,.804;%
MediumPurple4,.365,.28,.545;%
MistyRose1,1,.894,.884;%
MistyRose2,.932,.835,.824;%
MistyRose3,.804,.716,.71;%
MistyRose4,.545,.49,.484;%
NavajoWhite1,1,.87,.68;%
NavajoWhite2,.932,.81,.63;%
NavajoWhite3,.804,.7,.545;%
NavajoWhite4,.545,.475,.37;%
OliveDrab1,.752,1,.244;%
OliveDrab2,.7,.932,.228;%
OliveDrab3,.604,.804,.196;%
OliveDrab4,.41,.545,.132;%
Orange1,1,.648,0;%
Orange2,.932,.604,0;%
Orange3,.804,.52,0;%
Orange4,.545,.352,0;%
OrangeRed1,1,.27,0;%
OrangeRed2,.932,.25,0;%
OrangeRed3,.804,.215,0;%
OrangeRed4,.545,.145,0;%
Orchid1,1,.512,.98;%
Orchid2,.932,.48,.912;%
Orchid3,.804,.41,.79;%
Orchid4,.545,.28,.536;%
PaleGreen1,.604,1,.604;%
PaleGreen2,.565,.932,.565;%
PaleGreen3,.488,.804,.488;%
PaleGreen4,.33,.545,.33;%
PaleTurquoise1,.732,1,1;%
PaleTurquoise2,.684,.932,.932;%
PaleTurquoise3,.59,.804,.804;%
PaleTurquoise4,.4,.545,.545;%
PaleVioletRed1,1,.51,.67;%
PaleVioletRed2,.932,.475,.624;%
PaleVioletRed3,.804,.408,.536;%
PaleVioletRed4,.545,.28,.365;%
PeachPuff1,1,.855,.725;%
PeachPuff2,.932,.796,.68;%
PeachPuff3,.804,.688,.585;%
PeachPuff4,.545,.468,.396;%
Pink1,1,.71,.772;%
Pink2,.932,.664,.72;%
Pink3,.804,.57,.62;%
Pink4,.545,.39,.424;%
Plum1,1,.732,1;%
Plum2,.932,.684,.932;%
Plum3,.804,.59,.804;%
Plum4,.545,.4,.545;%
Purple1,.608,.19,1;%
Purple2,.57,.172,.932;%
Purple3,.49,.15,.804;%
Purple4,.332,.1,.545;%
Red1,1,0,0;%
Red2,.932,0,0;%
Red3,.804,0,0;%
Red4,.545,0,0;%
RosyBrown1,1,.756,.756;%
RosyBrown2,.932,.705,.705;%
RosyBrown3,.804,.608,.608;%
RosyBrown4,.545,.41,.41;%
RoyalBlue1,.284,.464,1;%
RoyalBlue2,.264,.43,.932;%
RoyalBlue3,.228,.372,.804;%
RoyalBlue4,.152,.25,.545;%
Salmon1,1,.55,.41;%
Salmon2,.932,.51,.385;%
Salmon3,.804,.44,.33;%
Salmon4,.545,.298,.224;%
SeaGreen1,.33,1,.624;%
SeaGreen2,.305,.932,.58;%
SeaGreen3,.264,.804,.5;%
SeaGreen4,.18,.545,.34;%
Seashell1,1,.96,.932;%
Seashell2,.932,.898,.87;%
Seashell3,.804,.772,.75;%
Seashell4,.545,.525,.51;%
Sienna1,1,.51,.28;%
Sienna2,.932,.475,.26;%
Sienna3,.804,.408,.224;%
Sienna4,.545,.28,.15;%
SkyBlue1,.53,.808,1;%
SkyBlue2,.494,.752,.932;%
SkyBlue3,.424,.65,.804;%
SkyBlue4,.29,.44,.545;%
SlateBlue1,.512,.435,1;%
SlateBlue2,.48,.404,.932;%
SlateBlue3,.41,.35,.804;%
SlateBlue4,.28,.235,.545;%
SlateGray1,.776,.888,1;%
SlateGray2,.725,.828,.932;%
SlateGray3,.624,.712,.804;%
SlateGray4,.424,.484,.545;%
Snow1,1,.98,.98;%
Snow2,.932,.912,.912;%
Snow3,.804,.79,.79;%
Snow4,.545,.536,.536;%
SpringGreen1,0,1,.498;%
SpringGreen2,0,.932,.464;%
SpringGreen3,0,.804,.4;%
SpringGreen4,0,.545,.27;%
SteelBlue1,.39,.72,1;%
SteelBlue2,.36,.675,.932;%
SteelBlue3,.31,.58,.804;%
SteelBlue4,.21,.392,.545;%
Tan1,1,.648,.31;%
Tan2,.932,.604,.288;%
Tan3,.804,.52,.248;%
Tan4,.545,.352,.17;%
Thistle1,1,.884,1;%
Thistle2,.932,.824,.932;%
Thistle3,.804,.71,.804;%
Thistle4,.545,.484,.545;%
Tomato1,1,.39,.28;%
Tomato2,.932,.36,.26;%
Tomato3,.804,.31,.224;%
Tomato4,.545,.21,.15;%
Turquoise1,0,.96,1;%
Turquoise2,0,.898,.932;%
Turquoise3,0,.772,.804;%
Turquoise4,0,.525,.545;%
VioletRed1,1,.244,.59;%
VioletRed2,.932,.228,.55;%
VioletRed3,.804,.196,.47;%
VioletRed4,.545,.132,.32;%
Wheat1,1,.905,.73;%
Wheat2,.932,.848,.684;%
Wheat3,.804,.73,.59;%
Wheat4,.545,.494,.4;%
Yellow1,1,1,0;%
Yellow2,.932,.932,0;%
Yellow3,.804,.804,0;%
Yellow4,.545,.545,0;%
Gray0,.745,.745,.745;%
Green0,0,1,0;%
Grey0,.745,.745,.745;%
Maroon0,.69,.19,.376;%
Purple0,.628,.125,.94}
\endinput
%%
%% End of file `x11nam.def'.

A internal/tds/tex/latex/xcolor/xcolor.sty => internal/tds/tex/latex/xcolor/xcolor.sty +1460 -0
@@ 0,0 1,1460 @@
%%
%% This is file `xcolor.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% xcolor.dtx  (with options: `package')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from xcolor.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file xcolor.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%%
\ProvidesPackage{xcolor}
 [2016/05/11 v2.12 LaTeX color extensions (UK)]
%%
%% ----------------------------------------------------------------
%% Copyright (C) 2003-2016 by Dr. Uwe Kern <xcolor at ukern dot de>
%% ----------------------------------------------------------------
%%
%% Please send error reports and suggestions for
%% improvements to the above email address.
%%
%% This package contains code copied from
%%
%% color.dtx [1999/02/16 v1.0i Standard LaTeX Color (DPC)]
%% Copyright (C) 1994--1999 David Carlisle
%%
%% which is part of the Standard LaTeX `Graphics Bundle'.
%%
\NeedsTeXFormat{LaTeX2e}
\expandafter\edef\csname XC@catcodes\endcsname
 {\catcode33 \the\catcode33 % !
  \catcode34 \the\catcode34 % "
  \catcode39 \the\catcode39 % '
  \catcode42 \the\catcode42 % *
  \catcode44 \the\catcode44 % ,
  \catcode45 \the\catcode45 % -
  \catcode46 \the\catcode46 % .
  \catcode47 \the\catcode47 % /
  \catcode58 \the\catcode58 % :
  \catcode59 \the\catcode59 % ;
  \catcode60 \the\catcode60 % <
  \catcode61 \the\catcode61 % =
  \catcode62 \the\catcode62 % >
  \catcode63 \the\catcode63 % ?
  \catcode64 \the\catcode64 % @
  \catcode94 \the\catcode94 % ^
  \catcode96 \the\catcode96 % `
  \catcode`\noexpand\^^A\the\catcode`\^^A\relax}
\catcode64 11 %
\@makeother\! \@makeother\" \@makeother\' \@makeother\* \@makeother\,
\@makeother\- \@makeother\. \@makeother\/ \@makeother\: \@makeother\;
\@makeother\< \@makeother\= \@makeother\> \@makeother\? \@makeother\`
\catcode94 7 %
\catcode`\^^A=14 %
\edef\XC@@{\expandafter\noexpand\csname\string\XC@@\endcsname}
\newif\ifcolors@ \colors@true
\newif\ifcolorerrors@
\newif\ifglobalcolors \globalcolorsfalse
\newif\ifdefinecolors \definecolorstrue
\newif\ifconvertcolorsD
\newif\ifconvertcolorsU
\newif\ifblendcolors
\newif\ifmaskcolors
\newif\ifXC@@fbox \XC@@fboxtrue
\newif\ifXC@@tst
\def\c@lor@error#1%
 {\ifcolorerrors@\PackageError{xcolor}{Undefined color #1}\@ehc
  \else\PackageWarning{xcolor}{Undefined color #1}\fi}
\def\XC@append#1#2%
 {\ifx#1\@undefined\def#1{#2}\else\ifx#1\relax\def#1{#2}\else
  \toks@\expandafter{#1#2}\edef#1{\the\toks@}\fi\fi}
\def\XC@let@cc#1{\expandafter\XC@let@Nc\csname#1\endcsname}
\providecommand*\@namelet[1]{\expandafter\XC@let@Nc\csname#1\endcsname}
\def\XC@let@Nc#1#2{\expandafter\let\expandafter#1\csname#2\endcsname}
\def\XC@let@cN#1{\expandafter\let\csname#1\endcsname}
\def\@namexdef#1{\expandafter\xdef\csname #1\endcsname}
\def\aftergroupdef#1#2%
 {\expandafter\endgroup\expandafter\def\expandafter#1\expandafter{#2}}
\def\aftergroupedef#1#2%
 {\edef\@@tmp{\def\noexpand#1{#2}}\expandafter\endgroup\@@tmp}
\begingroup
\catcode`\!=13 \catcode`\:=13 \catcode`\-=13 \catcode`\+=13
\catcode`\;=13 \catcode`\/=13 \catcode`\"=13 \catcode`\>=13
\gdef\XC@edef#1#2%
 {\begingroup
  \ifnum\catcode`\!=13 \edef!{\string!}\fi
  \ifnum\catcode`\:=13 \edef:{\string:}\fi
  \ifnum\catcode`\-=13 \edef-{\string-}\fi
  \ifnum\catcode`\+=13 \edef+{\string+}\fi
  \ifnum\catcode`\;=13 \edef;{\string;}\fi
  \ifnum\catcode`\"=13 \edef"{\string"}\fi
  \ifnum\catcode`\>=13 \edef>{\string>}\fi
  \edef#1{#2}\@onelevel@sanitize#1\aftergroupdef#1#1}
\gdef\XC@mdef#1#2%
 {\begingroup
  \ifnum\catcode`\/=13 \edef/{\string/}\fi
  \ifnum\catcode`\:=13 \edef:{\string:}\fi
  \edef#1{#2}\@onelevel@sanitize#1\aftergroupdef#1#1}
\endgroup
\def\XC@sdef#1#2{\edef#1{#2}\@onelevel@sanitize#1}
\def\@ifxempty#1{\@@ifxempty#1\@@ifxempty\XC@@}
\def\@@ifxempty#1#2\XC@@
 {\ifx#1\@@ifxempty
  \expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}
\long\def\XC@ifxcase#1#2#3%
 {\long\def\XC@if@##1##2%
   {\ifx#1##1%
      \toks@{##2}\expandafter\remove@to@nnil\else\expandafter\XC@if@\fi}%
  \XC@if@#2#1{#3}\@nnil\the\toks@}
\long\def\XC@ifcase#1#2#3%
 {\long\def\XC@if@##1##2%
   {\@expandtwoargs\in@{,#1,}{,##1,}\ifin@
      \toks@{##2}\expandafter\remove@to@nnil\else\expandafter\XC@if@\fi}%
  \XC@if@#2{#1}{#3}\@nnil\the\toks@}
\def\XC@@opt{,}
\def\@ifXCopt#1%
 {\@expandtwoargs\in@{,#1,}{\XC@@opt}%
  \ifin@\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}
\let\XC@@pkg\relax
\let\XC@declareoption\@declareoption
\long\def\@declareoption#1#2%
 {\XC@declareoption{#1}{\edef\XC@@opt{\XC@@opt#1,}#2}}
\def\selectcolormodel#1%
 {\@ifundefined{XC@mod@#1}%
   {\c@lor@error{target model `#1'}}%
   {\expandafter\ifx\csname XC@mod@#1\endcsname\XC@mod@natural
      \def\XC@tgt@mod##1{##1}\convertcolorsDfalse\convertcolorsUfalse
    \else\expandafter\ifx\csname XC@mod@#1\endcsname\XC@mod@named
      \c@lor@error{target model `#1'}
    \else
      \edef\XC@tgt@mod##1{#1}\convertcolorsDtrue\convertcolorsUtrue
    \fi\fi}}
\@tfor\@@tmp:={Hsb}{tHsb}{ignore}{named}{ps}{wave}\do
 {\expandafter\XC@sdef\csname XC@mod@\@@tmp\endcsname{\@@tmp}}
\@tfor\@@tmp:={natural}{rgb}{cmy}{cmyk}{hsb}{gray}{RGB}{HTML}{HSB}{Gray}\do
 {\expandafter\XC@sdef\csname XC@mod@\@@tmp\endcsname{\@@tmp}%
  \edef\@@tmp
   {\noexpand\DeclareOption{\@@tmp}{\noexpand\selectcolormodel{\@@tmp}}}%
  \@@tmp}
\DeclareOption{monochrome}
 {\ExecuteOptions{hideerrors}%
  \AtEndOfPackage
   {\colors@false
    \def\set@color{\c@lor@special\m@ne
      {color push \current@color}\aftergroup\reset@color}%
    \def\reset@color{\c@lor@special\m@ne{color pop}}%
    \def\set@page@color{\c@lor@special\m@ne{background \current@color}}}}
\let\XC@@names\relax
\providecommand*\colornameprefix{XC@}
\let\XC@@nameprefix\colornameprefix
\def\XC@declarenames#1#2#3%
 {\DeclareOption{#1}{\XC@append\XC@@names
   {#3\definecolorstrue\input{#2.def}\definecolorstrue
    \let\colornameprefix\XC@@nameprefix}}
  \DeclareOption{#1*}{\XC@append\XC@@names
   {#3\definecolorsfalse\input{#2.def}\definecolorstrue
    \let\colornameprefix\XC@@nameprefix}}}
\XC@declarenames{dvipsnames}{dvipsnam}{\let\colornameprefix\@empty}
\XC@declarenames{svgnames}{svgnam}{}
\XC@declarenames{x11names}{x11nam}{}
\XC@declarenames{hksnames}%
 {hks\ifcase\paperquality k\or n\or k\or z\else n\fi nam}{}
\XC@declarenames{pmsnames}{pmsnam}{}
\XC@declarenames{ralnames}{ralnam}{}
\DeclareOption{table}{\XC@append\XC@@pkg{\RequirePackage{colortbl}}}
\DeclareOption{fixpdftex}{\XC@append\XC@@pkg{\RequirePackage{pdfcolmk}}}
\DeclareOption{hyperref}
 {\@tfor\@@tmp:={cite}{file}{link}{menu}{page}{run}{url}\do
   {\expandafter\edef\csname KV@Hyp@x\@@tmp bordercolor\endcsname #1%
     {\noexpand\XC@bordercolor{\@@tmp}{#1}}}%
  \AtEndOfPackage
   {\GetGinDriver\def\KV@Hyp@xpdfborder#1{\edef\@pdfborder{#1}}%
    \@tfor\@@tmp:={dvips}\do
     {\ifx\GinDriver\@@tmp
       \def\KV@Hyp@xpdfborder#1%
        {\edef\@pdfborder{#1}\expandafter\XC@pdfborder\@pdfborder\relax}%
      \@break@tfor\fi}}}
\providecommand*\Gin@driver{}
\@tfor\@@tmp:={dvipdf}{dvipdfm}{dvipdfmx}{dvips}{dvipsone}{dviwin}%
              {emtex}{luatex}{pctex32}{pctexhp}{pctexps}{pctexwin}{pdftex}%
              {tcidvi}{textures}{truetex}{vtex}{xetex}\do
 {\edef\@@tmp{\noexpand\DeclareOption{\@@tmp}%
    {\def\noexpand\Gin@driver{\@@tmp.def}}}%
  \@@tmp}
\DeclareOption{dviwindo}{\ExecuteOptions{dvipsone}}
\DeclareOption{oztex}{\ExecuteOptions{dvips}}
\DeclareOption{xdvi}{\ExecuteOptions{dvips,monochrome}}
\DeclareOption{xcdraw}{\def\XC@@xcd@{1}}
\DeclareOption{noxcdraw}{\def\XC@@xcd@{-1}}
\DeclareOption{fixinclude}{\def\XC@@xcf@{1}}
\DeclareOption{prologue}{\def\XC@@xcp@{1}}
\DeclareOption{kernelfbox}{\XC@@fboxfalse}
\DeclareOption{showerrors}{\colorerrors@true}
\DeclareOption{hideerrors}{\colorerrors@false}
\DeclareOption{debugshow}{\catcode`\^^A=9 \let\GDebug\typeout}
\DeclareOption*%
 {\PackageInfo{xcolor}{Package option `\CurrentOption' ignored}}
\def\XC@@xcd@{-1}
\def\XC@@xcf@{-1}
\def\XC@@xcp@{-1}
\ExecuteOptions{natural,showerrors}
\InputIfFileExists{color.cfg}{}{}
\let\@declareoption\XC@declareoption
\ProcessOptions\relax
\edef\Gin@driver{\Gin@driver}
\if!\Gin@driver!
  \PackageError{xcolor}
    {No driver specified}
    {You should make a default driver option in a file \MessageBreak
     color.cfg\MessageBreak
     eg: \protect\ExecuteOptions{dvips}}
\else
  \PackageInfo{xcolor}{Driver file: \Gin@driver}
  \@ifundefined{ver@\Gin@driver}{\input{\Gin@driver}}{}
  \def\@@tmp#1.def{\def\XC@@drv{#1}}
  \expandafter\@@tmp\Gin@driver
\fi
\count@\XC@@xcd@ \advance\count@\XC@@xcf@ \advance\count@\XC@@xcp@\relax
\ifnum\count@>-3
  \XC@ifcase\XC@@drv
   {{dvips,pctex32}%
    {\def\@tempa{0}
     \def\XC@special#1{\special{ps:XC!b}\special{"#1}\special{ps:XC!e}}}%
    {pdftex}%
    {\def\@tempa{1}
     \def\XC@special#1{\pdfliteral{ q #1 Q }}}%
    {luatex}%
    {\def\@tempa{1}
     \ifnum\luatexversion<87%
       \def\XC@special#1{\pdfliteral{ q #1 Q }}%
     \else%
       \def\XC@special#1{\pdfextension literal{ q #1 Q }}%
     \fi}%
    {dvipdfm}%
    {\def\@tempa{1}
     \def\XC@special#1{\special{pdf: content #1}}}%
   }{\def\@tempa{-1}}
  \ifnum\XC@@xcd@>\m@ne\let\XC@@xcd@\@tempa\fi
  \ifnum\XC@@xcf@>\m@ne\let\XC@@xcf@\@tempa\fi
  \ifnum\XC@@xcp@>\m@ne\let\XC@@xcp@\@tempa\fi
  \ifnum\@tempa=0 \AtBeginDvi{\special{header=xcolor.pro}}\fi
  \ifcase\XC@@xcf@
    \AtBeginDvi{\special{! XCfixnormalscale}}
  \fi
  \ifcase\XC@@xcp@
    \AtBeginDvi{\special{header=\jobname.xcp}}
    \newwrite\XC@@xcp\immediate\openout\XC@@xcp=\jobname.xcp
    \immediate\write\XC@@xcp{\@percentchar!}
    \immediate\write\XC@@xcp{TeXDict begin}
    \AtEndDocument
     {\immediate\write\XC@@xcp{end}\immediate\closeout\XC@@xcp}
  \fi
\fi
\@namedef{ver@color.sty}{1999/02/16}
\XC@@pkg
\long\def\@secondoffive#1#2#3#4#5{#2}
\long\def\@thirdoffive#1#2#3#4#5{#3}
\def\xglobal{\xglobal@stop\begingroup\futurelet\@@tok\xglobal@test}
\def\xglobal@test
 {\expandafter\@tfor\expandafter\@@tmp
   \expandafter:\expandafter=\xglobal@list\do
    {\expandafter\ifx\@@tmp\@@tok
       \aftergroup\let\aftergroup\xglobal@\@break@tfor\fi}%
  \endgroup\global}
\def\xglobal@stop{\let\xglobal@\@empty}
\xglobal@stop
\def\xglobal@list
 {\definecolor\definecolors\definecolorset\colorlet\providecolor
  \providecolors\providecolorset\blendcolors\maskcolors
  \substitutecolormodel}
\def\xglobalize@#1{\ifx\xglobal@\global\global\let#1#1\fi}
\def\GetGinDriver
 {\@tempswafalse
  \@tfor\@@tmp:={dvips}{luatex}{pdftex}{dvipdf}{dvipdfm}{dvipsone}{vtex}{textures}%
  \do{\ifx\XC@@drv\@@tmp\@tempswatrue\@break@tfor\fi}%
  \edef\GinDriver{\if@tempswa\XC@@drv\else hypertex\fi}}
\def\@hex@Hex#1{\ifx#1\relax\else\expandafter\@hex@@Hex\expandafter#1\fi}
\def\@hex@@Hex#1%
 {\if a#1A\else \if b#1B\else \if c#1C\else \if d#1D\else
  \if e#1E\else \if f#1F\else #1\fi\fi\fi\fi\fi\fi \@hex@Hex}
\def\XC@strip@comma#1,#2%
 {\ifx,#2%
    #1\expandafter\remove@to@nnil\else#1 \expandafter\XC@strip@comma\fi
  #2}
{\catcode`Q=3
 \gdef\XC@replace#1#2#3%
  {\begingroup
   \def\XC@repl@ce##1#2##2Q##3%
    {\@ifxempty{##2}{\XC@r@pl@ce##1Q}{\XC@repl@ce##1##3##2Q{##3}}}%
   \def\XC@r@pl@ce##1\@empty Q%
    {\expandafter\endgroup\expandafter\def\expandafter#1\expandafter{##1}}%
   \expandafter\XC@repl@ce\expandafter\@empty #1\@empty#2Q{#3}}
}
\def\XC@clean#1%
 {\edef#1{ #1 }%
  \XC@cle@n#1,{ }\XC@cle@n#1{. }{ }\XC@cle@n#1{ },%
  \edef#1{\expandafter\@gobbletwo#1}}
\def\XC@cle@n#1#2#3%
 {\def\XC@cl@@n##1#2##2{#3##1\ifx##2\@empty\else\expandafter\XC@cl@@n\fi##2}%
  \edef#1{\expandafter\XC@cl@@n#1#2\@empty}}%
\def\rdivide#1#2%
 {\begingroup\toks@{#1}\edef\@@tmp{\noexpand\@tempdima\the#1}%
  \@defaultunits\@tempdimb=#2pt\relax\@nnil \@@tmp\relax
  \ifdim\@tempdima<\z@ \@tempdima-\@tempdima\def\@sign{-}\else
    \def\@sign{}\fi
  \ifdim\@tempdimb<\z@ \@tempdimb-\@tempdimb\edef\@sign{\@sign-}\fi
  \ifdim\@tempdima<.1\maxdimen \ifdim\@tempdimb<.01\maxdimen
    \lshift\@tempdima \lshift\@tempdimb \fi\fi
  \@tempcnta=\@tempdima \@tempcntb=\@tempdimb
  \count@=\@tempcnta \divide\count@\@tempcntb
  \edef\@@tmp{\number\count@.}%
  \@tempswatrue  \@rdivide \@rdivide \@rdivide \@rdivide \@rdivide
  \@tempswafalse \@rdivide
  \dimen@\@@tmp\p@ \ifnum\count@>4\advance\dimen@1sp\fi
  \dimen@\@sign\dimen@
  \edef\@@tmp{\the\toks@\the\dimen@}%
  \expandafter\endgroup\@@tmp}
\def\@rdivide
 {\multiply\count@\@tempcntb \advance\@tempcnta-\count@
  \multiply\@tempcnta10 \count@=\@tempcnta \divide\count@\@tempcntb
  \if@tempswa\edef\@@tmp{\@@tmp\number\count@}\fi}
\def\rmultiply#1#2%
 {\begingroup
  \edef\@@mul{#2}\@tempdima\the#1\relax
  \afterassignment\@tempdimb\@tempcntb=\@@mul\p@
  \ifdim\@tempdima<\z@ \@tempdima-\@tempdima\def\@sign{-}\else
    \def\@sign{}\fi
  \ifnum\@tempcntb<\z@ \@tempcntb-\@tempcntb\edef\@sign{\@sign-}\fi
  \lshift\@tempdima \dimen@\z@
  \expandafter\@rmultiply\@@mul.0.\@nil
  \advance\dimen@\@tempcntb\@tempdima \rshift\dimen@
  \dimen@\@sign\dimen@
  \edef\@@tmp{#1\the\dimen@}%
  \expandafter\endgroup\@@tmp}
\def\@rmultiply#1.#2.#3\@nil
 {\def\@@tmp{}%
  \@tfor\@@mul:=#2\do
   {\edef\@@tmp
     {\advance\dimen@\@@mul\@tempdima \divide\dimen@10 \@@tmp}}%
  \@@tmp}
\def\lshift#1{#1\expandafter\lshift@\the#1}
\def\llshift#1{\lshift#1\lshift#1}
\def\lshiftnum#1{\expandafter\lshiftnum@#1.00.:}
\def\lshiftnum@#1.#2#3.#4:{#1#2\ifnum0#3>\z@.#3\fi}
\def\llshiftnum#1{\expandafter\llshiftnum@#1\@empty.00.:}
\def\llshiftnum@#1.#2#3#4.#5:%
 {#1#2\ifnum0#3>\z@#3\else0\fi\ifnum0#4>\z@.#4\fi}
\def\lshiftset#1#2{\edef\@@XC{\noexpand\lshiftnum{#2}}#1\@@XC\p@}
\def\llshiftset#1#2{\edef\@@XC{\noexpand\llshiftnum{#2}}#1\@@XC\p@}
\def\rshift#1{#1\expandafter\rshift@\the#1}
\def\rrshift#1{\rshift#1\rshift#1}
\begingroup
\catcode`P=12
\catcode`T=12
\lowercase
 {\def\@@tmp{\def\lshift@##1.##2##3PT{##1##2\ifnum0##3>\z@.##3\fi\p@}
             \def\rshift@##1.##2PT{\rshift@@##1\relax##2\p@}}}
\expandafter\endgroup\@@tmp
\def\rshift@@#1#2%
 {\ifx#2\relax.#1\else#1\expandafter\rshift@@\expandafter#2\fi}
\def\XC@inflate#1#2#3#4%
 {\edef#4{#2,\ifx#1\XC@mod@cmyk #3\else
             \ifx#1\XC@mod@gray ,,,#3,,,\else ,#3,\fi\fi}}
\def\XC@vec#1,#2,#3,#4,#5,#6,#7,#8,#9%
 {\def\@@tmp{}%
  \XC@vec@{#1}{#5}%
  \ifx,#2,\else
  \XC@vec@{#2}{#6}\XC@vec@{#3}{#7}\ifx,#4,\else\XC@vec@{#4}{#8}\fi\fi
  \aftergroupdef#9\@@tmp}
\def\XC@vec@@{\edef\@@tmp{\ifx\@@tmp\@empty\else\@@tmp,\fi\strip@pt\dimen@}}
\def\XC@add{\begingroup \let\XC@vec@\XC@add@ \XC@vec}
\def\XC@add@#1#2%
 {\llshiftset\dimen@{#1}\llshiftset\@tempdima{#2}%
  \advance\dimen@\@tempdima \rrshift\dimen@ \XC@vec@@}
\def\XC@sub{\begingroup \let\XC@vec@\XC@sub@ \XC@vec}
\def\XC@sub@#1#2{\XC@add@{#1}{-#2}}
\def\XC@mul{\begingroup \let\XC@vec@\XC@mul@ \XC@vec}
\def\XC@mul@#1#2%
 {\llshiftset\dimen@{#1}\rmultiply\dimen@{#2}\rrshift\dimen@ \XC@vec@@}
\def\XC@mix%
 {\begingroup
  \@tempdima\dimen@ \@tempdimb100\p@ \advance\@tempdimb-\@tempdima
  \let\XC@vec@\XC@mix@ \XC@vec}
\def\XC@mix@#1#2%
 {\dimen@#1\@tempdima \advance\dimen@#2\@tempdimb \rrshift\dimen@ \XC@vec@@}
\def\XC@calc@#1,#2,#3,#4,#5:#6%
 {\XC@let@Nc\@@cmd{XC@calc#6}\@@cmd{#1}\@@tmp
  \ifx,#2,\else
    \@@cmd{#2}\@tempa\@@cmd{#3}\@tempb
    \ifx,#4,%
      \edef\@@tmp{\@@tmp,\@tempa,\@tempb}\else
      \@@cmd{#4}\@tempc\edef\@@tmp{\@@tmp,\@tempa,\@tempb,\@tempc}\fi\fi}
\def\XC@calcC#1#2%
 {\llshiftset\dimen@{-#1}\advance\dimen@100\p@
  \rrshift\dimen@ \XC@calcN{\strip@pt\dimen@}#2}
\def\XC@calcD{\XC@c@lcD\@@scl{}}
\def\XC@c@lcD#1#2#3#4%
 {\dimen@#3\p@ \rdivide\dimen@{#1}\edef#4{\strip@pt\dimen@#2}}
\def\XC@calcF#1#2%
 {\edef#2{#1}\expandafter\XC@c@lcF#2.0.:#2}
\def\XC@c@lcF#1.#2.#3:#4%
 {\edef#4{\XC@c@@cR#200000:}%
  \dimen@#1.5\p@ \afterassignment\dimen@\count@=\the\dimen@
  \edef#4%
   {\ifnum#4>0 \ifnum\count@=0 \ifdim#1.5\p@<\z@ -\fi\fi\fi
    \number\count@.#4}}
\def\XC@calcH#1#2%
 {\count@#1 \divide\count@\sixt@@n \edef\XC@@tmp{\hexnumber@\count@}%
  \multiply\count@-\sixt@@n \advance\count@#1
  \edef#2{\XC@@tmp\hexnumber@\count@}}
\def\XC@calcM#1#2%
 {\dimen@#1\p@ \dimen@\@@scl\dimen@ \advance\dimen@.5\p@
  \afterassignment\dimen@\count@=\the\dimen@ \edef#2{\number\count@}}
\def\XC@calcN#1#2%
 {\XC@calcR{#1}#2\edef#2{\expandafter\XC@c@lcN#200000:}}
\def\XC@c@lcN#1.#200000#3:{#1\ifnum0#2=0 \else.#2\fi}
\def\XC@calcR#1#2{\edef#2{#1}\edef#2{\expandafter\XC@c@lcR#2.0.:}}
\def\XC@c@lcR#1.#2.#3:%
 {\ifnum#10>0 1.00000\else 0.\ifnum#11<0 00000\else
  \XC@c@@cR#200000:\fi\fi}
\def\XC@c@@cR#1#2#3#4#5#6:{#1#2#3#4#5}
\def\XC@calcS{\XC@c@lcS\@@scl{}}
\def\XC@c@lcS#1#2#3#4%
 {\lshiftset\dimen@{#3}%
  \ifdim#1\p@<100\p@
    \dimen@\lshiftnum#1\dimen@ \rrshift\dimen@ \else
    \dimen@#1\dimen@ \rshift\dimen@ \fi
  \edef#4{\strip@pt\dimen@#2}}
\def\XC@calcT#1#2%
 {\lshiftset\dimen@{#1}\advance\dimen@\lshiftnum\@@arg\p@ \rshift\dimen@
  \edef#2%
   {\ifdim\dimen@>\p@1\else\ifdim\dimen@<\z@0\else\strip@pt\dimen@\fi\fi}}
\def\XC@calcU#1#2%
 {\dimen@#1\p@
  \ifdim\dimen@=\p@\else
    \afterassignment\dimen@\count@=\the\dimen@
    \relax\ifdim\dimen@=\z@\else
      \ifdim#1\p@<\z@ \dimen@-\dimen@ \advance\dimen@\p@ \fi
    \fi
  \fi
  \edef#2{\strip@pt\dimen@}}
\providecommand*\rangeRGB{255}
\providecommand*\rangeHSB{240}
\providecommand*\rangeHsb{360}
\providecommand*\rangetHsb{60,30;120,60;180,120;210,180;240,240}
\providecommand*\rangeGray{15}
\providecommand*\adjustUCRBG{1,1,1,1}
\providecommand*\paperquality{1}
\providecommand*\colorseriescycle{16}
\def\XC@clr@rgb@white{1,1,1}
\def\XC@clr@cmy@white{0,0,0}
\def\XC@clr@cmyk@white{0,0,0,0}
\def\XC@clr@hsb@white{\@@hue,0,1}
\def\XC@clr@hsb@gray{\@@hue,0,0.5}
\def\XC@clr@hsb@black{\@@hue,0,0}
\def\XC@clr@gray@white{1}
\@tfor\@@tmp:={grad}{last}{step}\do
 {\XC@let@cN{XC@met@\@@tmp}\@@tmp}
\def\definecolor{\@testopt{\XC@definecolor}{}}
\def\XC@definecolor[#1]#2%
 {\@testopt{\XC@definec@lor[#1]{#2}}\colornameprefix}
\def\XC@definec@lor[#1]#2[#3]#4#5%
 {\begingroup
  \XC@sdef\@@cls{#1}\XC@edef\@@nam{#2}\edef\colornameprefix{#3}%
  \XC@logdef\@@nam
  \XC@getmodclr02{#4}{#5}{\let\@@tmp\relax}%
   {\ifx\@@mod\XC@mod@named
      \XC@c@l@rlet\@@nam\@@clr
    \else
      \ifx\@@cls\XC@mod@ps
        \edef\@@drv{\@@mod\space\@@clr}\def\@@hue{0}%
        \edef\@@clr{\@nameuse{XC@clr@\@@mod @white}}%
      \else
        \ifconvertcolorsD
          \let\@@tmp\@@mod\XC@sdef\@@mod{\XC@tgt@mod\@@tmp}%
          \convertcolorspec\@@tmp\@@clr\@@mod\@@clr
        \fi
        \XC@coremodel\@@mod\@@clr
        \csname color@\@@mod\expandafter\endcsname
          \expandafter\@@drv\expandafter{\@@clr}%
        \ifcase\XC@@xcp@
          \immediate\write\XC@@xcp{/\colornameprefix\@@nam{\expandafter
            \XC@strip@comma\@@clr,,\@nnil}XC\@@mod}%
          \let\@@cls\XC@mod@named
        \fi
        \ifx\@@cls\@empty\else
          \let\@@tmp\@@cls
          \@nameuse{define@color@\@@cls}\@@nam\@@drv
          \csname color@\@@tmp\expandafter\endcsname
            \expandafter\@@drv\expandafter{\@@nam}%
        \fi
      \fi
      \toks@\expandafter{\@@drv}%
      \edef\@@tmp
       {\ifglobalcolors\global\else\xglobal@\fi
        \noexpand\@namedef{\string\color@\@@nam}%
         {\noexpand\xcolor@{\@@cls}{\the\toks@}{\@@mod}{\@@clr}}}%
    \fi}%
  \expandafter\endgroup\@@tmp\xglobal@stop}
\def\XC@getmodclr#1#2#3#4%
 {\ifnum\ifcase#1 \ifXC@@getmod1\else0 \fi \or1 \fi>0
    \XC@mdef\@@mod{#3}\expandafter\XC@getmod\@@mod////////\XC@@
    \@ifundefinedmodel\@@Mod{\let\@@Mod\XC@mod@ignore}{}\fi
  \@ifundefined{XC@mod@\@@mod}%
   {\c@lor@error{model `\@@mod'}\@firstoftwo}%
   {\ifcase#2\else
      \XC@mdef\@@clr{#4}%
      \edef\@@clr{\expandafter\XC@getclr\@@clr////////\XC@@}%
      \ifx\@@cls\XC@mod@ps\else\XC@clean\@@clr\fi
      \ifx\@@Mod\XC@mod@ignore\else
        \convertcolorspec\@@mod\@@clr\@@Mod\@@clr
        \ifnum#2>1 \let\@@mod\@@Mod\fi
      \fi
    \fi \@secondoftwo}}
\def\XC@getmod#1/#2/#3/#4/#5/#6/#7/#8/#9\XC@@
 {\XC@g@tm@d0#1::\XC@@ \XC@getm@d1{#2}\XC@getm@d2{#3}%
  \XC@getm@d3{#4}\XC@getm@d4{#5}\XC@getm@d5{#6}\XC@getm@d6{#7}%
  \XC@getm@d7{#8}\def\XC@@pos{0}\def\@@mod{#1}\@gobble\@nnil}%
\def\XC@getm@d#1#2%
 {\edef\XC@@pos{#2}\XC@sdef\@@mod{\XC@tgt@mod\XC@@pos}%
  \ifx\XC@@pos\@@mod\def\XC@@pos{#1}\expandafter\remove@to@nnil\fi}%
\def\XC@g@tm@d#1#2:#3:#4\XC@@
 {\@ifxempty{#3}{\let\@@Mod\XC@mod@ignore\XC@getm@d0{#2}}%
    {\def\@@Mod{#2}\XC@getm@d0{#3}}}%
\def\XC@getclr#1/#2/#3/#4/#5/#6/#7/#8/#9\XC@@
 {\ifcase\XC@@pos\space #1\or#2\or#3\or#4\or#5\or#6\or#7\or#8\fi}
\newif\ifXC@@getmod \XC@@getmodtrue
\let\xdefinecolor\definecolor
\def\providecolor{\@testopt{\XC@providecolor}{}}
\def\XC@providecolor[#1]#2%
 {\@testopt{\XC@providec@lor[#1]{#2}}\colornameprefix}
\def\XC@providec@lor[#1]#2[#3]%
 {\XC@edef\XC@@tmp{#2}%
  \@ifundefinedcolor\XC@@tmp{\XC@definecolor[#1]{#2}[#3]}%
   {\ifnum\XC@tracing>0
      \PackageInfo{xcolor}{Ignoring color definition `\XC@@tmp'}\fi
    \@gobbletwo}}
\def\xcolor@#1#2#3#4{#2}
\def\colorlet{\@testopt{\XC@colorlet}{}}
\def\XC@colorlet[#1]#2{\@testopt{\XC@col@rlet[#1]{#2}}{}}
\def\XC@col@rlet[#1]#2[#3]#4%
 {\begingroup
  \edef\@@cls{#1}\XC@edef\@@nam{#2}\XC@sdef\@@mod{#3}\XC@edef\@@clr{#4}%
  \XC@info\@@clr\@@tmp\XC@@tstfalse
  \ifnum\@@tmp=\@ne\ifx\@@mod\@empty
    \ifx\@@cls\@empty
      \XC@@tsttrue
    \else
      \edef\@@tmp
       {\expandafter\expandafter\expandafter\@secondoffive
         \csname\string\color@\@@clr\endcsname}%
      \ifx\@@cls\@@tmp\XC@@tsttrue\fi
    \fi
  \fi\fi
  \ifXC@@tst
    \XC@logdef\@@nam\XC@c@l@rlet\@@nam\@@clr
  \else
    \extractcolorspec\@@clr\@@clr
    \ifx\@@mod\@empty\else
      \expandafter\convertcolorspec\@@clr\@@mod\@@clr
      \edef\@@clr{{\@@mod}{\@@clr}}\fi
    \edef\@@tmp{\noexpand\XC@definecolor[\@@cls]{\@@nam}\@@clr}%
  \fi
  \expandafter\endgroup\@@tmp\xglobal@stop}
\def\XC@c@l@rlet#1#2%
 {\@ifundefinedcolor{#2}%
   {\c@lor@error{`#2'}\let\@@tmp\@empty}%
   {\edef\@@tmp
     {\ifglobalcolors\global\else\xglobal@\fi
      \noexpand\XC@let@cc{\string\color@#1}{\string\color@#2}}}}
\def\DefineNamedColor#1%
 {\@nameuse{XC@\ifdefinecolors defin\else prepar\fi ecolor}[#1]}
\def\preparecolor{\@testopt{\XC@preparecolor}{}}
\def\XC@preparecolor[#1]#2%
 {\@testopt{\XC@preparec@lor[#1]{#2}}\colornameprefix}
\def\XC@preparec@lor[#1]#2[#3]#4#5%
 {\XC@sdef\@@cls{#1}\XC@edef\@@nam{#2}%
  \XC@getmodclr01{#4}{#5}{}%
   {\xdef\XC@@stack
     {\ifx\XC@@stack\@empty\else\XC@@stack,\fi{#1}{\@@nam}{#3}%
      {\ifx\@@Mod\XC@mod@ignore\@@mod\else\@@Mod\fi}{\@@clr}}}}
\let\XC@@stack\@empty
\def\definecolors#1%
 {\let\XC@@cmd\definecolor\let\XC@@glb\xglobal@
  \expandafter\XC@definecolors#1,,}
\def\XC@definecolors#1,%
 {\@ifxempty{#1}{}{\expandafter\XC@definec@lors#1=#1=:\XC@definecolors}}
\def\XC@definec@lors#1=#2=#3:%
 {\XC@edef\@@nam{#1}\XC@edef\@@arg{#2}%
  \let\next\XC@definec@l@rs\expandafter\next\XC@@stack,,\@nnil}
\def\XC@definec@l@rs#1,%
 {\ifx,#1,\let\next\remove@to@nnil\else\XC@defin@c@l@rs#1\fi\next}
\def\XC@defin@c@l@rs#1#2#3#4#5%
 {\def\@@tmp{#2}%
  \ifx\@@tmp\@@arg
    \let\xglobal@\XC@@glb\XC@@cmd[#1]{\@@nam}[#3]{#4}{#5}%
    \let\next\remove@to@nnil
  \fi}
\def\providecolors#1%
 {\let\XC@@cmd\providecolor\let\XC@@glb\xglobal@
  \expandafter\XC@definecolors#1,,}
\def\definecolorset
 {\let\XC@@cmd\definecolor\@testopt{\XC@definecolorset}{}}
\def\XC@definecolorset[#1]#2#3#4#5%
 {\XC@getmodclr10{#2}{}{}%
   {\XC@@getmodfalse\XC@edef\XC@@tmp{#5}\let\XC@@glb\xglobal@
    \def\XC@definec@lorset##1,##2;%
     {\@ifxempty{##1}{}%
       {\let\xglobal@\XC@@glb
        \XC@@cmd[#1]{#3##1#4}{\@@mod}{##2}\XC@definec@lorset}}%
    \expandafter\XC@definec@lorset\XC@@tmp;,;\XC@@getmodtrue}}
\def\providecolorset
 {\let\XC@@cmd\providecolor\@testopt{\XC@definecolorset}{}}
\def\preparecolorset
 {\ifdefinecolors\let\XC@@cmd\definecolor\else\let\XC@@cmd\preparecolor\fi
  \@testopt{\XC@definecolorset}{}}
\def\definecolorseries#1#2#3%
 {\@testopt{\XC@definecolorseries{#1}{#2}{#3}}{}}
\def\XC@definecolorseries#1#2#3[#4]#5%
 {\@testopt{\XC@definec@lorseries{#1}{#2}{#3}[#4]{#5}}{}}
\def\XC@definec@lorseries#1#2#3[#4]#5[#6]#7%
 {\begingroup
  \XC@sdef\@@mod{#2}%
  \@ifxempty{#4}{\extractcolorspec{#5}\@@clr}{\edef\@@clr{{#4}{#5}}}%
  \expandafter\convertcolorspec\@@clr\@@mod\@@clr
  \@namexdef{\string\colorB@#1}{{\@@mod}{\@@clr}}%
  \edef\@@met{#3}%
  \ifx\@@met\XC@met@last
    \@ifxempty{#6}{\extractcolorspec{#7}\@@tmp}{\edef\@@tmp{{#6}{#7}}}%
    \expandafter\convertcolorspec\@@tmp\@@mod\@@tmp
    \XC@inflate\@@mod\@@tmp\@@clr\@@tmp
    \expandafter\XC@sub\@@tmp,\@@tmp
  \else
    \edef\@@tmp{#7}%
  \fi
  \@namexdef{\string\colorD@#1}{{\@@met}{\@@tmp}}%
  \endgroup}
\def\resetcolorseries{\@testopt{\XC@resetcolorseries}{}}
\def\XC@resetcolorseries[#1]#2%
 {\begingroup
  \@namexdef
   {\string\color@#2}{\noexpand\xcolor@{}{}\@nameuse{\string\colorB@#2}}%
  \XC@let@Nc\@@tmp{\string\colorD@#2}%
  \edef\@@met{\expandafter\@firstoftwo\@@tmp}%
  \edef\@@tmp{\expandafter\@secondoftwo\@@tmp}%
  \ifx\@@met\XC@met@step\else
    \edef\@@scl{\@ifxempty{#1}\colorseriescycle{#1}}%
    \expandafter\XC@calc@\@@tmp,,,,:D%
  \fi
  \@namexdef{\string\colorS@#2}{\@@tmp}%
  \endgroup}
\def\XC@step#1%
 {\let\xcolor@\@gobbletwo\edef\@@tmp{\@nameuse{\string\color@#1}}%
  \expandafter\XC@st@p\@@tmp{#1}%
  \@namexdef{\string\color@#1}{\noexpand\xcolor@{}{}{\@@mod}{\@@tmp}}}
\def\XC@st@p#1#2#3%
 {\def\@@mod{#1}\def\@@tmp{#2}\edef\@@vec{\@nameuse{\string\colorS@#3}}%
  \@whilenum\@tempcnta>\z@\do
   {\XC@inflate\@@mod\@@tmp\@@vec\@@tmp
    \expandafter\XC@add\@@tmp,\@@tmp \expandafter\XC@calc@\@@tmp,,,,:U%
    \advance\@tempcnta\m@ne}}
\def\XC@stepabs#1%
 {\edef\@@tmp{\@nameuse{\string\colorB@#1}}%
  \expandafter\XC@st@p\@@tmp{#1}%
  \edef\@@tmp
   {\def\noexpand\@@mod{\@@mod}\def\noexpand\@@clr{\@@tmp}}}
\def\blendcolors{\@ifstar{\XC@blendcolors\colorblend}{\XC@blendcolors{}}}
\def\XC@blendcolors#1#2%
 {\edef\colorblend{#1}\XC@edef\XC@@tmp{#2}%
  \ifx\XC@@tmp\@empty
    \xglobal@\blendcolorsfalse
  \else
    \xglobal@\blendcolorstrue
    \expandafter\XC@blendc@lors\XC@@tmp!!\@nil
  \fi
  \xglobalize@\colorblend \xglobal@stop}
\def\XC@blendc@lors!#1!#2!#3\@nil
 {\@ifxempty{#1}{}%
   {\@ifxempty{#2}%
    {\edef\colorblend{\colorblend!#1!white}}%
    {\edef\colorblend{\colorblend!#1!#2}\XC@blendc@lors!#3!\@nil}}}
\blendcolors{}
\def\maskcolors{\@testopt{\XC@maskcolors}{}}
\def\XC@maskcolors[#1]#2%
 {\XC@edef\colormask{#2}%
  \ifx\colormask\@empty
    \xglobal@\maskcolorsfalse \def\XC@mmod{}\def\XC@mclr{}%
  \else
    \xglobal@\maskcolorstrue \extractcolorspecs\colormask\XC@mmod\XC@mclr
    \@ifxempty{#1}{}%
     {\convertcolorspec\XC@mmod\XC@mclr{#1}\XC@mclr \XC@sdef\XC@mmod{#1}}%
    \XC@coremodel\XC@mmod\XC@mclr
  \fi
  \xglobalize@\colormask \xglobalize@\XC@mmod \xglobalize@\XC@mclr
  \xglobal@stop}
\maskcolors{}
\DeclareRobustCommand\color
 {\@ifnextchar[\@undeclaredcolor\@declaredcolor}
\def\@undeclaredcolor[#1]#2%
 {\begingroup
  \let\@@cls\@empty
  \XC@getmodclr12{#1}{#2}{}%
   {\ifblendcolors
      \ifx\colorblend\@empty\else
        \edef\@@mix{\expandafter\@gobble\colorblend}\@tempswafalse
        \XC@coremodel\@@mod\@@clr\@xcolor@{}{}\@@mod\@@clr
      \fi
    \fi
    \ifconvertcolorsU
      \edef\@@tmp{\XC@tgt@mod{\@@mod}}%
      \convertcolorspec\@@mod\@@clr\@@tmp\@@clr \let\@@mod\@@tmp
    \fi
    \ifmaskcolors
      \convertcolorspec\@@mod\@@clr\XC@mmod\@@clr
      \let\@@mod\XC@mmod
      \XC@inflate\@@mod\XC@mclr\@@clr\@@tmp
      \expandafter\XC@mul\@@tmp,\@@clr
    \fi
    \edef\@@tmp{\noexpand\XC@undeclaredcolor{\@@mod}{\@@clr}}%
    \expandafter\endgroup\@@tmp}}
\def\XC@undeclaredcolor#1#2%
 {\@ifundefinedmodel{#1}%
   {\c@lor@error{model `#1'}}%
   {\@nameuse{color@#1}\current@color{#2}%
    \edef\XC@current@color{\noexpand\xcolor@{}{\current@color}{#1}{#2}}%
    \XC@display}}
\def\@declaredcolor#1%
 {\XC@edef\XC@@tmp{#1}\XC@@tstfalse
  \ifcase\XC@type\XC@@tmp\relax \XC@@tsttrue\or \relax\else
    \ifblendcolors\XC@@tsttrue\fi \ifmaskcolors\XC@@tsttrue\fi
    \ifconvertcolorsU\XC@@tsttrue\fi
  \fi
  \ifXC@@tst
    \expandafter\XC@declaredcolor\else
    \expandafter\XC@declaredc@lor\fi}
\def\XC@declaredcolor
 {\XC@split\XC@@tmp
  \edef\@@tmp{\noexpand\@undeclaredcolor[\@@mod]{\@@clr}}%
  \expandafter\endgroup\@@tmp}
\def\XC@declaredc@lor
 {\XC@let@Nc\XC@current@color{\string\color@\XC@@tmp}%
  \edef\current@color{\XC@current@color}%
  \XC@display}
\def\textcolor#1#{\@textcolor{#1}}
\def\@textcolor#1#2#3{\protect\leavevmode{\color#1{#2}#3}}
\def\pagecolor
 {\begingroup
  \let\ignorespaces\endgroup \let\set@color\set@page@color
  \color}
\def\nopagecolor
 {\@ifundefined{no@page@color}%
   {\PackageInfo{xcolor}{\string\nopagecolor\space is not supported}}%
   {\no@page@color}}
\def\colorbox#1#{\protect\color@box{#1}}
\def\color@box#1#2{\color@b@x\relax{\color#1{#2}}}
\def\fcolorbox#1#{\color@fbox{#1}}
\def\color@fbox#1#2#3#{\protect\color@fb@x{#1}{#2}{#3}}
\def\color@fb@x#1#2#3#4%
 {\color@b@x{\fboxsep\z@\color#1{#2}\XC@fbox}%
   {\@ifxempty{#3}{\color#1}{\color#3}{#4}}}
\long\def\color@b@x#1#2#3%
 {\leavevmode
  \setbox\z@\hbox{\kern\fboxsep{\set@color#3}\kern\fboxsep}%
  \dimen@\ht\z@\advance\dimen@\fboxsep\ht\z@\dimen@
  \dimen@\dp\z@\advance\dimen@\fboxsep\dp\z@\dimen@
  {#1{#2\color@block{\wd\z@}{\ht\z@}{\dp\z@}\box\z@}}}
\def\XC@frameb@x#1%
 {\hbox
   {\@tempdima\fboxrule \advance\@tempdima\fboxsep
    \advance\@tempdima\dp\@tempboxa
    \setbox\@tempboxa\hbox
     {\lower\@tempdima\hbox
       {\vbox
         {\kern\fboxrule
          \hbox{\kern\fboxrule#1%
                \vbox{\kern\fboxsep\box\@tempboxa\kern\fboxsep}%
                #1\kern\fboxrule}%
          \kern\fboxrule}}}%
    \@tempdima\wd\@tempboxa
    \edef\@tempa{{\the\@tempdima}{\the\ht\@tempboxa}{\the\dp\@tempboxa}}%
    \box\@tempboxa\kern-\@tempdima\expandafter\boxframe\@tempa}}
\ifXC@@fbox
  \let\@frameb@x\XC@frameb@x \let\XC@fbox\fbox
\else
  \def\XC@fbox{\let\@frameb@x\XC@frameb@x\fbox}
\fi

\ifnum\XC@@xcd@>\m@ne
\def\XC@boxframe#1#2#3#4%
 {\hbox{\sbox\z@{\ifdim\fboxrule>\z@ #4\fi}%
    \wd\z@#1\relax\ht\z@#2\relax\dp\z@#3\relax\box\z@}}
\fi
\ifcase\XC@@xcd@
\providecommand*\color@block[3]%
 {{\set@color\hbox
    {\dimen@#3\edef\@tempa{ \number\dimen@\space}%
     \dimen@#2\edef\@tempa{ \number\dimen@\@tempa}%
     \dimen@#1\relax
     \XC@special{\number\dimen@\@tempa XCcolorblock}}}}
\providecommand*\boxframe[3]%
 {\XC@boxframe{#1}{#2}{#3}%
   {\dimen@#3\edef\@tempa{ \number\dimen@\space}%
    \dimen@#2\edef\@tempa{ \number\dimen@\@tempa}%
    \dimen@#1\relax
    \XC@special{\number\fboxrule\space\number\dimen@\@tempa XCboxframe}}}
\or
\providecommand*\boxframe[3]%
 {\XC@boxframe{#1}{#2}{#3}%
   {\dimen@#3\edef\@tempa{ 0 -\strip@pt\dimen@\space}%
    \edef\@tempb{\advance\dimen@\the\dimen@}%
    \dimen@#2\advance\dimen@-\fboxrule\@tempb
    \edef\@tempb{ \strip@pt\dimen@\space re s}%
    \dimen@#1\advance\dimen@-\fboxrule
    \edef\@tempb{ cm\@tempa\strip@pt\dimen@\@tempb}%
    \dimen@.5\fboxrule\edef\@tempa{ \strip@pt\dimen@}%
    \XC@special
     {0.996264 0 0 0.996264 0 0 cm
      \strip@pt\fboxrule\space w [] 0 d 2 J 0 j 4 M
      1 0 0 1\@tempa\@tempa\@tempb}}}
\fi
\providecommand*\color@block[3]%
 {{\set@color\rlap{\ifcolors@\vrule\@width#1\@height#2\@depth#3\fi}}}
\providecommand*\boxframe[3]%
 {\hbox
   {\dimen@#2\advance\dimen@#3\relax
    \lower#3\vbox
     {\hrule\@height\fboxrule
      \@tempdima-0.5\fboxrule \ifodd\fboxrule\advance\@tempdima\m@ne sp\fi
      \kern\@tempdima
      \hbox
       {\advance\dimen@-\fboxrule
        \vrule\@width\fboxrule\@height\dimen@\@depth\z@
        \@tempdima#1\advance\@tempdima-\tw@\fboxrule \kern\@tempdima
        \vrule\@width\fboxrule\@height\dimen@\@depth\z@}%
      \kern-0.5\fboxrule
      \hrule\@height\fboxrule}}}
\def\@xcolor@#1#2#3#4%
 {\XC@sdef\@@mod{#3}\edef\@@clr{#4}%
  \ifx\@@mix\@empty\else\expandafter\@xcolor@@\@@mix!!!!\@nil\fi
  \if@tempswa
    \XC@let@Nc\@@tmp{XC@cnv@\@@mod @compl}%
    \ifx\@@tmp\relax \expandafter\XC@calc@\@@clr,,,,:C\else
                     \expandafter\@@tmp\@@clr,\fi
    \let\@@clr\@@tmp
  \fi}
\def\@xcolor@@#1!#2!#3!#4!#5\@nil
 {\dimen@\@ifxempty{#1}{100}{#1}\p@
  \edef\@@mix{\@ifxempty{#2}{white}{#2}}%
  \ifdim\dimen@=100\p@
    \expandafter\XC@postfix\@@mix]\relax
  \else\ifdim\dimen@=\z@
    \extractcolorspecs\@@mix\@@mod\@@clr
  \else
    \XC@let@Nc\@@tmp{XC@clr@\@@mod @\@@mix}%
    \ifx\@@tmp\relax
      \extractcolorspec\@@mix\@@tmp
      \ifx\@@mod\XC@mod@gray
        \edef\@@mod{\expandafter\@firstoftwo\@@tmp}%
        \edef\@@tmp{\expandafter\@secondoftwo\@@tmp}%
        \convertcolorspec\XC@mod@gray\@@clr\@@mod\@@clr
      \else
        \expandafter\convertcolorspec\@@tmp\@@mod\@@tmp
      \fi
    \else
      \ifx\@@mod\XC@mod@hsb\expandafter\XC@extract@hue\@@clr:\@@hue\fi
    \fi
    \XC@inflate\@@mod\@@clr\@@tmp\@@tmp
    \expandafter\XC@mix\@@tmp,\@@clr
  \fi\fi
  \@ifxempty{#3}%
   {\@ifxempty{#4}{}{\@xcolor@@!#4!#5\@nil}}%
   {\@xcolor@@#3!#4!#5\@nil}}
\def\XC@split#1%
 {\begingroup\XC@edef\@@tmp{#1}\expandafter\XC@split@i\@@tmp>>\@nnil}
\def\XC@split@i#1>%
 {\def\@@tmp{#1}\XC@split@ii#1:\@nil \XC@func}
\def\XC@split@ii#1:#2\@nil
 {\@ifxempty{#2}{\XC@split@vi}{\XC@split@iii#1,,:#2}}
\def\XC@split@iii#1,#2,#3:#4:%
 {\edef\XC@@mod{#1}\let\@tempa\@empty
  \ifx,#2,\XC@@tsttrue\@tempdima\z@\else\XC@@tstfalse\@tempdima#2\p@\fi
  \XC@split@iv#4;,;}
\def\XC@split@iv#1,#2;%
 {\@ifxempty{#1}%
   {\let\XC@@clr\@empty \@tempa \expandafter\XC@calc@\XC@@clr,,,,:U%
    \let\@@mod\XC@@mod \let\@@clr\@@tmp}
   {\XC@append\@tempa{\XC@split@v{#1}{#2}}%
    \ifXC@@tst\advance\@tempdima#2\p@\fi
    \XC@split@iv}}
\def\XC@split@v#1#2%
 {\def\@@tmp{#1}\XC@split@vi
  \ifx\@@mod\XC@@mod\else
    \convertcolorspec\@@mod\@@clr\XC@@mod\@@clr
  \fi
  \dimen@#2\p@ \rdivide\dimen@\@tempdima
  \edef\@@scl{\strip@pt\dimen@}%
  \expandafter\XC@calc@\@@clr,,,,:S%
  \ifx\XC@@clr\@empty\let\XC@@clr\@@tmp\else
    \XC@inflate\XC@@mod\XC@@clr\@@tmp\@@tmp
    \expandafter\XC@add\@@tmp,\XC@@clr
  \fi}
\def\XC@split@vi{\count@\z@ \expandafter\XC@split@vii\@@tmp!\@nil}
\def\XC@split@vii#1%
 {\ifx#1-\advance\count@\@ne\expandafter\XC@split@vii
  \else\expandafter\XC@split@viii\expandafter#1\fi}
\def\XC@split@viii#1!#2\@nil
 {\edef\@@nam{#1}\edef\@@mix{#2}%
  \ifodd\count@\@tempswatrue\else\@tempswafalse\fi
  \@ifundefinedcolor\@@nam
   {\c@lor@error{`\@@nam'}\def\@@nam{black}}{}%
  \let\xcolor@\@xcolor@\@nameuse{\string\color@\@@nam}}
\def\XC@postfix#1#2]#3\relax
 {\begingroup
  \if[#1\@tempcnta#2\relax\XC@stepabs\@@nam
  \else\@tempcnta\z@
    \@tfor\@@tok:=#1#2\do
     {\if+\@@tok\advance\@tempcnta\@ne
      \else\if-\@@tok\advance\@tempcnta\m@ne
      \else\@tempcnta\z@\expandafter\@break@tfor\fi\fi}%
    \ifnum\@tempcnta=\z@\relax\else\XC@step\@@nam\fi
    \let\@@tmp\@empty
  \fi\expandafter\endgroup\@@tmp}
\def\XC@func#1>{\@ifxempty{#1}{\remove@to@nnil}{\XC@fun@#1,>\XC@func}}
\def\XC@fun@#1,#2>{\@nameuse{XC@func@#1}#2,,>}
\def\XC@func@wheel#1,#2,#3>{\XC@func@wh@el{#1}{#2}0}
\def\XC@func@twheel#1,#2,#3>{\XC@func@wh@el{#1}{#2}1}
\def\XC@func@wh@el#1#2#3%
 {\convertcolorspec\@@mod\@@clr
   {\ifcase#3 \XC@mod@Hsb\or\XC@mod@tHsb\fi}\@@clr
  \expandafter\XC@extract@hue\@@clr:\@@hue \dimen@#1\p@
  \@ifxempty{#2}{}%
   {\rdivide\dimen@{#2}\lshift\dimen@
    \dimen@\rangeHsb\dimen@\rshift\dimen@}%
  \advance\dimen@\@@hue\p@ \rdivide\dimen@\rangeHsb
  \edef\@@hue{\strip@pt\dimen@}\XC@calcU\@@hue\@@hue
  \ifcase#3
    \expandafter\XC@replace@hue\@@clr:\@@hue,\@@clr
  \or
    \XC@c@lcS\rangeHsb{}\@@hue\@@hue
    \expandafter\XC@replace@hue\@@clr:\@@hue,\@@clr
    \convertcolorspec\XC@mod@tHsb\@@clr\XC@mod@hsb\@@clr
  \fi
  \let\@@mod\XC@mod@hsb}
\def\XC@display
 {\XC@bcolor\XC@let@cN{\string\color@.}\XC@current@color
  \ifnum\XC@type{.}=1
    \PackageWarning{xcolor}{Incompatible color definition}\else
  \ifnum\XC@tracing>2
    \begingroup \let\xcolor@\@empty \def\@nil{\string\@nil}%
    \PackageInfo{xcolor}{Setting color `\XC@current@color'}%
    \endgroup
  \fi\fi
  \XC@mcolor\set@color\XC@ecolor\ignorespaces}
\let\XC@bcolor\relax
\let\XC@mcolor\relax
\let\XC@ecolor\relax
\def\XC@bordercolor#1#2%
 {\extractcolorspec{#2}\XC@@tmp
  \expandafter\convertcolorspec\XC@@tmp\XC@mod@rgb\XC@@tmp
  \expandafter\edef\csname @#1bordercolor\endcsname
   {\expandafter\XC@strip@comma\XC@@tmp,,\@nnil}}
\def\XC@pdfborder#1 #2 #3\relax
 {\def\@@scl{80}\XC@calc@#1,#2,#3,,:S%
  \edef\@pdfborder{\expandafter\XC@strip@comma\@@tmp,,\@nnil}}
\@ifXCopt{table}{%
 \def\rowcolors
  {\@ifstar{\@rowcmdfalse\rowc@lors}{\@rowcmdtrue\rowc@lors}}
 \def\rowc@lors{\@testopt{\rowc@l@rs}{}}
 \def\rowc@l@rs[#1]#2#3#4%
  {\global\rownum=\z@
   \global\@rowcolorstrue
   \@ifxempty{#3}%
     {\def\@oddrowcolor{\@norowcolor}}%
     {\def\@oddrowcolor{\gdef\CT@row@color{\CT@color{#3}}}}%
   \@ifxempty{#4}%
     {\def\@evenrowcolor{\@norowcolor}}%
     {\def\@evenrowcolor{\gdef\CT@row@color{\CT@color{#4}}}}%
   \if@rowcmd
     \def\@rowcolors
      {#1\if@rowcolors
         \noalign{\relax\ifnum\rownum<#2\@norowcolor\else
                  \ifodd\rownum\@oddrowcolor\else\@evenrowcolor\fi\fi}%
       \fi}%
   \else
     \def\@rowcolors
      {\if@rowcolors
         \ifnum\rownum<#2\noalign{\@norowcolor}\else
         #1\noalign{\ifodd\rownum\@oddrowcolor\else\@evenrowcolor\fi}\fi
       \fi}%
   \fi
   \CT@everycr{\@rowc@lors\the\everycr}%
   \ignorespaces}
 \def\@rowc@lors{\noalign{\global\advance\rownum\@ne}\@rowcolors}
 \let\@rowcolors\@empty
 \def\showrowcolors{\noalign{\global\@rowcolorstrue}\@rowcolors}
 \def\hiderowcolors{\noalign{\global\@rowcolorsfalse\@norowcolor}}
 \def\@norowcolor{\global\let\CT@row@color\relax}
 \@norowcolor
 \newif\if@rowcolors
 \newif\if@rowcmd
 \@ifundefined{rownum}{\newcount\rownum}{}
 \def\CT@extract#1\columncolor#2#3\@nil
  {\if!#2%
     \let\CT@column@color\@empty
   \else
     \if[#2%
       \expandafter\CT@extractb
     \else
       \XC@edef\XC@@tmp{#2}%
       \edef\CT@column@color{\noexpand\CT@color{\XC@@tmp}}%
       \expandafter\CT@extractd
     \fi
     {#1}#3\@nil
   \fi}
}{}
\def\extractcolorspec#1#2%
 {\XC@split{#1}\edef\@@tmp{{\@@mod}{\@@clr}}\aftergroupdef#2\@@tmp}
\def\extractcolorspecs#1#2#3%
 {\extractcolorspec{#1}#3%
  \edef#2{\expandafter\@firstoftwo#3}%
  \edef#3{\expandafter\@secondoftwo#3}}
\def\XC@extract@hue#1,#2:#3{\edef#3{#1}}
\def\XC@replace@hue#1,#2:#3,#4{\edef#4{#3,#2}}
\def\@ifundefinedcolor#1{\@ifundefined{\string\color@#1}}
\def\@ifundefinedmodel#1{\@ifundefined{color@#1}}
\def\XC@type#1%
 {\expandafter\expandafter\expandafter\XC@typ@
  \csname\string\color@#1\endcsname\@empty\@empty\@empty\XC@@}
\def\XC@typ@#1#2#3#4\XC@@
 {\ifx#1\relax 0\else
    \ifx#1\xcolor@
      \ifx$#2$%
        \ifx$#3$4\else3\fi\@gobbletwo
      \else2\fi\@gobbletwo
    \else1\fi
  \fi}
\def\XC@info#1#2%
 {\XC@edef#2{#1}%
  \if.#2\def#2{0}\else\expandafter\in@\expandafter>\expandafter{#2}%
  \ifin@\def#2{4}\else\expandafter\in@\expandafter:\expandafter{#2}%
  \ifin@\def#2{3}\else\expandafter\in@\expandafter!\expandafter{#2}%
  \ifin@\def#2{2}\else\edef#2{\noexpand\in@{/-}{/#2}}#2%
  \edef#2{\ifin@2\else1\fi}\fi\fi\fi\fi}
\def\tracingcolors{\begingroup\afterassignment\XC@tracingcolors\count@}
\def\XC@tracingcolors{\aftergroupdef\XC@tracing{\the\count@}}
\tracingcolors=0
\def\XC@logdef#1%
 {\ifnum\XC@tracing>1
    \@ifundefinedcolor{#1}%
     {\ifnum\XC@tracing>2
        \PackageInfo{xcolor}{Defining color `#1'}%
      \fi}%
     {\PackageInfo{xcolor}{Redefining color `#1'}}%
  \fi}
\newenvironment*{testcolors}[1][rgb,cmyk,hsb,HTML]%
 {\let\@@nam\@empty\count@\z@
  \@for\@@tmp:=#1\do
    {\advance\count@\@ne
     \XC@sdef\@@tmp{\@@tmp}\edef\@@nam{\@@nam{\@@tmp}}}%
  \edef\@@num{\the\count@}%
  \def\XC@@gt{\textgreater}\def\@@tmp{OT1}%
  \ifx\f@encoding\@@tmp
    \@expandtwoargs\in@{,\f@family,}{,cmtt,pcr,}%
    \ifin@\def\XC@@gt{>}\fi
  \fi
  \def\XC@@xcp@{-1}\ifnum\XC@tracing>1 \def\XC@tracing{1}\fi
  \def\testcolor{\@testopt{\@testcolor}{}}%
  \def\@testcolor[##1]##2%
   {\XC@mdef\@@mod{##1}\XC@edef\@@clr{##2}%
    \ifx\@@mod\@empty
      \let\@@arg\@@clr\XC@replace\@@arg>\XC@@gt\else
      \edef\@@arg{[\@@mod]{\@@clr}}\XC@definecolor[]{*}\@@mod\@@clr
      \def\@@clr{*}\fi
    \XC@append\@@arg{&}\extractcolorspecs\@@clr\@@mod\@@clr
    \@testc@lor}%
  \def\@testc@lor
   {\count@\z@
    \expandafter\@tfor\expandafter\@@tmp\expandafter:\expandafter=\@@nam\do
     {\ifx\@@clr\@empty
        \edef\@@cmd{\noexpand\textbf{\@@tmp}}%
      \else
        \convertcolorspec\@@mod\@@clr\@@tmp\@@cmd
        \edef\@@cmd
         {\noexpand\@testc@l@r{\@@tmp}{\@@cmd}%
          \ifx\@@mod\@@tmp\noexpand\underline\fi
          {\expandafter\XC@strip@comma\@@cmd,,\@nnil}}%
      \fi
      \expandafter\XC@append\expandafter\@@arg\expandafter{\@@cmd}%
      \advance\count@\@ne
      \ifnum\count@=\@@num\XC@append\@@arg{\\}\else\XC@append\@@arg{&}\fi}%
    \@@arg}%
  \def\@testc@l@r##1##2%
   {\fboxsep\z@\fbox{\colorbox[##1]{##2}{\phantom{XX}}} }%
  \tabular{@{}l*{\@@num}{l}@{}}%
  \def\@@arg{\textbf{color}& }\let\@@clr\@empty\@testc@lor}%
 {\endtabular\ignorespacesafterend}
\def\color@setgroup{\begingroup\set@color}
\let\color@begingroup\begingroup
\def\color@endgroup{\endgraf\endgroup}
\def\color@hbox{\hbox\bgroup\color@begingroup}
\def\color@vbox{\vbox\bgroup\color@begingroup}
\def\color@endbox{\color@endgroup\egroup}
\def\convertcolorspec#1#2#3#4%
 {\begingroup
  \XC@sdef\sm{#1}\XC@sdef\tm{#3}\edef\@@tmp{#2}%
  \ifx\sm\XC@mod@named\extractcolorspecs\@@tmp\sm\@@tmp\fi
  \ifx\sm\tm\else\csname XC@cnv@\sm\expandafter\endcsname\@@tmp,\fi
  \aftergroupdef#4\@@tmp}
\def\XC@coremodel#1#2%
 {\XC@ifxcase#1%
   {\XC@mod@RGB {\convertcolorspec#1#2\XC@mod@rgb#2\let#1\XC@mod@rgb}%
    \XC@mod@HTML{\convertcolorspec#1#2\XC@mod@rgb#2\let#1\XC@mod@rgb}%
    \XC@mod@Hsb {\convertcolorspec#1#2\XC@mod@hsb#2\let#1\XC@mod@hsb}%
    \XC@mod@tHsb{\convertcolorspec#1#2\XC@mod@hsb#2\let#1\XC@mod@hsb}%
    \XC@mod@HSB {\convertcolorspec#1#2\XC@mod@hsb#2\let#1\XC@mod@hsb}%
    \XC@mod@Gray{\convertcolorspec#1#2\XC@mod@gray#2\let#1\XC@mod@gray}%
    \XC@mod@wave{\convertcolorspec#1#2\XC@mod@hsb#2\let#1\XC@mod@hsb}%
    \XC@mod@named{}%
    \XC@mod@ps{}}%
   {\expandafter\XC@calc@#2,,,,:N\let#2\@@tmp}}
\def\XC@cnv@rgb#1,#2,#3,%
 {\XC@ifxcase\tm
   {\XC@mod@cmy {\XC@calc@#1,#2,#3,,:C}%
    \XC@mod@cmyk
     {\XC@calc@#1,#2,#3,,:C\expandafter\XC@cnv@cmy@cmyk\@@tmp,}%
    \XC@mod@RGB {\edef\@@scl{\rangeRGB}\XC@calc@#1,#2,#3,,:M}%
    \XC@mod@HTML{\edef\@@scl{\@cclv}\XC@calc@#1,#2,#3,,:M%
      \expandafter\XC@calc@\@@tmp,,:H%
      \expandafter\XC@cnv@rgb@HTML\@@tmp,}%
    \XC@mod@gray{\XC@cnv@rgb@gray#1,#2,#3,}%
    \XC@mod@Gray{\XC@cnv@rgb@gray#1,#2,#3,\XC@cnv@gray\@@tmp,}}%
   {\XC@cnv@rgb@hsb#1,#2,#3,\XC@cnv@hsb@}}
\def\XC@cnv@rgb@
 {\ifx\tm\XC@mod@rgb\else\expandafter\XC@cnv@rgb\@@tmp,\fi}
\def\XC@cnv@rgb@hsb#1,#2,#3,%
 {\count@\z@
  \ifdim#2\p@>#1\p@ \else\advance\count@4 \fi
  \ifdim#3\p@>#2\p@ \else\advance\count@2 \fi
  \ifdim#1\p@>#3\p@ \else\advance\count@1 \fi
  \ifcase\count@\or
  \XC@c@v@rgb@hsb{#3}{#2}{#1}3{}\or
  \XC@c@v@rgb@hsb{#2}{#1}{#3}1{}\or
  \XC@c@v@rgb@hsb{#2}{#3}{#1}3-\or
  \XC@c@v@rgb@hsb{#1}{#3}{#2}5{}\or
  \XC@c@v@rgb@hsb{#3}{#1}{#2}5-\or
  \XC@c@v@rgb@hsb{#1}{#2}{#3}1-\or
  \def\@tempa{0}\def\@tempb{0}\XC@calcN{#3}\@tempc
  \fi
  \edef\@@tmp{\@tempa,\@tempb,\@tempc}}
\def\XC@c@v@rgb@hsb#1#2#3#4#5%
 {\XC@calcN{#1}\@tempc \llshiftset\dimen@{#1}%
  \llshiftset\@tempdimb{-#3}\advance\@tempdimb\dimen@
  \llshiftset\@tempdima{-#5#2}\advance\@tempdima#5\dimen@
  \advance\@tempdima#4\@tempdimb \rdivide\@tempdima{6\@tempdimb}%
  \edef\@tempa{\ifdim\@tempdima>\p@1\else\strip@pt\@tempdima\fi}%
  \rdivide\@tempdimb\dimen@
  \edef\@tempb{\strip@pt\@tempdimb}}
\def\XC@cnv@rgb@gray#1,#2,#3,%
 {\llshiftset\dimen@{#1}\@tempdima30\dimen@
  \llshiftset\dimen@{#2}\advance\@tempdima59\dimen@
  \llshiftset\dimen@{#3}\advance\@tempdima11\dimen@
  \rrshift\@tempdima \rdivide\@tempdima{100}%
  \edef\@@tmp{\strip@pt\@tempdima}}
\def\XC@cnv@rgb@HTML#1,#2,#3,%
 {\edef\@@tmp{#1#2#3}}
\def\XC@cnv@cmy#1,#2,#3,%
 {\XC@ifxcase\tm
   {\XC@mod@cmyk{\XC@cnv@cmy@cmyk#1,#2,#3,}%
    \XC@mod@gray{\XC@cnv@rgb@gray#1,#2,#3,\XC@calcC\@@tmp\@@tmp}%
    \XC@mod@Gray{\XC@cnv@rgb@gray#1,#2,#3,\XC@calcC\@@tmp\@@tmp
      \XC@cnv@gray\@@tmp,}}%
   {\XC@calc@#1,#2,#3,,:C\XC@cnv@rgb@}}
\def\XC@cnv@cmy@cmyk#1,#2,#3,%
 {\edef\@@scl
   {\ifdim#1\p@<#2\p@
    \ifdim#1\p@<#3\p@ #1\else #3\fi \else
    \ifdim#2\p@<#3\p@ #2\else #3\fi \fi}%
  \expandafter\XC@calc@\adjustUCRBG,:S%
  \expandafter\XC@c@v@cmy@cmyk\@@tmp,#1,#2,#3,}
\def\XC@c@v@cmy@cmyk#1,#2,#3,#4,#5,#6,#7,%
 {\XC@add#5,#6,#7,,-#1,-#2,-#3,,\@@tmp \edef\@@tmp{\@@tmp,#4}%
  \expandafter\XC@calc@\@@tmp,:N}
\def\XC@cnv@cmyk#1,#2,#3,#4,%
 {\XC@ifxcase\tm
   {\XC@mod@gray{\XC@cnv@rgb@gray#1,#2,#3,\edef\@@arg{#4}%
      \XC@calcT\@@tmp\@@tmp \XC@calcC\@@tmp\@@tmp}%
    \XC@mod@Gray{\XC@cnv@rgb@gray#1,#2,#3,\edef\@@arg{#4}%
      \XC@calcT\@@tmp\@@tmp \XC@calcC\@@tmp\@@tmp \XC@cnv@gray\@@tmp,}}%
   {\XC@cnv@cmyk@cmy#1,#2,#3,#4,%
    \ifx\tm\XC@mod@cmy\else\expandafter\XC@cnv@cmy\@@tmp,\fi}}
\def\XC@cnv@cmyk@cmy#1,#2,#3,#4,%
 {\edef\@@arg{#4}\XC@calc@#1,#2,#3,,:T}
\def\XC@cnv@hsb#1,#2,#3,%
 {\XC@ifxcase\tm
   {\XC@mod@Hsb {\XC@cnv@hsb@Hsb#1,#2,#3,}%
    \XC@mod@tHsb{\XC@cnv@hsb@Hsb#1,#2,#3,\expandafter\XC@cnv@Hsb\@@tmp,}%
    \XC@mod@HSB {\edef\@@scl{\rangeHSB}\XC@calc@#1,#2,#3,,:M}}%
   {\XC@cnv@hsb@rgb#1,#2,#3,\XC@cnv@rgb@}}
\def\XC@cnv@hsb@
 {\ifx\tm\XC@mod@hsb\else\expandafter\XC@cnv@hsb\@@tmp,\fi}
\def\XC@cnv@hsb@rgb#1,#2,#3,%
 {\llshiftset\dimen@{#1}\dimen@6\dimen@ \rrshift\dimen@
  \afterassignment\dimen@\count@=\the\dimen@
  \edef\@@tmp{\strip@pt\dimen@}%
  \ifodd\count@\else\XC@calcC\@@tmp\@@tmp\fi
  \edef\@@tmp
   {\ifcase\count@ 0,\@@tmp,1\or \@@tmp,0,1\or 1,0,\@@tmp\or
    1,\@@tmp,0\or \@@tmp,1,0\or 0,1,\@@tmp\or 0,\@@tmp,1\fi}%
  \edef\@@scl{#2}\expandafter\XC@calc@\@@tmp,,:S%
  \expandafter\XC@calc@\@@tmp,,:C%
  \edef\@@scl{#3}\expandafter\XC@calc@\@@tmp,,:S%
  \expandafter\XC@calc@\@@tmp,,:N}
\def\XC@cnv@hsb@Hsb#1,#2,#3,%
 {\XC@c@lcS\rangeHsb{,#2,#3}{#1}\@@tmp}
\def\XC@cnv@gray#1,%
 {\XC@ifxcase\tm
   {\XC@mod@rgb {\XC@calcN{#1}\@@tmp \edef\@@tmp{\@@tmp,\@@tmp,\@@tmp}}%
    \XC@mod@cmy {\XC@calcC{#1}\@@tmp \edef\@@tmp{\@@tmp,\@@tmp,\@@tmp}}%
    \XC@mod@cmyk{\XC@calcC{#1}\@@tmp \edef\@@tmp{0,0,0,\@@tmp}}%
    \XC@mod@RGB {\edef\@@scl{\rangeRGB}\XC@calcM{#1}\@@tmp
      \edef\@@tmp{\@@tmp,\@@tmp,\@@tmp}}%
    \XC@mod@HTML{\edef\@@scl{\@cclv}\XC@calcM{#1}\@@tmp
      \XC@calcH\@@tmp\@@tmp \edef\@@tmp{\@@tmp\@@tmp\@@tmp}}%
    \XC@mod@HSB {\edef\@@scl{\rangeHSB}\XC@calcM{#1}\@@tmp
      \edef\@@tmp{0,0,\@@tmp}}%
    \XC@mod@Gray{\edef\@@scl{\rangeGray}\XC@calcM{#1}\@@tmp}}%
   {\XC@calcN{#1}\@@tmp \edef\@@tmp{0,0,\@@tmp}}}
\def\XC@cnv@RGB#1,#2,#3,%
 {\edef\@@scl{\rangeRGB}\XC@calc@#1,#2,#3,,:D\XC@cnv@rgb@}
\def\XC@cnv@HTML#1,%
 {\edef\@@tmp{\expandafter\@hex@Hex#1\relax}\expandafter\XC@cnv@HTML@\@@tmp
  \edef\@@scl{\@cclv}\expandafter\XC@calc@\@@tmp,,:D\XC@cnv@rgb@}
\def\XC@cnv@HTML@#1#2#3#4#5#6%
 {\edef\@@tmp{\number"#1#2,\number"#3#4,\number"#5#6}}
\def\XC@cnv@Hsb#1,#2,#3,%
 {\ifx\tm\XC@mod@tHsb\XC@cnv@@Hsb#1,#2,#3,\XC@cnv@Hsb@
  \else\XC@cnv@Hsb@hsb#1,#2,#3,\XC@cnv@hsb@\fi}
\def\XC@cnv@Hsb@hsb#1,#2,#3,%
 {\XC@c@lcD\rangeHsb{,#2,#3}{#1}\@@tmp}
\def\XC@cnv@@Hsb#1,#2,#3,#4%
 {\dimen@\rangeHsb\p@ \advance\dimen@\p@ \edef\@@tmp{\strip@pt\dimen@}%
  \edef\@@tmp{0,0;\rangetHsb;\rangeHsb,\rangeHsb;\@@tmp,\@@tmp;}%
  \dimen@#1\p@ \expandafter#4\@@tmp\@nnil
  \edef\@@tmp{\strip@pt\dimen@,#2,#3}}
\def\XC@cnv@Hsb@#1,#2;#3,#4;%
 {\ifdim\dimen@<#4\p@
    \@tempdima#3\p@ \advance\@tempdima-#1\p@
    \@tempdimb#4\p@ \advance\@tempdimb-#2\p@
    \rdivide\@tempdima\@tempdimb
    \advance\dimen@-#2\p@ \rmultiply\dimen@{\strip@pt\@tempdima}%
    \advance\dimen@#1\p@ \expandafter\remove@to@nnil
  \else
    \def\@@tmp{\XC@cnv@Hsb@#3,#4;}\expandafter\@@tmp
  \fi}
\def\XC@cnv@tHsb#1,#2,#3,%
 {\XC@cnv@@Hsb#1,#2,#3,\XC@cnv@tHsb@
  \ifx\tm\XC@mod@Hsb\else\expandafter\XC@cnv@Hsb\@@tmp,\fi}
\def\XC@cnv@tHsb@#1,#2;#3,#4;%
 {\ifdim\dimen@<#3\p@
    \@tempdima#4\p@ \advance\@tempdima-#2\p@
    \@tempdimb#3\p@ \advance\@tempdimb-#1\p@
    \rdivide\@tempdima\@tempdimb
    \advance\dimen@-#1\p@ \rmultiply\dimen@{\strip@pt\@tempdima}%
    \advance\dimen@#2\p@ \expandafter\remove@to@nnil
  \else
    \def\@@tmp{\XC@cnv@tHsb@#3,#4;}\expandafter\@@tmp
  \fi}
\def\XC@cnv@HSB#1,#2,#3,%
 {\edef\@@scl{\rangeHSB}\XC@calc@#1,#2,#3,,:D\XC@cnv@hsb@}
\def\XC@cnv@Gray#1,%
 {\XC@c@lcD\rangeGray{}{#1}\@@tmp \XC@cnv@gray\@@tmp,}
\def\XC@cnv@wave#1,%
 {\XC@cnv@wave@hsb#1,\XC@cnv@hsb@}
\def\XC@cnv@wave@hsb#1,%
 {\@tempdima#1\p@
  \ifdim\@tempdima<440\p@
    \XC@c@v@wave@hsb{-.0166667}{7.33333}4{}\else
  \ifdim\@tempdima<490\p@
    \XC@c@v@wave@hsb{.02}{-8.8}4-\else
  \ifdim\@tempdima<510\p@
    \XC@c@v@wave@hsb{-.05}{25.5}2{}\else
  \ifdim\@tempdima<580\p@
    \XC@c@v@wave@hsb{.0142857}{-7.28571}2-\else
  \ifdim\@tempdima<645\p@
    \XC@c@v@wave@hsb{-.0153846}{9.92308}0{}\else
  \dimen@\z@ \fi\fi\fi\fi\fi
  \divide\dimen@6\relax
  \edef\@@tmp{\strip@pt\dimen@,1,}%
  \ifdim\@tempdima<420\p@
    \XC@c@v@wave@hsb{.0175}{-6.35}0{}\else
  \ifdim\@tempdima>700\p@
    \XC@c@v@wave@hsb{-.00875}{7.125}0{}\else
  \dimen@\p@ \fi\fi
  \edef\@@tmp{\@@tmp\strip@pt\dimen@}}
\def\XC@c@v@wave@hsb#1#2#3#4%
 {\dimen@#1\@tempdima \advance\dimen@#2\p@
  \XC@calcR{\strip@pt\dimen@}\@tempa
  \dimen@#4\@tempa\p@ \advance\dimen@#3\p@}
\def\XC@cnv@cmyk@compl#1,#2,#3,#4,%
 {\XC@cnv@cmyk@cmy#1,#2,#3,#4,%
  \expandafter\XC@calc@\@@tmp,,:C\expandafter\XC@cnv@cmy@cmyk\@@tmp,}
\def\XC@cnv@hsb@compl#1,#2,#3,%
 {\lshiftset\dimen@{#1}\advance\dimen@\ifdim\dimen@<5\p@-\fi-5\p@
  \rshift\dimen@ \edef\@@tmp{\strip@pt\dimen@}%
  \lshiftset\dimen@{#3}\@tempdima#2\dimen@
  \@tempdimb\@tempdima \advance\@tempdimb10\p@ \advance\@tempdimb-\dimen@
  \ifdim\@tempdimb=\z@
    \edef\@@tmp{\@@tmp,0,0}%
  \else
    \rdivide\@tempdima\@tempdimb \rshift\@tempdimb
    \edef\@@tmp{\@@tmp,\strip@pt\@tempdima,\strip@pt\@tempdimb}%
  \fi}
\def\substitutecolormodel#1#2%
 {\XC@sdef\XC@@tmp{\expandafter\XC@substitutecolormodel#2/ignore/\@nnil}%
  \ifx\XC@@tmp\XC@mod@ignore
    \XC@let@cN{color@#1}\color@ignore
  \else
    \expandafter\edef\csname color@#1\endcsname##1##2%
     {\noexpand\convertcolorspec
      \expandafter\noexpand\csname XC@mod@#1\endcsname{##2}%
      \expandafter\noexpand\csname XC@mod@\XC@@tmp\endcsname
      \noexpand\XC@@tmp\noexpand\expandafter
      \expandafter\noexpand\csname color@\XC@@tmp\endcsname
      \noexpand\expandafter##1\noexpand\expandafter{\noexpand\XC@@tmp}}%
  \fi
  \expandafter\xglobalize@\csname color@#1\endcsname \xglobal@stop
  \PackageInfo{xcolor}{Model `#1' substituted by `\XC@@tmp'}}
\def\XC@substitutecolormodel#1/%
 {\@ifundefinedmodel{#1}{\XC@substitutecolormodel}{#1\remove@to@nnil}}
\def\color@ignore#1#2{\def#1{}}
\@ifundefinedmodel{rgb}%
 {\substitutecolormodel{rgb}{RGB/HTML/hsb/Hsb/HSB/cmy/cmyk/gray/Gray}}{}
\@ifundefinedmodel{cmyk}{\substitutecolormodel{cmyk}{cmy/rgb}}{}
\@ifundefinedmodel{cmy}%
 {\PackageInfo{xcolor}{Model `cmy' substituted by `cmy0'}
  \def\color@cmy#1#2{\color@cmyk#1{#2,0}}}{}
\@ifundefinedmodel{hsb}{\@tempswatrue}%
 {\XC@ifcase\XC@@drv{{dvipdfm,textures}\@tempswatrue}\@tempswafalse}
\if@tempswa
  \substitutecolormodel{hsb}{Hsb/HSB/rgb}
\fi
\@ifundefinedmodel{RGB}%
 {\substitutecolormodel{RGB}{HTML/rgb}}
 {\PackageInfo{xcolor}{Model `RGB' extended}
  \let\XC@color@RGB\color@RGB
  \def\color@RGB#1#2%
   {\relax\ifnum\rangeRGB=255
      \XC@color@RGB#1{#2}%
    \else
      \convertcolorspec\XC@mod@RGB{#2}\XC@mod@rgb\XC@@tmp
      \expandafter\color@rgb\expandafter#1\expandafter{\XC@@tmp}%
    \fi}}
\@ifundefinedmodel{gray}{\substitutecolormodel{gray}{Gray/rgb}}{}
\@ifundefinedmodel{HTML}{\substitutecolormodel{HTML}{rgb}}{}
\@ifundefinedmodel{Hsb}{\substitutecolormodel{Hsb}{hsb}}{}
\@ifundefinedmodel{tHsb}{\substitutecolormodel{tHsb}{hsb}}{}
\@ifundefinedmodel{HSB}{\substitutecolormodel{HSB}{hsb}}{}
\@ifundefinedmodel{Gray}{\substitutecolormodel{Gray}{gray}}{}
\@ifundefinedmodel{wave}{\substitutecolormodel{wave}{hsb}}{}
\def\XC@getcolor#1#2%
 {\begingroup\toks@{#1}\XC@getc@lor#1\XC@@\aftergroupdef#2{\@@tmp}}
\def\XC@getc@lor#1#2\XC@@
 {\@ifxempty{#2}%
   {\expandafter\XC@getc@l@r#1\XC@@}%
   {\let\set@color\relax
    \ifx#1[%
      \expandafter\@undeclaredcolor\the\toks@\else
      \expandafter\@declaredcolor\expandafter{\the\toks@}\fi
    \let\@@tmp\XC@current@color}}
\def\XC@getc@l@r#1#2\XC@@
 {\ifx#1\xcolor@
    \def\@@tmp{\xcolor@#2}%
  \else
    \let\set@color\relax
    \expandafter\@declaredcolor\expandafter{\the\toks@}%
    \let\@@tmp\XC@current@color
  \fi}
\def\XC@usecolor#1{\expandafter\XC@usec@lor#1\XC@@}
\def\XC@usec@lor#1#2\XC@@
 {\ifx#1\xcolor@
    \expandafter\expandafter\expandafter\c@lor@to@ps#1#2\@@
  \else
    \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
    \expandafter\c@lor@to@ps\csname\string\color@#1#2\endcsname\@@
  \fi
  \space}
\let\XC@c@lor@to@ps\XC@usecolor
\let\pst@getcolor\XC@getcolor
\let\pst@usecolor\XC@usecolor
\def\c@lor@special#1#2{\edef\@tempa{\write#1{#2}}\@tempa}
\def\normalcolor{\let\current@color\default@color\set@color}
\AtBeginDocument{\let\default@color\current@color}
\XC@ifcase\XC@@drv
 {{dvipdf,dvipdfm,dvipdfmx,dvips,pctex32}%
  {\def\c@lor@@named#1,#2,#3\@@#4%
    {\edef#4{\expandafter\expandafter\expandafter\@thirdoffive
             \csname\string\color@#1\endcsname}}
   \def\define@color@named#1#2%
    {\@namedef{\string\color@#1}{{}{}{ \colornameprefix#1}{}{}}}}%
  {dvipsone,luatex,pctexps,pdftex,tcidvi,truetex,vtex,xetex}%
  {\def\c@lor@@named#1,#2,#3\@@#4%
    {\edef#4{\expandafter\expandafter\expandafter\@thirdoffive
             \csname\string\color@#1\endcsname}}
   \def\define@color@named#1#2%
    {\let\@@cls\@empty\@namedef{\string\color@#1}{{}{}{#2}{}{}}}}%
  {textures}%
  {\def\c@lor@@named#1,#2,#3\@@#4%
    {\edef\@tempa{\color@P@custom{#1}{\if!#2!1\else#2\fi}}%
     \expandafter\def\expandafter#4\@tempa}
   \def\define@color@named#1#2%
    {\edef\@tempa{{#1}{#2}}\expandafter\AddCustomColor\@tempa}
   \def\c@lor@ps@#1 #2\@@
    {\expandafter\expandafter\expandafter\expandafter\expandafter
     \expandafter\expandafter\c@lor@to@ps@
     \csname\string\color@#1\expandafter\endcsname\space
     #2. \@@{#1}}}%
 }{}
\definecolorset{rgb/hsb/cmyk/gray}{}{}%
 {red,1,0,0/0,1,1/0,1,1,0/.3;%
  green,0,1,0/.33333,1,1/1,0,1,0/.59;%
  blue,0,0,1/.66667,1,1/1,1,0,0/.11;%
  brown,.75,.5,.25/.083333,.66667,.75/0,.25,.5,.25/.5475;%
  lime,.75,1,0/.20833,1,1/.25,0,1,0/.815;%
  orange,1,.5,0/.083333,1,1/0,.5,1,0/.595;%
  pink,1,.75,.75/0,.25,1/0,.25,.25,0/.825;%
  purple,.75,0,.25/.94444,1,.75/0,.75,.5,.25/.2525;%
  teal,0,.5,.5/.5,1,.5/.5,0,0,.5/.35;%
  violet,.5,0,.5/.83333,1,.5/0,.5,0,.5/.205}%
\definecolorset{cmyk/rgb/hsb/gray}{}{}%
 {cyan,1,0,0,0/0,1,1/.5,1,1/.7;%
  magenta,0,1,0,0/1,0,1/.83333,1,1/.41;%
  yellow,0,0,1,0/1,1,0/.16667,1,1/.89;%
  olive,0,0,1,.5/.5,.5,0/.16667,1,.5/.39}
\definecolorset{gray/rgb/hsb/cmyk}{}{}%
 {black,0/0,0,0/0,0,0/0,0,0,1;%
  darkgray,.25/.25,.25,.25/0,0,.25/0,0,0,.75;%
  gray,.5/.5,.5,.5/0,0,.5/0,0,0,.5;%
  lightgray,.75/.75,.75,.75/0,0,.75/0,0,0,.25;%
  white,1/1,1,1/0,0,1/0,0,0,0}
\XC@@names
\AtBeginDocument{\let\XC@@stack\@empty}
\let\colornameprefix\XC@@nameprefix
\XC@catcodes
\csname xcolorcmd\endcsname
\color{black}
\endinput
%%
%% End of file `xcolor.sty'.