From cef58753eba8ad7e2071195dbd92454febe82d32 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 27 Jul 2021 03:01:57 +0000 Subject: CTAN sync 202107270301 --- macros/latex/contrib/palette/README.md | 17 ++ macros/latex/contrib/palette/palette.dtx | 403 +++++++++++++++++++++++++++++++ macros/latex/contrib/palette/palette.pdf | Bin 0 -> 180945 bytes 3 files changed, 420 insertions(+) create mode 100644 macros/latex/contrib/palette/README.md create mode 100644 macros/latex/contrib/palette/palette.dtx create mode 100644 macros/latex/contrib/palette/palette.pdf (limited to 'macros/latex/contrib/palette') diff --git a/macros/latex/contrib/palette/README.md b/macros/latex/contrib/palette/README.md new file mode 100644 index 0000000000..9e74362159 --- /dev/null +++ b/macros/latex/contrib/palette/README.md @@ -0,0 +1,17 @@ +# The LaTeX package palette - version 1.0.0 (2021/07/26) + +**palette** provides the ability to create custom color palettes and symbol palettes ("symbol suites"), and swap one palette in for another easily. It also allows the user to create a variable that represents the selected palette, and provides checks in case the variable represents a palette that does not exist. + +The package is split into `colorpalette` and `symbolsuite`. + +## Installation instructions + +A working TeX installation is required. + +This is a self-extracting dtx file, so run + + pdflatex palette.dtx + +to generate the README, documentation, and packages. + + diff --git a/macros/latex/contrib/palette/palette.dtx b/macros/latex/contrib/palette/palette.dtx new file mode 100644 index 0000000000..7697b75f6c --- /dev/null +++ b/macros/latex/contrib/palette/palette.dtx @@ -0,0 +1,403 @@ +% \iffalse meta-comment +% This package was written for pdfLaTeX. +% In particular, there is no guarantee that this works for other tex engines. +% +% Copyright (C) 2021 Dennis Chen +% +% This work may be distributed and/or modified under +% the conditions the LaTeX Project Public License (LPPL), +% either version 1.3 of this license or (at your option) +% any later version. The latest version of this license +% can be found in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +%<*internal> +\iffalse +% +%<*readme> +# The LaTeX package palette - version 1.0.0 (2021/07/26) + +**palette** provides the ability to create custom color palettes and symbol palettes ("symbol suites"), and swap one palette in for another easily. It also allows the user to create a variable that represents the selected palette, and provides checks in case the variable represents a palette that does not exist. + +The package is split into `colorpalette` and `symbolsuite`. + +## Installation instructions + +A working TeX installation is required. + +This is a self-extracting dtx file, so run + + pdflatex palette.dtx + +to generate the README, documentation, and packages. +% +% \fi + +% \iffalse + +%<*internal> +\fi +\def\nameofplainTeX{plain} +\ifx\fmtname\nameofplainTeX\else + \expandafter\begingroup +\fi +% +%<*install> + +\input docstrip.tex +\keepsilent +\askforoverwritefalse +\preamble + +This is a generated file. + +Copyright (C) 2021 Dennis Chen + +This work may be distributed and/or modified under +the conditions the LaTeX Project Public License (LPPL), +either version 1.3 of this license or (at your option) +any later version. The latest version of this license +can be found in + + http://www.latex-project.org/lppl.txt + +and version 1.3 or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +To produce the documentation, run palette.dtx through pdflatex. + +\endpreamble +\postamble + +This package consists of the file palette.dtx, + and the generated files colorpalette.sty, + symbolsuite.sty, + palette.pdf. +\endpostamble + +\usedir{tex/latex/palette} +\generate{ + \file{colorpalette.sty}{\from{\jobname.dtx}{color}} + \file{symbolsuite.sty}{\from{\jobname.dtx}{symbol}} +} + +\obeyspaces +\Msg{*************************************************************} +\Msg{* *} +\Msg{* To finish the installation you have to move the following *} +\Msg{* files into a directory searched by TeX: *} +\Msg{* *} +\Msg{* colorpalette.sty *} +\Msg{* symbolsuite.sty *} +\Msg{* *} +\Msg{* To produce the documentation, run the file *} +\Msg{* palette.dtx through LaTeX. *} +\Msg{* *} +\Msg{* Happy TeXing! *} +\Msg{* *} +\Msg{*************************************************************} + +% +%\endbatchfile +%<*internal> + +\usedir{source/latex/palette} +\generate{ + \file{\jobname.ins}{\from{\jobname.dtx}{install}} +} +\nopreamble\nopostamble + +\usedir{doc/latex/palette} +\generate{ + \file{README.md}{\from{\jobname.dtx}{readme}} +} + +\ifx\fmtname\nameofplainTeX + \expandafter\endbatchfile +\else + \expandafter\endgroup +\fi +% +% +%\NeedsTeXFormat{LaTeX2e} +%\ProvidesPackage{colorpalette} +%\ProvidesPackage{symbolsuite} +%[2021/07/26 v1.0.0 Create palettes for colors and symbols] +%\RequirePackage{xcolor} +%<*color|symbol> +\RequirePackage{ifallfalse} +\RequirePackage{macrolist} +% +%<*driver> +\ProvidesFile{\jobname.dtx}[2021/07/26 v1.0.0 Create palettes for colors and symbols] +\documentclass{ltxdoc} + +\EnableCrossrefs +\CodelineIndex +\RecordChanges + +\begin{document} + \DocInput{\jobname.dtx} + \PrintIndex + \PrintChanges +\end{document} +% +% \fi +% +% \GetFileInfo{\jobname.dtx} +% +% \changes{v1.0.0}{2021/07/26}{Initial version} +% +% \title{\textsf{palette} -- Create palettes for colors and symbols} +% \author{Dennis Chen \\ proofprogram@gmail.com} +% \date{\fileversion{} (\filedate)} +% +% \maketitle +% +% \begin{abstract} +% The \textsf{palette} package provides \textsf{colorpalette.sty} and \textsf{symbolsuite.sty}, which can be used to create and manage palettes of colors and symbols, respectively. +% \end{abstract} +% +% \section{Overview} +% We will go over the basic structure of the user interface in broad terms first (i.e. no macros or environments yet). We will use \textsf{colorpalette} as our example here, but \textsf{symbolsuite} behaves virtually identically. +% +% First, the user can create palette \emph{themes}, which are independent from each other. Then, you can add colors to themes. Finally, you can make a palette associated with a theme and set its colors. +% +% \section{colorpalette.sty} +% +% \subsection{Usage} +% +% \DescribeMacro{\newpalettetheme} +% To create a new palette theme called \textsf{theme}, write |\newpalettetheme{theme}|. +% +% \iffalse +%<*color> +\newcommand\newpalettetheme[1]{ + \newlist{colorpalette@theme@#1@palettes} + \newlist{colorpalette@theme@#1@colors} +} +% +% \fi +% \DescribeMacro{\addcolortotheme} +% To add a color \textsf{color} to theme \textsf{theme}, write |\addcolortotheme{theme}{color}|. +% +% \iffalse +%<*color> +\newcommand\addcolortotheme[2]{ + \colorpalette@themecheck{#1} + \listadd{colorpalette@theme@#1@colors}{#2} +} +% +% \fi +% +% \DescribeMacro{\newpalette} +% To create a new palette \textsf{palette} based on theme \textsf{theme}, write |\newpalette{theme}{palette}|. +% +% Palette names only need to be unique across the same theme. This means that you can have two palettes with the same name if they are associated with different themes. +% +% \iffalse +%<*color> +\newcommand\newpalette[2]{ + % Check that the theme exists + \colorpalette@themecheck{#1} + \listadd{colorpalette@theme@#1@palettes}{#2} +} +% +% \fi +% +% \DescribeMacro{\setpalettecolor} +% To set the color \textsf{color} (which was defined with respect to the theme of the palette) as the color value \textsf{value} in the format \textsf{encoding} (which by default is HTML) of palette \textsf{palette} in theme \textsf{theme}, write \begin{verbatim}\setpalettecolor{theme}{palette}{color}[encoding]{value}\end{verbatim} +% +% \iffalse +%<*color> +\newcommand\setpalettecolor[3]{ + \colorpalette@themecheck{#1} + \colorpalette@palettecheck{#1}{#2} + \colorpalette@colorcheck{#1}{#3} + \def\colorpalette@temp@themename{#1} + \def\colorpalette@temp@palettename{#2} + \def\colorpalette@temp@colorname{#3} + \colorpalette@setpalettecolor +} +\newcommand\colorpalette@setpalettecolor[2][HTML]{ + \definecolor{colorpalette@\colorpalette@temp@themename @\colorpalette@temp@palettename @\colorpalette@temp@colorname}{#1}{#2} +} +% +% \fi +% +% \DescribeMacro{\activepalette} +% This sets the active palette of a theme. (This is how palettes are ``swapped in'' with respect to a theme.) To set the active palette of theme \textsf{theme} as \textsf{palette}, write |\activepalette{theme}{palette}|. +% +% \iffalse +%<*color> +\newcommand\activepalette[2]{% + \colorpalette@themecheck{#1} + \colorpalette@palettecheck{#1}{#2} + \expandafter\def\csname colorpalette@#1@active\endcsname{#2}% +} +% +% \fi +% +% \DescribeMacro{\getcolor} +% To use, write |\getcolor{theme}{color}|. This gets the \emph{internal} color name from the \emph{active} palette of \textsf{theme}. No errors will be thrown even if you pass in an undefined theme or color (with respect to the theme). This limitation is because we must be able to parse |\getcolor|. +% +% \iffalse +%<*color> +\newcommand\getcolor[2]{colorpalette@#1@\csname colorpalette@#1@active\endcsname @#2} +% +% \fi +% +% \DescribeMacro{\applycolor} +% To use, write |\applycolor{theme}{color}|. This applies color \textsf{color} from the \emph{active} palette of theme \textsf{theme}. (This means that the newly defined color is passed into |\color|.) If \textsf{theme} has no active palette, an error will be thrown. +% +% To make it clearer what |\applycolor| does, we will just show the macro definition directly (since it is quite simple). (The macros |\colorpalette@themecheck| and |\colorpalette@colorcheck| are just for error handling.) +% +% \begin{macrocode} +%<*color> +\newcommand\applycolor[2]{% + \colorpalette@themecheck{#1}% + \colorpalette@colorcheck{#1}{#2}% + \color{\getcolor{#1}{#2}}% +} +% +% \end{macrocode} +% +% \subsection{Error Messages} +% \iffalse +%<*color> +\newcommand\colorpalette@themecheck[1]{\listexists{colorpalette@theme@#1@palettes}{}{\colorpalette@error@theme{#1}}} +\newcommand\colorpalette@palettecheck[2]{\listcontains{colorpalette@theme@#1@palettes}{#2}{}{\colorpalette@error@palette{#1}{#2}}} +\newcommand\colorpalette@colorcheck[2]{\listcontains{colorpalette@theme@#1@colors}{#2}{}{\colorpalette@error@color{#1}{#2}}} +% +% \fi +% +% If a nonexistent theme is passed in, the following error will be thrown: +% \begin{verbatim}The palette passed in is not a defined palette of theme `#1'\end{verbatim} +% where |#1| is the name of the theme. +% \iffalse +%\newcommand\colorpalette@error@theme[1]{\PackageError{colorpalette}{The theme `#1' passed in is not defined}{}} +% \fi +% +% If a palette that does not belong to a theme is passed in, the following error will be thrown: +% \begin{verbatim}The palette `#2' passed in is not a defined palette of theme `#1'\end{verbatim} +% where |#1| is the name of the theme and |#2| is the name of the palette. +% \iffalse +%\newcommand\colorpalette@error@palette[2]{\PackageError{colorpalette}{The palette `#2' passed in is not a defined palette of theme `#1'}{}} +% \fi +% +% If a color that does not belong to a theme is passed in, the following error will be thrown: +% \begin{verbatim}The color `#2' passed in is not a defined color of theme `#1'\end{verbatim} +% where |#1| is the name of the theme and |#2| is the name of the color. +% \iffalse +%\newcommand\colorpalette@error@color[2]{\PackageError{colorpalette}{The color `#2' passed in is not a defined color of theme `#1'}{}} +% \fi +% +% \section{symbolsuite.sty} +% +% This package is nearly analogous to \textsf{colorpalette}. A \emph{suite} is analogous to a \emph{palette}, and a \emph{symbol} is analogous to a \emph{color}. \emph{Themes} are used in both packages. +% +% \subsection{Usage} +% +% \DescribeMacro{\newsuitetheme} +% To create a new suite theme called \textsf{theme}, write |\newsuitetheme{theme}|. +% +% \iffalse +%<*symbol> +\newcommand\newsuitetheme[1]{ + \newlist{symbolsuite@theme@#1@suites} + \newlist{symbolsuite@theme@#1@symbols} +} +% +% \fi +% \DescribeMacro{\addsymboltotheme} +% To add a symbol \textsf{symbol} to theme \textsf{theme}, write |\addsymboltotheme{theme}{symbol}|. +% +% \iffalse +%<*symbol> +\newcommand\addsymboltotheme[2]{ + \symbolsuite@themecheck{#1} + \listadd{symbolsuite@theme@#1@symbols}{#2} +} +% +% \fi +% +% \DescribeMacro{\newsuite} +% To create a new suite \textsf{suite} based on theme \textsf{theme}, write |\newsuite{theme}{suite}|. +% +% Suite names only need to be unique across the same theme. This means that you can have two suites with the same name if they are associated with different themes. +% +% \iffalse +%<*symbol> +\newcommand\newsuite[2]{ + \symbolsuite@themecheck{#1} + \listadd{symbolsuite@theme@#1@suites}{#2} +} +% +% \fi +% +% \DescribeMacro{\setsuitesymbol} +% To set the symbol \textsf{symbol} (which was defined with respect to the theme of the suite) as the icon \textsf{icon} of suite \textsf{suite} in theme \textsf{theme}, write \begin{verbatim}\setsuitesymbol{theme}{suite}{symbol}{icon}\end{verbatim} +% +% \iffalse +%\newcommand\setsuitesymbol[4]{\expandafter\def\csname symbolsuite@#1@#2@#3\endcsname{#4}} +% \fi +% +% \DescribeMacro{\activesuite} +% This sets the active suite of a theme. (This is how suites are ``swapped in'' with respect to a theme.) To set the active suite of theme \textsf{theme} as \textsf{suite}, write |\activesuite{theme}{suite}|. +% +% \iffalse +%<*symbol> +\newcommand\activesuite[2]{ + \symbolsuite@themecheck{#1} + \symbolsuite@suitecheck{#1}{#2} + \expandafter\def\csname symbolsuite@#1@active\endcsname{#2} +} +% +% \fi +% +% \DescribeMacro{\printsymbol} +% To use, write |\printsymbol{theme}{symbol}|. This is similar to \textsf{colorpalette.sty}'s |\applycolor|. +% \iffalse +%<*symbol> +\newcommand\printsymbol[2]{% + \symbolsuite@themecheck{#1}% + \symbolsuite@symbolcheck{#1}{#2}% + \csname symbolsuite@#1@\csname symbolsuite@#1@active\endcsname @#2\endcsname% +} +% +% \fi +% +% \subsection{Error Messages} +% \iffalse +%<*symbol> +\newcommand\symbolsuite@themecheck[1]{\listexists{symbolsuite@theme@#1@suites}{}{\symbolsuite@error@theme{#1}}} +\newcommand\symbolsuite@suitecheck[2]{\listcontains{symbolsuite@theme@#1@suites}{#2}{}{\symbolsuite@error@suite{#1}{#2}}} +\newcommand\symbolsuite@symbolcheck[2]{\listcontains{symbolsuite@theme@#1@symbols}{#2}{}{\symbolsuite@error@symbol{#1}{#2}}} +% +% \fi +% +% If a nonexistent theme is passed in, the following error will be thrown: +% \begin{verbatim}The palette passed in is not a defined palette of theme `#1'\end{verbatim} +% where |#1| is the name of the theme. +% \iffalse +%\newcommand\symbolsuite@error@theme[1]{\PackageError{symbolsuite}{The theme `#1' passed in is not defined}{}} +% \fi +% +% If a suite that does not belong to a theme is passed in, the following error will be thrown: +% \begin{verbatim}The suite `#2' passed in is not a defined suite of theme `#1'\end{verbatim} +% where |#1| is the name of the theme and |#2| is the name of the suite. +% \iffalse +%\newcommand\symbolsuite@error@suite[2]{\PackageError{symbolsuite}{The suite `#2' passed in is not a defined suite of theme `#1'}{}} +% \fi +% +% If a symbol that does not belong to a theme is passed in, the following error will be thrown: +% \begin{verbatim}The symbol `#2' passed in is not a defined symbol of theme `#1'\end{verbatim} +% where |#1| is the name of the theme and |#2| is the name of the symbol. +% \iffalse +%\newcommand\symbolsuite@error@symbol[2]{\PackageError{symbolsuite}{The symbol `#2' passed in is not a defined color of theme `#1'}{}} +% \fi +% \Finale +% +\endinput \ No newline at end of file diff --git a/macros/latex/contrib/palette/palette.pdf b/macros/latex/contrib/palette/palette.pdf new file mode 100644 index 0000000000..31227e386e Binary files /dev/null and b/macros/latex/contrib/palette/palette.pdf differ -- cgit v1.2.3