From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/latex/contrib/colorwav/README | 30 ++ macros/latex/contrib/colorwav/colorwav.dtx | 533 +++++++++++++++++++++++++++++ macros/latex/contrib/colorwav/colorwav.ins | 40 +++ macros/latex/contrib/colorwav/colorwav.pdf | Bin 0 -> 115189 bytes 4 files changed, 603 insertions(+) create mode 100644 macros/latex/contrib/colorwav/README create mode 100644 macros/latex/contrib/colorwav/colorwav.dtx create mode 100644 macros/latex/contrib/colorwav/colorwav.ins create mode 100644 macros/latex/contrib/colorwav/colorwav.pdf (limited to 'macros/latex/contrib/colorwav') diff --git a/macros/latex/contrib/colorwav/README b/macros/latex/contrib/colorwav/README new file mode 100644 index 0000000000..1c6a28051c --- /dev/null +++ b/macros/latex/contrib/colorwav/README @@ -0,0 +1,30 @@ +Description +----------- + +The colorwav package is a package that allows one to specify a wavelength (default +in nanometers) and retrieve the RGB value based upon code written by Dan Bruton. + +Installation +------------ + +To install this package, run colorwav.ins through LaTeX. This will generate +a file called colorwav.sty. Put this file somewhere where LaTeX will find +it---for instance localtexmf/tex/latex/colorwav/ (note that you will need +to create the folder colorwav). + +If you are using MikTeX, you then need to refresh the file name database +by using MikTeX Options + + +License +------- + +This package is released under the GNU Lesser General Public License. See +http://www.gnu.org/licenses/licenses.html#LGPL for more details. + +Contact +------- + +Any bugs may be reported to the author by sending an email to the address with +the first part being nsetzer, then an at sign, the next part is umd, and +finally it ends in dot edu. \ No newline at end of file diff --git a/macros/latex/contrib/colorwav/colorwav.dtx b/macros/latex/contrib/colorwav/colorwav.dtx new file mode 100644 index 0000000000..1128b0a28e --- /dev/null +++ b/macros/latex/contrib/colorwav/colorwav.dtx @@ -0,0 +1,533 @@ +% \iffalse +% +%\NeedsTeXFormat{LaTeX2e}[1999/12/01] +%\ProvidesPackage{colorwav} +% [2007/04/12 v1.0 specify wavelength for color] +%\RequirePackage{ifthen} +%\RequirePackage{fp} +% +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{colorwav} +\usepackage{color} +\usepackage{url} +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\begin{document} +\DocInput{colorwav.dtx} +\end{document} +% +% \fi +% +% \CheckSum{252} +% +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +% +% \changes{v1.0}{2007/04/12}{Initial Release} +% +% \GetFileInfo{colorwav.sty} +% +% \DoNotIndex{\#,\$,\%,\&,\@,\\,\{,\},\^,\_,\~,\ ,\!,\(,\),\,} +% \DoNotIndex{\@ne,\expandafter,\noexpand} +% \DoNotIndex{\advance,\begingroup,\catcode,\closein} +% \DoNotIndex{\newcommand,\renewcommand,\providecommand} +% \DoNotIndex{\closeout,\day,\def,\edef,\gdef,\xdef,\let,\empty,\endgroup} +% \DoNotIndex{\newcounter,\providecounter,\addtocounter,\setcounter,\stepcounter,\value,\arabic} +% \DoNotIndex{\if,\fi,\ifthenelse,\else,\setboolean,\boolean,\newboolean,\provideboolean,\equal,\AND,\OR,\NOT,\whiledo} +% \DoNotIndex{\ifcase,\ifcat,\or,\else} +% \DoNotIndex{\par,\parbox,\mbox,\hbox,\begin,\end,\nabla,\partial} +% \DoNotIndex{\overline,\bar,\small,\tiny,\mathchoice,\scriptsize,\textrm,\texttt} +% \DoNotIndex{\alpha,\beta,\gamma,\epsilon,\varepsilon,\delta,\zeta,\eta,\theta,\vartheta,\iota,\kappa,\lambda,\mu,\nu} +% \DoNotIndex{\xi,\omicron,\pi,\varpi,\rho,\varrho,\sigma,\tau,\upsilon,\phi,\varphi,\chi,\psi,\omega} +% \DoNotIndex{\Delta,\Gamma,\Theta,\Lambda,\Xi,\Pi,\Sigma,\Phi,\Psi,\Omega} +% \DoNotIndex{\digamma,\lceil,\rceil,\lfloor,\rfloor,\left,\right,\inp,\inb,\inbr,\inap,\nop} +% \DoNotIndex{\PackageError,\PackageWarning} +% \DoNotIndex{\csname,\endcsname,\ifx,\ifnum} +% \DoNotIndex{\FPround,\FPadd,\FPsub,\FPmul,\FPdiv,\FPpow,\FPiflt,\FPifgt,\FPifzero} +% \DoNotIndex{\COLORWAV@tempA,\COLORWAV@tempB} +% +% \title{The \textsf{colorwav} package\thanks{This document +% corresponds to \textsf{colorwav}~\fileversion, +% dated~\filedate.}} +% \author{nsetzer} +% +% \maketitle +% +% \setcounter{IndexColumns}{2} +% \StopEventually{\PrintChanges\PrintIndex} +% +% The \textsf{colorwav} package defines a command to return the RGB values for a color corresponding to a given wavelength. +% The \LaTeX{} code is based upon the FORTRAN code found at \url{http://www.efg2.com/Lab/ScienceAndEngineering/Spectra.htm} +% which is based upon Dan Bruton's FORTRAN code. +% +% For more information on the mapping and the original FORTRAN code, see \url{http://www.midnightkite.com/color.html} +% +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%\section{Basics} +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% The physics of this is far too complicated to get into, but it may come about that you have a wavelength +% of light that you need to express as a color and this code will do that for you. +% +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%\section{Descriptions} +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% \DescribeMacro{\storeRGBofWavelength} +% |\storeRGBofWavelength|\marg{R value command}\marg{G value command}\marg{B value commmand}\marg{wavelength} stores +% the RGB values of \meta{wavelength} in \meta{R value command}, \meta{G value command}, \meta{B value command} +% respectively +% +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%\section{Test Cases} +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % +%\subsection{Wavelengths in Nanometers (default)} +% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% \DescribeMacro{\storeRGBofWavelength} +% +% \newcommand{\Rval}{} +% \newcommand{\Gval}{} +% \newcommand{\Bval}{} +% +% \begin{tabular}{ll} +% \hline +% |\storeRGBofWavelength{\Rval}{\Gval}{\Bval}{400}| \\ +% |\textcolor[rgb]{\Rval,\Gval,\Bval}{400}| & \storeRGBofWavelength{\Rval}{\Gval}{\Bval}{400} \textcolor[rgb]{\Rval,\Gval,\Bval}{400} \\ \\ +% |\storeRGBofWavelength{\Rval}{\Gval}{\Bval}{430}| \\ +% |\textcolor[rgb]{\Rval,\Gval,\Bval}{430}| & \storeRGBofWavelength{\Rval}{\Gval}{\Bval}{430} \textcolor[rgb]{\Rval,\Gval,\Bval}{430} \\ \\ +% |\storeRGBofWavelength{\Rval}{\Gval}{\Bval}{460}| \\ +% |\textcolor[rgb]{\Rval,\Gval,\Bval}{460}| & \storeRGBofWavelength{\Rval}{\Gval}{\Bval}{460} \textcolor[rgb]{\Rval,\Gval,\Bval}{460} \\ \\ +% |\storeRGBofWavelength{\Rval}{\Gval}{\Bval}{490}| \\ +% |\textcolor[rgb]{\Rval,\Gval,\Bval}{490}| & \storeRGBofWavelength{\Rval}{\Gval}{\Bval}{490} \textcolor[rgb]{\Rval,\Gval,\Bval}{490} \\ \\ +% |\storeRGBofWavelength{\Rval}{\Gval}{\Bval}{520}| \\ +% |\textcolor[rgb]{\Rval,\Gval,\Bval}{520}| & \storeRGBofWavelength{\Rval}{\Gval}{\Bval}{520} \textcolor[rgb]{\Rval,\Gval,\Bval}{520} \\ \\ +% |\storeRGBofWavelength{\Rval}{\Gval}{\Bval}{550}| \\ +% |\textcolor[rgb]{\Rval,\Gval,\Bval}{550}| & \storeRGBofWavelength{\Rval}{\Gval}{\Bval}{550} \textcolor[rgb]{\Rval,\Gval,\Bval}{550} \\ \\ +% |\storeRGBofWavelength{\Rval}{\Gval}{\Bval}{580}| \\ +% |\textcolor[rgb]{\Rval,\Gval,\Bval}{580}| & \storeRGBofWavelength{\Rval}{\Gval}{\Bval}{580} \textcolor[rgb]{\Rval,\Gval,\Bval}{580} \\ \\ +% |\storeRGBofWavelength{\Rval}{\Gval}{\Bval}{600}| \\ +% |\textcolor[rgb]{\Rval,\Gval,\Bval}{600}| & \storeRGBofWavelength{\Rval}{\Gval}{\Bval}{600} \textcolor[rgb]{\Rval,\Gval,\Bval}{600} \\ \\ +% |\storeRGBofWavelength{\Rval}{\Gval}{\Bval}{630}| \\ +% |\textcolor[rgb]{\Rval,\Gval,\Bval}{630}| & \storeRGBofWavelength{\Rval}{\Gval}{\Bval}{630} \textcolor[rgb]{\Rval,\Gval,\Bval}{630} \\ \\ +% |\storeRGBofWavelength{\Rval}{\Gval}{\Bval}{660}| \\ +% |\textcolor[rgb]{\Rval,\Gval,\Bval}{660}| & \storeRGBofWavelength{\Rval}{\Gval}{\Bval}{660} \textcolor[rgb]{\Rval,\Gval,\Bval}{660} \\ \\ +% |\storeRGBofWavelength{\Rval}{\Gval}{\Bval}{690}| \\ +% |\textcolor[rgb]{\Rval,\Gval,\Bval}{690}| & \storeRGBofWavelength{\Rval}{\Gval}{\Bval}{690} \textcolor[rgb]{\Rval,\Gval,\Bval}{690} \\ +% \hline +% \end{tabular} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % +%\subsection{Wavelengths in Angstroms} +% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% \DescribeMacro{\storeRGBofWavelength} +% +% Change the units to Angstroms +% |\setUnitsE{-10}| +% \setUnitsE{-10} +% +% +% +% +% \begin{tabular}{lll} +% \hline +% |\storeRGBofWavelength{\Rval}{\Gval}{\Bval}{4000}| \\ +% |\textcolor[rgb]{\Rval,\Gval,\Bval}{4000}| & \storeRGBofWavelength{\Rval}{\Gval}{\Bval}{4000} \textcolor[rgb]{\Rval,\Gval,\Bval}{4000} \\ \\ +% |\storeRGBofWavelength{\Rval}{\Gval}{\Bval}{4300}| \\ +% |\textcolor[rgb]{\Rval,\Gval,\Bval}{4300}| & \storeRGBofWavelength{\Rval}{\Gval}{\Bval}{4300} \textcolor[rgb]{\Rval,\Gval,\Bval}{4300} \\ \\ +% |\storeRGBofWavelength{\Rval}{\Gval}{\Bval}{4600}| \\ +% |\textcolor[rgb]{\Rval,\Gval,\Bval}{4600}| & \storeRGBofWavelength{\Rval}{\Gval}{\Bval}{4600} \textcolor[rgb]{\Rval,\Gval,\Bval}{4600} \\ \\ +% |\storeRGBofWavelength{\Rval}{\Gval}{\Bval}{4900}| \\ +% |\textcolor[rgb]{\Rval,\Gval,\Bval}{4900}| & \storeRGBofWavelength{\Rval}{\Gval}{\Bval}{4900} \textcolor[rgb]{\Rval,\Gval,\Bval}{4900} \\ \\ +% |\storeRGBofWavelength{\Rval}{\Gval}{\Bval}{5200}| \\ +% |\textcolor[rgb]{\Rval,\Gval,\Bval}{5200}| & \storeRGBofWavelength{\Rval}{\Gval}{\Bval}{5200} \textcolor[rgb]{\Rval,\Gval,\Bval}{5200} \\ \\ +% |\storeRGBofWavelength{\Rval}{\Gval}{\Bval}{5500}| \\ +% |\textcolor[rgb]{\Rval,\Gval,\Bval}{5500}| & \storeRGBofWavelength{\Rval}{\Gval}{\Bval}{5500} \textcolor[rgb]{\Rval,\Gval,\Bval}{5500} \\ \\ +% |\storeRGBofWavelength{\Rval}{\Gval}{\Bval}{5800}| \\ +% |\textcolor[rgb]{\Rval,\Gval,\Bval}{5800}| & \storeRGBofWavelength{\Rval}{\Gval}{\Bval}{5800} \textcolor[rgb]{\Rval,\Gval,\Bval}{5800} \\ \\ +% |\storeRGBofWavelength{\Rval}{\Gval}{\Bval}{6000}| \\ +% |\textcolor[rgb]{\Rval,\Gval,\Bval}{6000}| & \storeRGBofWavelength{\Rval}{\Gval}{\Bval}{6000} \textcolor[rgb]{\Rval,\Gval,\Bval}{6000} \\ \\ +% |\storeRGBofWavelength{\Rval}{\Gval}{\Bval}{6300}| \\ +% |\textcolor[rgb]{\Rval,\Gval,\Bval}{6300}| & \storeRGBofWavelength{\Rval}{\Gval}{\Bval}{6300} \textcolor[rgb]{\Rval,\Gval,\Bval}{6300} \\ \\ +% |\storeRGBofWavelength{\Rval}{\Gval}{\Bval}{6600}| \\ +% |\textcolor[rgb]{\Rval,\Gval,\Bval}{6600}| & \storeRGBofWavelength{\Rval}{\Gval}{\Bval}{6600} \textcolor[rgb]{\Rval,\Gval,\Bval}{6600} \\ \\ +% |\storeRGBofWavelength{\Rval}{\Gval}{\Bval}{6900}| \\ +% |\textcolor[rgb]{\Rval,\Gval,\Bval}{6900}| & \storeRGBofWavelength{\Rval}{\Gval}{\Bval}{6900} \textcolor[rgb]{\Rval,\Gval,\Bval}{6900} \\ +% \hline +% \end{tabular} +% +% +% +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%\section{Acknowledgments} +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Special Thanks to \url{http://www.efg2.com/Lab/ScienceAndEngineering/Spectra.htm} and Dan Bruton for placing their +% code online so that it may be translated to other languages. +% +% +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%\section{Implementation} +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % +%\subsection{Constants and Parameters} +% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% \begin{macro}{\COLORWAV@gamma} +% This is the gamma correction factor. +% \begin{macrocode} +\newcommand{\COLORWAV@gamma}{0.8}% +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\setGammaCorrection} +% Allow the user to set the gamma correction +% \begin{macrocode} +\newcommand{\setGammaCorrection}[1]{% +\renewcommand{\COLORWAV@gamma}{#1}% +} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\COLORWAV@powerOfTen} +% The power of ten representing the units of the wavelength. +% $\lambda$ is in $10$ to the |\COLORWAV@powerOfTen| meters +% \begin{macrocode} +\newcommand{\COLORWAV@powerOfTen}{-9}% +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\setUnitsE} +% Set the power of ten of the units +% \begin{macrocode} +\newcommand{\setUnitsE}[1]{% +\renewcommand{\COLORWAV@powerOfTen}{#1}% +}% +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\COLORWAV@minWavelength} +% The minimum wavelength to accept +% \begin{macrocode} +\newcommand{\COLORWAV@minWavelength}{380}% +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\setMinVisibleWavelength} +% Set the min wavelength +% \begin{macrocode} +\newcommand{\setMinVisibleWavelength}[1]{% +\renewcommand{\COLORWAV@minWavelength}{#1}% +}% +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\COLORWAV@maxWavelength} +% Max visible wavelength +% \begin{macrocode} +\newcommand{\COLORWAV@maxWavelength}{780}% +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\setMaxVisibleWavelength} +% Set the maximum visible wavelength +% \begin{macrocode} +\newcommand{\setMaxVisibleWavelength}[1]{% +\renewcommand{\COLORWAV@maxWavelength}{#1}% +}% +% \end{macrocode} +% \end{macro} +% +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % +%\subsection{Internal Functions} +% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% \begin{macro}{\COLORWAV@colorAdjust} +% a function that adjust things. +% \begin{macrocode} +\newcommand{\COLORWAV@colorAdjust}[3]{% +\FPifzero{#2}% +\xdef#1{0}% +\else% +\FPmul{\COLORWAV@tempA}{#2}{#3}% +\FPpow{\COLORWAV@tempA}{\COLORWAV@tempA}{\COLORWAV@gamma}% +\xdef#1{\COLORWAV@tempA}% +\fi% +}% +% \end{macrocode} +% \end{macro} +% +% +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % +%\subsection{Internal Parameters} +% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% \begin{macrocode} +\newboolean{COLORWAV@lessthansmallest}% +\newboolean{COLORWAV@greaterthanlargest}% +\newboolean{COLORWAV@isnearuv}% +\newboolean{COLORWAV@isviolet}% +\newboolean{COLORWAV@isindigo}% +\newboolean{COLORWAV@isblue}% +\newboolean{COLORWAV@isgreen}% +\newboolean{COLORWAV@isorange}% +\newboolean{COLORWAV@isnearir}% +% \end{macrocode} +% +% +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % +%\subsection{The Workhorse} +% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% +% \begin{macro}{\storeRGBofWavelength} +% |\storeRGBofWavlength|\marg{R value command}\marg{G value command}\marg{B value command}\marg{wavelength} +% stores the wavelength's R value number in \meta{R value command}, etc +% \begin{macrocode} +\newcommand{\storeRGBofWavelength}[4]{% +% \end{macrocode} +% initialize booleans +% \begin{macrocode} +\setboolean{COLORWAV@lessthansmallest}{false}% +\setboolean{COLORWAV@greaterthanlargest}{false}% +\setboolean{COLORWAV@isnearuv}{false}% +\setboolean{COLORWAV@isviolet}{false}% +\setboolean{COLORWAV@isindigo}{false}% +\setboolean{COLORWAV@isblue}{false}% +\setboolean{COLORWAV@isgreen}{false}% +\setboolean{COLORWAV@isorange}{false}% +\setboolean{COLORWAV@isnearir}{false}% +% \end{macrocode} +% get the current units and convert to nanometers +% \begin{macrocode} +\FPsub{\COLORWAV@tempA}{\COLORWAV@powerOfTen}{-9}% +\FPpow{\COLORWAV@tempA}{10}{\COLORWAV@tempA}% +\FPmul{\COLORWAV@thewavelen}{#4}{\COLORWAV@tempA}% +% \end{macrocode} +% Now set the booleans based upon the wavelength. +% One can't just use the FP conditionals since they aren't always expanded +% and this leads to ``extra" |\fi|'s +% \begin{macrocode} +\FPiflt{\COLORWAV@thewavelen}{\COLORWAV@minWavelength}% + \setboolean{COLORWAV@lessthansmallest}{true}% +\fi% +% +\FPifgt{\COLORWAV@thewavelen}{\COLORWAV@maxWavelength}% + \setboolean{COLORWAV@greaterthanlargest}{true}% +\fi% +% +\FPiflt{\COLORWAV@thewavelen}{440}% + \setboolean{COLORWAV@isviolet}{true}% +\fi% +% +\FPiflt{\COLORWAV@thewavelen}{490}% + \setboolean{COLORWAV@isindigo}{true}% +\fi% +% +\FPiflt{\COLORWAV@thewavelen}{510}% + \setboolean{COLORWAV@isblue}{true}% +\fi% +% +\FPiflt{\COLORWAV@thewavelen}{580}% + \setboolean{COLORWAV@isgreen}{true}% +\fi% +% +\FPiflt{\COLORWAV@thewavelen}{645}% + \setboolean{COLORWAV@isorange}{true}% +\fi% +% \end{macrocode} +% now determine what to do +% \begin{macrocode} +\ifthenelse{ \boolean{COLORWAV@lessthansmallest} \OR \boolean{COLORWAV@greaterthanlargest} }% + {% + \gdef\COLORWAV@redValue{0}% + \gdef\COLORWAV@greenValue{0}% + \gdef\COLORWAV@blueValue{0}% + }% +{\ifthenelse{ \boolean{COLORWAV@isviolet} }% + {% + % R + \FPsub{\COLORWAV@tempA}{440}{\COLORWAV@minWavelength}% + \FPsub{\COLORWAV@tempB}{440}{\COLORWAV@thewavelen}% + \FPdiv{\COLORWAV@redValue}{\COLORWAV@tempB}{\COLORWAV@tempA}% + % G + \gdef\COLORWAV@greenValue{0.0}% + % B + \gdef\COLORWAV@blueValue{1.0}% + }% +{\ifthenelse{ \boolean{COLORWAV@isindigo} }% + {% + % R + \gdef\COLORWAV@redValue{0.0}% + % G + \FPsub{\COLORWAV@tempA}{490}{440}% + \FPsub{\COLORWAV@tempB}{\COLORWAV@thewavelen}{440}% + \FPdiv{\COLORWAV@greenValue}{\COLORWAV@tempB}{\COLORWAV@tempA}% + % B + \gdef\COLORWAV@blueValue{1.0}% + }% +{\ifthenelse{ \boolean{COLORWAV@isblue} }% + {% + %R + \gdef\COLORWAV@redValue{0.0}% + %G + \gdef\COLORWAV@greenValue{1.0}% + %B + \FPsub{\COLORWAV@tempA}{510}{490}% + \FPsub{\COLORWAV@tempB}{510}{\COLORWAV@thewavelen}% + \FPdiv{\COLORWAV@blueValue}{\COLORWAV@tempB}{\COLORWAV@tempA}% + }% +{\ifthenelse{ \boolean{COLORWAV@isgreen} }% + {% + %R + \FPsub{\COLORWAV@tempA}{580}{510}% + \FPsub{\COLORWAV@tempB}{\COLORWAV@thewavelen}{510}% + \FPdiv{\COLORWAV@redValue}{\COLORWAV@tempB}{\COLORWAV@tempA}% + %G + \gdef\COLORWAV@greenValue{1.0}% + %B + \gdef\COLORWAV@blueValue{0.0}% + }% +{\ifthenelse{ \boolean{COLORWAV@isorange} }% + {% + %R + \gdef\COLORWAV@redValue{1.0}% + %G + \FPsub{\COLORWAV@tempA}{645}{580}% + \FPsub{\COLORWAV@tempB}{645}{\COLORWAV@thewavelen}% + \FPdiv{\COLORWAV@greenValue}{\COLORWAV@tempB}{\COLORWAV@tempA}% + %B + \gdef\COLORWAV@blueValue{0.0}% + }% +% Else + {% + %R + \gdef\COLORWAV@redValue{1.0}% + %G + \gdef\COLORWAV@greenValue{0.0}% + %B + \gdef\COLORWAV@blueValue{0.0}% + }}}}}}% +% \end{macrocode} +% now adjust intensity to fall off near vision limits +% \begin{macrocode} +\FPiflt{\COLORWAV@thewavelen}{420}% + \setboolean{COLORWAV@isnearuv}{true}% +\fi% +% +\FPifgt{\COLORWAV@thewavelen}{700}% + \setboolean{COLORWAV@isnearir}{true}% +\fi% +% +\ifthenelse{ \boolean{COLORWAV@lessthansmallest} \OR \boolean{COLORWAV@greaterthanlargest} }% + {% + \gdef\COLORWAV@multFactor{0}% + }% +{\ifthenelse{ \boolean{COLORWAV@isnearuv} }% + {% + \FPsub{\COLORWAV@tempA}{420}{\COLORWAV@minWavelength}% + \FPsub{\COLORWAV@tempB}{\COLORWAV@thewavelen}{\COLORWAV@minWavelength}% + \FPdiv{\COLORWAV@multFactor}{\COLORWAV@tempB}{\COLORWAV@tempA}% + \FPmul{\COLORWAV@multFactor}{0.7}{\COLORWAV@multFactor}% + \FPadd{\COLORWAV@multFactor}{0.3}{\COLORWAV@multFactor}% + }% +{\ifthenelse{ \boolean{COLORWAV@isnearir} }% + {% + \FPsub{\COLORWAV@tempA}{\COLORWAV@maxWavelength}{700}% + \FPsub{\COLORWAV@tempB}{\COLORWAV@maxWavelength}{\COLORWAV@thewavelen}% + \FPdiv{\COLORWAV@multFactor}{\COLORWAV@tempB}{\COLORWAV@tempA}% + \FPmul{\COLORWAV@multFactor}{0.7}{\COLORWAV@multFactor}% + \FPadd{\COLORWAV@multFactor}{0.3}{\COLORWAV@multFactor}% + }% +% Else + {% + \gdef\COLORWAV@multFactor{1.0}% + }}}% +% \end{macrocode} +% finally, adjust and return the colors +% \begin{macrocode} +\COLORWAV@colorAdjust{#1}{\COLORWAV@redValue}{\COLORWAV@multFactor}% +\COLORWAV@colorAdjust{#2}{\COLORWAV@greenValue}{\COLORWAV@multFactor}% +\COLORWAV@colorAdjust{#3}{\COLORWAV@blueValue}{\COLORWAV@multFactor}% +}% +% +% \end{macrocode} +% \end{macro} +% +% +% +% +% +% +% +% \Finale +\endinput \ No newline at end of file diff --git a/macros/latex/contrib/colorwav/colorwav.ins b/macros/latex/contrib/colorwav/colorwav.ins new file mode 100644 index 0000000000..4cce8df576 --- /dev/null +++ b/macros/latex/contrib/colorwav/colorwav.ins @@ -0,0 +1,40 @@ +%% +%% Copyright (C) 2007 by nsetzer +%% +%% This file may be distributed and/or modified under the +%% conditions of the Limited General Product License +%% + +\input docstrip.tex + +\keepsilent + +\usedir{tex/latex/colorwav} + +\preamble + +This is a generated file + +This file may be distributed and/or modified under the +conditions of the Limited General Product License + +\endpreamble + + +\generate{\file{colorwav.sty}{\from{colorwav.dtx}{package}}} + +\obeyspaces +\Msg{****************************************************} +\Msg{* *} +\Msg{* To finish the installation you have to move the *} +\Msg{* following file into a directory searched by TeX: *} +\Msg{* *} +\Msg{* colorwav.sty *} +\Msg{* *} +\Msg{* To produce the documentation run the file *} +\Msg{* colorwav.dtx through LaTeX. *} +\Msg{* *} +\Msg{* *} +\Msg{****************************************************} + +\endbatchfile \ No newline at end of file diff --git a/macros/latex/contrib/colorwav/colorwav.pdf b/macros/latex/contrib/colorwav/colorwav.pdf new file mode 100644 index 0000000000..adbf4393f0 Binary files /dev/null and b/macros/latex/contrib/colorwav/colorwav.pdf differ -- cgit v1.2.3