% Hugo Gomes @ 15/04/2016 (v1.0)
% Hugo Gomes @ 15/03/2021 (v2.0.0)
% Hugo Gomes @ 12/05/2021 (v2.1.0)
% Hugo Gomes @ 27/06/2021 (v2.1.1)
% Hugo Gomes @ 03/07/2021 (v2.1.2)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}%
\ProvidesPackage{pgf-spectra}[03/07/2021 pgf-spectra v2.1.2]%
\RequirePackage{tikz}%
\DeclareOption{LSE}{\input{spectra.data.LSE.tex}}%
\DeclareOption{NIST}{\input{spectra.data.NIST.tex}}%
\ExecuteOptions{NIST}%
\ProcessOptions\relax%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\definecolor{wlIRcolor}{rgb}{.3157,.2373,.2373}% NEW v2.0.0
\definecolor{wlUVcolor}{rgb}{.3,.2568,.3}% NEW v2.0.0
%
\newcount\wl@counta% tmp counter
\newcount\wl@countb% tmp counter
\newcount\wl@countc% tmp counter
\newcount\wl@countd% tmp counter
%
\newif\ifwl@absorption%
\newif\ifcur@elem@exist%
\newif\ifwl@drawaxis%
\newif\ifwl@axislabel%
\newif\ifwl@intensity%
\newif\ifwl@redshift% NEW v2.0.0
\newif\ifwl@RSvalue% NEW v2.0.0
\newif\ifwl@usevisibleshade% NEW v2.1.0
% defining PGF keys
\pgfkeys{/wl/.cd,%
element/.get=\wl@element,%
element/.store in=\wl@element,%
element/.default=NONE,%
width/.get=\wl@width,%
width/.store in=\wl@width,%
width/.default={0.9\textwidth},%
height/.get=\wl@height,%
height/.store in=\wl@height,%
height/.default=1cm,%
back/.get=\wl@back,%
back/.store in=\wl@back,%
back/.default=black,%
backIRUV/.get=\wl@backnotvisible,% NEW v2.0.0
backIRUV/.store in=\wl@backnotvisible,% NEW v2.0.0
backIRUV/.default=black,% NEW v2.0.0
backVIS/.get=\wl@backvisible,% NEW v2.1.0
backVIS/.store in=\wl@backvisible,% NEW v2.1.0
backVIS/.default=black,% NEW v2.1.0
IRcolor/.get=\wl@IRcolor,% NEW v2.0.0
IRcolor/.store in=\wl@IRcolor,% NEW v2.0.0
IRcolor/.default=wlIRcolor,% NEW v2.0.0
UVcolor/.get=\wl@UVcolor,% NEW v2.0.0
UVcolor/.store in=\wl@UVcolor,% NEW v2.0.0
UVcolor/.default=wlUVcolor,% NEW v2.0.0
charge/.get=\wl@charge,%
charge/.store in=\wl@charge,%
charge/.default=0,%
Imin/.get=\wl@intmin,%
Imin/.store in=\wl@intmin,%
Imin/.default=0,%
lines/.get=\wl@lines,%
lines/.store in=\wl@lines,%
lines/.default={},%
line width/.get=\wl@linewidth,%
line width/.store in=\wl@linewidth,%
line width/.default=1pt,%
begin/.get=\wl@begin,%
begin/.store in=\wl@begin,%
begin/.default=380,%
end/.get=\wl@end,%
end/.store in=\wl@end,%
end/.default=780,%
axis step/.get=\wl@axisstep,%
axis step/.store in=\wl@axisstep,%
axis step/.default=20,%
axis unit/.get=\wl@axisunit,% NEW v2.1.0
axis unit/.store in=\wl@axisunit,% NEW v2.1.0
axis unit/.default=nm,% NEW v2.1.0
axis unit precision/.get=\wl@axisunitprecision,% NEW v2.1.0
axis unit precision/.store in=\wl@axisunitprecision,% NEW v2.1.0
axis unit precision/.default=3,% NEW v2.1.0
axis ticks/.get=\wl@axisticks,% NEW v2.0.0
axis ticks/.store in=\wl@axisticks,% NEW v2.0.0
axis ticks/.default=0,% NEW v2.0.0
axis color/.get=\wl@axiscolor,%
axis color/.store in=\wl@axiscolor,%
axis color/.default=black,%
axis font/.get=\wl@axisfont,%
axis font/.store in=\wl@axisfont,%
axis font/.default={\tiny},%
axis font color/.get=\wl@axisfontcolor,%
axis font color/.store in=\wl@axisfontcolor,%
axis font color/.default=white,%
label position/.get=\wl@labelposition,%
label position/.store in=\wl@labelposition,%
label position/.default={west},%
label before text/.get=\wl@labelbtext,%
label before text/.store in=\wl@labelbtext,%
label before text/.default={},%
label after text/.get=\wl@labelatext,%
label after text/.store in=\wl@labelatext,%
label after text/.default={},%
label font/.get=\wl@labelfont,%
label font/.store in=\wl@labelfont,%
label font/.default={\bfseries\small},%
label font color/.get=\wl@labelfontcolor,%
label font color/.store in=\wl@labelfontcolor,%
label font color/.default=black,%
gamma/.get=\wl@gamma,%
gamma/.store in=\wl@gamma,%
gamma/.default=0.8,%
brightness/.get=\wl@brightness,%
brightness/.store in=\wl@brightness,%
brightness/.default=1,%
line intensity/.get=\wl@lineint,%
line intensity/.store in=\wl@lineint,%
line intensity/.default=100,%
relative intensity threshold/.get=\wl@relintthresh,%
relative intensity threshold/.store in=\wl@relintthresh,%
relative intensity threshold/.default=0.25,%
absorption/.is if=wl@absorption,%
axis/.is if=wl@drawaxis,%
label/.is if=wl@axislabel,%
relative intensity/.is if=wl@intensity,%
redshift/.get=\wl@redshift,% NEW v2.0.0
redshift/.store in=\wl@redshift,% NEW v2.0.0
redshift/.default={},% NEW v2.0.0
show redshift value/.is if=wl@RSvalue,% NEW v2.0.0
use visible shading/.is if=wl@usevisibleshade% NEW v2.1.0
}%
% setting keys with default values
\pgfkeys{/wl/.cd,element,width,height,back,backIRUV,IRcolor,UVcolor,charge,Imin,lines,line width,begin,end,% NEW v2.0.0 -> backIRUV,IRcolor,UVcolor
axis color,axis font,axis font color,axis step,axis unit,axis unit precision,axis ticks,label position,label before text,label after text,label font,label font color,gamma,brightness,line intensity,% NEW v2.1.0 -> axis unit,axis unit precision
relative intensity threshold,absorption=false,axis=false,label=false,relative intensity=false,redshift,show redshift value=false,% NEW v2.0.0 -> redshift, show redshift value
use visible shading,backVIS}% NEW v2.1.0 -> use visible shading
% strings for \ifx tests
\def\wlN@NE{NONE}%
\def\wl@ll{all}%
\def\wl@visible{visible}%
\def\wl@visible@list{visible,visible5,visible10,visible15,visible20,visible25,visible30,visible35,visible40,visible45,visible50,visible55,visible60,visible65,visible70,visible75,visible80,visible85,visible90,visible95,visible100}%
\def\wl@label@position@list{west,north west,north,north east,east,south east,south,south west}%
\def\wl@redshift@D{D}% NEW v2.0.0
\def\wl@axisunit@nm{nm}% NEW v2.1.0
\def\wl@axisunit@um{micron}% NEW v2.1.0
\def\wl@axisunit@A{A}% NEW v2.1.0
%%%% COMMANDS -------------------------------------------------------------------------------->
% commands ##################################################
\newif\ifpgfspectra@StyleIsDef\pgfspectra@StyleIsDeffalse% NEW v2.0.0
% \pgfspectraStyle[options]% NEW v2.0.0
\def\pgfspectraStyle[#1]{\pgfspectraStyleReset\pgfspectra@StyleIsDeftrue\relax\tikzset{/wl/.cd,#1}%
\def\pgfspectra@DoStyle{\tikzset{/wl/.cd,#1}}% applies storing user style for future use
}% NEW v2.0.0
% \pgfspectraStyleReset% NEW v2.0.0
\def\pgfspectraStyleReset{\pgfspectra@StyleIsDeffalse\tikzset{/wl/.cd,%
element=NONE,width=0.9\textwidth,height=1cm,back=black,backIRUV=black,IRcolor=wlIRcolor,UVcolor=wlUVcolor,%
charge=0,Imin=0,lines={},line width=1pt,begin=380,end=780,axis color=black,axis font=\tiny,axis font color=white,axis step=20,axis unit=nm,axis unit precision=3,axis ticks=0,label position=west,% NEW v2.1.0 -> axis unit,axis unit precision
label before text={},label after text={},label font=\bfseries\small,label font color=black,gamma=0.8,brightness=1,line intensity=100,%
relative intensity threshold=0.25,absorption=false,axis=false,label=false,relative intensity=false,redshift={},show redshift value=false,% NEW v2.0.0 -> redshift, show redshift value
use visible shading,backVIS=black}}% NEW v2.1.0 -> use visible shading
% --------------- The main command to draw the spectra -----------------------------------------
% \pgfspectra[options]
\def\pgfspectra{\@ifnextchar[\wl@pgfspectra@withoptions{\wl@pgfspectra@nooptions}}%
\def\wl@pgfspectra@nooptions{\wl@pgfspectra@continuous(0.9\textwidth,1cm)}%
% ##########################################################
\def\wl@pgfspectra@continuous(#1,#2){\ignorespaces%
\ifwl@usevisibleshade% NEW v2.1.0
\pgfspectrashade(380,780){wl@visibleshade}%
\tikz{\fill[shading=wl@visibleshade] (0,0) rectangle (#1,#2);}%
\else%
\begin{tikzpicture}%
\pgfmathparse{#1/400}\edef\xscale{\pgfmathresult}
\pgfmathparse{1.4*\xscale+.09*\linewidth/\wl@width}\edef\wl@linewidth{\pgfmathresult}% NEW v2.0.0 {\xscale} -> {1.4*\xscale+.09*\linewidth/\wl@width}
\foreach \x in {380,...,780}%
        {%
        \wlcolor{\x}%
        \pgfmathparse{(\x-380)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
        \draw[wl@temp,line width=\wl@linewidth] (\wl@currentx,0) -- ++(0,#2);%
        }%
\end{tikzpicture}%
\fi%
}%
% ##########################################################
\def\wl@pgfspectra@withoptions[#1]{\ignorespaces%
% setting default values or user style
\ifpgfspectra@StyleIsDef\pgfspectraStyleReset\pgfspectra@DoStyle\pgfspectra@StyleIsDeftrue\relax\else\pgfspectraStyleReset\relax\fi% NEW v2.0.0
% process options (key values)
\pgfkeys{/wl/.cd,#1}%
% axis height
\setbox0=\hbox{\wl@axisfont\selectfont380}\edef\@wl@axis@height{\the\ht0}%
% process visible background (visible+opacity)
\wl@counta=0%
\wl@countb=-1%
\@for\@myarg:=\wl@visible@list\do{%
            \ifx\wl@back\@myarg\wl@countb=\wl@counta\fi%
            \advance\wl@counta by1%
            }%
\ifnum\wl@countb=-1\edef\@visible@opacity{1}\else% NEW v2.0.0
\ifnum\wl@countb=0\let\wl@back\wl@visible\edef\@visible@opacity{.5}\else%
\ifnum\wl@countb>0\let\wl@back\wl@visible\pgfmathparse{.05*\wl@countb}\edef\@visible@opacity{\pgfmathresult}\fi\fi\fi%
% ----------------------------------------------------------------------------------------------------------
% check limits... % NEW v2.0.0
\ifnum\wl@end<10\relax\def\wldez{10}\let\wl@end\wldez\fi%
\ifnum\wl@end>4000\relax\def\wlquatromil{4000}\let\wl@end\wlquatromil\fi%
\ifnum\wl@begin<10\relax\def\wldez{10}\let\wl@begin\wldez\fi%
\ifnum\wl@begin>4000\relax\def\wlquatromil{4000}\let\wl@begin\wlquatromil\fi%
% ----------------------------------------------------------------------------------------------------------
% verifying redshift key
\ifx\wl@redshift\@empty\relax%
\wl@redshiftfalse%
\else%
\wl@processredshiftkey\wl@redshift\relax%
\fi%
% ----------------------------------------------------------------------------------------------------------
% if no element provided draws continuous spectrum with options or user list of lines
\ifx\wl@element\wlN@NE%no element by the user
    \ifx\wl@elt@chemsym\undefined\else\let\wl@elt@chemsym\undefined\fi%
    \ifx\wl@lines\@empty%no lines by the user => continuous spectrum
    % draws the continuous spectrum width options (default or by the user)
    \begin{tikzpicture}%
        \pgfkeys{/wl/.cd,#1}% NEW v2.0.0
        \pgfmathparse{\wl@width/(abs(\wl@end-\wl@begin))}\edef\xscale{\pgfmathresult}%
        \ifwl@drawaxis%draws the axis
        \wl@utils@draw@axis%
        \fi%\ifwl@drawaxis
        \ifwl@axislabel%put the label
        \wl@utils@put@label%
        \fi%\ifwl@axislabel
        \let\wl@back\wl@visible%
        \let\wl@background@UVcolor\wl@backnotvisible\let\wl@background@IRcolor\wl@backnotvisible\relax%
        \wl@utils@drawbackground{\@visible@opacity*\wl@brightness}%
    \end{tikzpicture}%
    \let\wl@list@@\@empty%
    \else% lines by the user
    \edef\wl@list@@{\wl@lines}%
    \let\wl@background@UVcolor\wl@backnotvisible\let\wl@background@IRcolor\wl@backnotvisible\relax%
    \fi%\wl@lines\@empty
\else%\wl@element\wlN@NE
    % else get element(s) data
    \wl@countc=0%
    \wl@countd=1%
    \@for\@myarg:=\wl@element\do{\advance\wl@countc by1}%count number of elements
    \wl@addt@list{}{}%
    \@for\@myarg:=\wl@element\do{%
            \cur@elem@existtrue%
            \def\wl@elt@chemsym{NOT FOUND!}%
            \def\@search@result@err{NOT FOUND!}%
            \wl@elt@data{\@myarg}\relax%
            % check if element provided exists
            \ifx\@search@result@err\wl@elt@chemsym Element\ ``\@myarg'' with charge ``\wl@charge'' not found!\cur@elem@existfalse\else%
            % if exists, set the wavelength's list
            \wl@set@element@list{\wl@elt@elemdata}{\wl@elt@Imax}%
            \fi%\@search@result@err\wl@elt@chemsym
            \ifcur@elem@exist\ifnum\wl@countd<\wl@countc\wl@addt@list{\wl@list@@}{,}\fi\fi%
            \advance\wl@countd by1%
            }%end do
\fi%\wl@element\wlN@NE
% check if there are lines to draw and make the spectrum
    \ifx\wl@list@@\@empty\ifx\wl@element\wlN@NE\else Element\ ``\wl@element'' with charge ``\wl@charge'' have no lines to display.\fi\else%
        \ifwl@absorption%absortion spectrum
        \begin{tikzpicture}%
                \pgfkeys{/wl/.cd,#1}% NEW v2.0.0
                \pgfmathparse{\wl@width/(abs(\wl@end-\wl@begin))}\edef\xscale{\pgfmathresult}%
                \ifwl@drawaxis%draws the axis
                \wl@utils@draw@axis%
                \fi%\ifwl@drawaxis
                \ifwl@axislabel%put the label
                \wl@utils@put@label%
                \fi%\ifwl@axislabel
                \let\wl@back\wl@visible%
                \let\wl@background@UVcolor\wl@UVcolor\let\wl@background@IRcolor\wl@IRcolor\relax%
                \wl@utils@drawbackground{\wl@brightness}%
                % draws the lines
                \wl@utils@drawabsorptionlines%
        \end{tikzpicture}%
        \else%emission spectrum
        % draws the spectrum
        \ifx\wl@back\wl@visible%visible background
        \begin{tikzpicture}%
                \pgfkeys{/wl/.cd,#1}% NEW v2.0.0
                \pgfmathparse{\wl@width/(abs(\wl@end-\wl@begin))}\edef\xscale{\pgfmathresult}%
                \ifwl@drawaxis%draws the axis
                \wl@utils@draw@axis%
                \fi%\ifwl@drawaxis
                \ifwl@axislabel%put the label
                \wl@utils@put@label%
                \fi%\ifwl@axislabel
                \let\wl@background@UVcolor\wl@backnotvisible\let\wl@background@IRcolor\wl@backnotvisible\relax%
                \wl@utils@drawbackground{\@visible@opacity*\wl@brightness}%
                \wl@utils@drawemissionlines% emission lines
        \end{tikzpicture}%
        \else%without visible background
        \begin{tikzpicture}%
                \pgfkeys{/wl/.cd,#1}% NEW v2.0.0
                \pgfmathparse{\wl@width/(abs(\wl@end-\wl@begin))}\edef\xscale{\pgfmathresult}%
                \ifwl@drawaxis%draws the axis
                \wl@utils@draw@axis%
                \fi%\ifwl@drawaxis
                \ifwl@axislabel%put the label
                \wl@utils@put@label%
                \fi%\ifwl@axislabel
                \let\wl@background@UVcolor\wl@backnotvisible\let\wl@background@IRcolor\wl@backnotvisible\relax%
                \wl@utils@drawbackground{0}% dummy argument
                \wl@utils@drawemissionlines% emission lines
        \end{tikzpicture}%
        \fi%\wl@back\@visible
        \fi%\ifwl@absorption
    \fi% \wl@list@@\@empty
}%
% ##########################################################
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% get individual line data from one element of the array data
\def\wl@get@line@info[#1 #2 #3]{%
\def\@currentline@wl{#1}% return
\def\@currentline@int{#2}% return
\def\@currentline@charge{#3}% return
}%
% ######################################################################
% ################### \wl@set@element@list ####################################
% ######################################################################
%
% \wl@set@element@list{\wl@elt@elemdata}{\wl@elt@Imax}
% RETURN: \wl@list@@ -> (wl1,wl2,...)
%           or if relative intensity true (between 0 and 1)
%                \wl@list@@ -> (wl1/int1,wl2/int2,...)
%
\newif\ifwl@first% for first ocurrence of Imin
\def\wl@set@element@list#1#2{\ignorespaces% \wl@elt@Imax
\wl@firsttrue%
\wl@counta=0%
\wl@countb=1%
\pgfmathparse{int(\wl@intmin*100)}\edef\@wl@intmin{\pgfmathresult}%intensity percentage
\ifnum\@wl@intmin=0% include all intensities
\ifx\wl@ll\wl@charge%ALL lines
\@for\@myarg:=#1\do{\advance\wl@counta by1}%count all entries
        \ifwl@intensity%
        \@for\@myarg:=#1%
        \do{%
        \expandafter\wl@get@line@info\@myarg%
        \pgfmathparse{\wl@relintthresh+(1-\wl@relintthresh)*\@currentline@int/#2}\edef\wl@intensity@to@list{\pgfmathresult}%
        \ifnum\wl@countb<\wl@counta\wl@addt@list{\wl@list@@}{\@currentline@wl/\wl@intensity@to@list,}\else%
        \wl@addt@list{\wl@list@@}{\@currentline@wl/\wl@intensity@to@list}\fi%
        \advance\wl@countb by1%
        }%END do
        \else%
        \@for\@myarg:=#1%
        \do{%
        \expandafter\wl@get@line@info\@myarg%
        \ifnum\wl@countb<\wl@counta\wl@addt@list{\wl@list@@}{\@currentline@wl,}\else%
        \wl@addt@list{\wl@list@@}{\@currentline@wl}\fi%
        \advance\wl@countb by1%
        }%END do
        \fi%
\else% lines for one specific charge
\@for\@myarg:=#1\do{\expandafter\wl@get@line@info\@myarg\ifx\@currentline@charge\wl@charge\advance\wl@counta by 1\fi}%count only if is the desired charge
        \ifwl@intensity%
        \@for\@myarg:=#1%
        \do{%
        \expandafter\wl@get@line@info\@myarg%
        \pgfmathparse{\wl@relintthresh+(1-\wl@relintthresh)*\@currentline@int/#2}\edef\wl@intensity@to@list{\pgfmathresult}%
        \ifx\@currentline@charge\wl@charge%add to list if is the desired charge
            \ifnum\wl@countb<\wl@counta\wl@addt@list{\wl@list@@}{\@currentline@wl/\wl@intensity@to@list,}\else%
            \wl@addt@list{\wl@list@@}{\@currentline@wl/\wl@intensity@to@list}\fi%
        \advance\wl@countb by 1%
        \fi%
        }%END do
        \else%
        \@for\@myarg:=#1%
        \do{%
        \expandafter\wl@get@line@info\@myarg%
        \ifx\@currentline@charge\wl@charge%add to list if is the desired charge
            \ifnum\wl@countb<\wl@counta\wl@addt@list{\wl@list@@}{\@currentline@wl,}\else%
            \wl@addt@list{\wl@list@@}{\@currentline@wl}\fi%
        \advance\wl@countb by 1%
        \fi%
        }%END do
        \fi%
\fi%
\else%\wl@intmin>0 & \wl@intmin<1
\ifnum\@wl@intmin>100\else%
\pgfmathparse{\wl@intmin*#2}\edef\wl@actual@int{\pgfmathresult}%
\ifx\wl@ll\wl@charge%ALL lines
\@for\@myarg:=#1\do{\advance\wl@counta by 1}%count all entries
        \ifwl@intensity%
        \@for\@myarg:=#1%
        \do{%
        \expandafter\wl@get@line@info\@myarg%
        \pgfmathparse{notless(\@currentline@int,\wl@actual@int)}\relax\edef\wl@int@result{\pgfmathresult}%
        \ifnum\wl@int@result=1%
            \pgfmathparse{\wl@relintthresh+(1-\wl@relintthresh)*\@currentline@int/#2}\edef\wl@intensity@to@list{\pgfmathresult}%
            \ifwl@first\wl@addt@list{\wl@list@@}{\@currentline@wl/\wl@intensity@to@list}\else%
            \wl@addt@list{\wl@list@@}{,\@currentline@wl/\wl@intensity@to@list}\fi%
            \ifwl@first\wl@firstfalse\fi%
        \fi%
        \advance\wl@countb by 1%
        }%END do
        \else%
        \@for\@myarg:=#1%
        \do{%
        \expandafter\wl@get@line@info\@myarg%
        \pgfmathparse{notless(\@currentline@int,\wl@actual@int)}\relax\edef\wl@int@result{\pgfmathresult}%
        \ifnum\wl@int@result=1%
            \ifwl@first\wl@addt@list{\wl@list@@}{\@currentline@wl}\else%
            \wl@addt@list{\wl@list@@}{,\@currentline@wl}\fi%
            \ifwl@first\wl@firstfalse\fi%
        \fi%
        \advance\wl@countb by 1%
        }%END do
        \fi%
\else% lines for one specific charge
\@for\@myarg:=#1\do{\expandafter\wl@get@line@info\@myarg\ifx\@currentline@charge\wl@charge\advance\wl@counta by 1\fi}%count only if is the desired charge
        \ifwl@intensity%
        \@for\@myarg:=#1%
        \do{%
        \expandafter\wl@get@line@info\@myarg%
        \ifx\@currentline@charge\wl@charge%add to list if is the desired charge
            \pgfmathparse{notless(\@currentline@int,\wl@actual@int)}\edef\wl@int@result{\pgfmathresult}%
            \ifnum\wl@int@result=1%
            \pgfmathparse{\wl@relintthresh+(1-\wl@relintthresh)*\@currentline@int/#2}\edef\wl@intensity@to@list{\pgfmathresult}%
            \ifwl@first\wl@addt@list{\wl@list@@}{\@currentline@wl/\wl@intensity@to@list}\else%
            \wl@addt@list{\wl@list@@}{,\@currentline@wl/\wl@intensity@to@list}\fi%
            \ifwl@first\wl@firstfalse\fi%
        \fi%
        \advance\wl@countb by 1%
        \fi%
        }%END do
        \else%
        \@for\@myarg:=#1%
        \do{%
        \expandafter\wl@get@line@info\@myarg%
        \ifx\@currentline@charge\wl@charge%add to list if is the desired charge
            \pgfmathparse{notless(\@currentline@int,\wl@actual@int)}\edef\wl@int@result{\pgfmathresult}%
            \ifnum\wl@int@result=1%
            \ifwl@first\wl@addt@list{\wl@list@@}{\@currentline@wl}\else%
            \wl@addt@list{\wl@list@@}{,\@currentline@wl}\fi%
            \ifwl@first\wl@firstfalse\fi%
        \fi%
        \advance\wl@countb by 1%
        \fi%
        }%END do
        \fi%
\fi%
\fi%
\fi%
}%
% add to list
\def\wl@addt@list#1#2{\edef\wl@list@@{#1#2}}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% internal utils
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\wl@utils@draw@axis{\ignorespaces%
                % axis unit -> NEW v2.1.0
                \pgfkeys{/pgf/number format/.cd,fixed,precision=\wl@axisunitprecision,set thousands separator={},assume math mode=true}
                \ifx\wl@axisunit\wl@axisunit@nm\relax%
                    \def\wl@axisunit@scale{1}\def\wl@axisunit@addzeros{}%
                \else\ifx\wl@axisunit\wl@axisunit@um\relax%
                    \def\wl@axisunit@scale{1000}\def\wl@axisunit@addzeros{}\pgfkeys{/pgf/number format/.cd,fixed zerofill}%
                \else\ifx\wl@axisunit\wl@axisunit@A\relax%
                    \def\wl@axisunit@scale{1}\def\wl@axisunit@addzeros{0}% probably not the best solution to overcome the TeX dimension limit values (16384pt)... but works!
                \fi\fi\fi%
                \ifnum\wl@begin>\wl@end%
                % New xshift={-2.5*\@wl@axis@height} to hold bigger numbers, e.g. 2500
                \draw[draw=none,fill=\wl@axiscolor] ([xshift={2.5*\@wl@axis@height}]0,\wl@height+2.5pt) rectangle ([xshift={-2.5*\@wl@axis@height}]-\wl@width,-2.5*\@wl@axis@height);%
                        % minor ticks -> NEW v2.0.0
                        \ifnum\wl@axisticks>0\relax%
                        \pgfmathparse{\wl@end+\wl@axisstep/(\wl@axisticks+1)}\pgfmathparse{int(\pgfmathresult)}%
                        \edef\@axis@list{\wl@end,\pgfmathresult,...,\wl@begin}%
                        \foreach \x in \@axis@list%
                        {%
                        \pgfmathparse{(\wl@end-\x)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                        \draw[\wl@axisfontcolor!80!transparent,line width=.25pt] (\wl@currentx,-.375*\@wl@axis@height) -- ++(0,.375*\@wl@axis@height);%
                        }%
                        \fi%
                \pgfmathparse{\wl@end+\wl@axisstep}\pgfmathparse{int(\pgfmathresult)}%
                \edef\@axis@list{\wl@end,\pgfmathresult,...,\wl@begin}%
                \foreach \x in \@axis@list%
                {%
                \pgfmathparse{(\wl@end-\x)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                \draw[\wl@axisfontcolor,line width=.25pt] (\wl@currentx,-.75*\@wl@axis@height) -- ++(0,.75*\@wl@axis@height);%
                \pgfmathparse{\x/\wl@axisunit@scale}\edef\wl@xscaledvalue{\pgfmathresult}% NEW v2.1.0
                \node[\wl@axisfontcolor,font=\wl@axisfont,above,inner sep=0pt] at (\wl@currentx,-2.25*\@wl@axis@height) {\pgfmathprintnumber{\wl@xscaledvalue}\wl@axisunit@addzeros};%
                }%
                \else%
                \draw[draw=none,fill=\wl@axiscolor] ([xshift={-2.5*\@wl@axis@height}]0,\wl@height+2.5pt) rectangle ([xshift={2.5*\@wl@axis@height}]\wl@width,-2.5*\@wl@axis@height);%
                        % minor ticks -> NEW v2.0.0
                        \ifnum\wl@axisticks>0\relax%
                        \pgfmathparse{\wl@begin+\wl@axisstep/(\wl@axisticks+1)}\pgfmathparse{int(\pgfmathresult)}%
                        \edef\@axis@list{\wl@begin,\pgfmathresult,...,\wl@end}%
                        \foreach \x in \@axis@list%
                        {%
                        \pgfmathparse{(\x-\wl@begin)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                        \draw[\wl@axisfontcolor!80!transparent,line width=.25pt] (\wl@currentx,-.375*\@wl@axis@height) -- ++(0,.375*\@wl@axis@height);%
                        }%
                        \fi%
                \pgfmathparse{\wl@begin+\wl@axisstep}\pgfmathparse{int(\pgfmathresult)}%
                \edef\@axis@list{\wl@begin,\pgfmathresult,...,\wl@end}%
                \foreach \x in \@axis@list%
                {%
                \pgfmathparse{(\x-\wl@begin)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                \draw[\wl@axisfontcolor,line width=.25pt] (\wl@currentx,-.75*\@wl@axis@height) -- ++(0,.75*\@wl@axis@height);%
                \pgfmathparse{\x/\wl@axisunit@scale}\edef\wl@xscaledvalue{\pgfmathresult}% NEW v2.1.0
                \node[\wl@axisfontcolor,font=\wl@axisfont,above,inner sep=0pt] at (\wl@currentx,-2.25*\@wl@axis@height) {\pgfmathprintnumber{\wl@xscaledvalue}\wl@axisunit@addzeros};%
                }%
                \fi%
}%
\def\wl@utils@put@label{\ignorespaces%
                \ifx\wl@elt@chemsym\undefined\def\wl@elt@chemsym{}\fi%
                \wl@get@label@position%
                \ifnum\wl@begin>\wl@end%
                        \ifcase\wl@label@position%
                        %west
                            \ifwl@drawaxis%\ifwl@axislabel%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,left,minimum width=2em,align=right] at (-2.5*\@wl@axis@height-\wl@width,0.5*\wl@height-1.25*\@wl@axis@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \else%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,left,minimum width=2em,align=right] at (-\wl@width,0.5*\wl@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \fi%
                        \or%north west
                            \ifwl@drawaxis%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,above right,inner xsep=0pt] at (-2.5*\@wl@axis@height-\wl@width,\wl@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \else%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,above right,inner xsep=0pt] at (-\wl@width,\wl@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \fi%
                        \or%north
                        \node[\wl@labelfontcolor,font=\wl@labelfont,above] at (-0.5*\wl@width,\wl@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                        \or%north east
                        \ifwl@drawaxis%
                        \node[\wl@labelfontcolor,font=\wl@labelfont,above left,inner xsep=0pt] at (2.5*\@wl@axis@height,\wl@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                        \else%
                        \node[\wl@labelfontcolor,font=\wl@labelfont,above left,inner xsep=0pt] at (0,\wl@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                        \fi
                        \or%east
                            \ifwl@drawaxis%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,right] at (2.5*\@wl@axis@height,0.5*\wl@height-1.25*\@wl@axis@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \else%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,right] at (0,0.5*\wl@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \fi%
                        \or%south east
                            \ifwl@drawaxis%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,below left,inner xsep=0pt] at (2.5*\@wl@axis@height,-2.5*\@wl@axis@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \else%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,below left,inner xsep=0pt] at (0,0) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \fi%
                        \or%south
                            \ifwl@drawaxis%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,below] at (-0.5*\wl@width,-2.5*\@wl@axis@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \else%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,below] at (-0.5*\wl@width,0) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \fi%
                        \or%south west
                            \ifwl@drawaxis%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,below right,inner xsep=0pt] at (-2.5*\@wl@axis@height-\wl@width,-2.5*\@wl@axis@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \else%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,below right,inner xsep=0pt] at (-\wl@width,0) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \fi%
                        \fi%
                \else%
                        \ifcase\wl@label@position%
                        %west
                            \ifwl@drawaxis%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,left,minimum width=2em,align=right] at (-2.5*\@wl@axis@height,0.5*\wl@height-1.25*\@wl@axis@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \else%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,left,minimum width=2em,align=right] at (0,0.5*\wl@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \fi%
                        \or%north west
                            \ifwl@drawaxis%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,above right,inner xsep=0pt] at (-2.5*\@wl@axis@height,\wl@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \else%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,above right,inner xsep=0pt] at (0,\wl@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \fi%
                        \or%north
                        \node[\wl@labelfontcolor,font=\wl@labelfont,above] at (0.5*\wl@width,\wl@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                        \or%north east
                        \ifwl@drawaxis%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,above left,inner xsep=0pt] at (\wl@width+2.5*\@wl@axis@height,\wl@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \else%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,above left,inner xsep=0pt] at (\wl@width,\wl@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \fi%
                        \or%east
                            \ifwl@drawaxis%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,right] at ([xshift={2.5*\@wl@axis@height}]\wl@width,0.5*\wl@height-1.25*\@wl@axis@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \else%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,right] at (\wl@width,0.5*\wl@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \fi%
                        \or%south east
                            \ifwl@drawaxis%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,below left,inner xsep=0pt] at (\wl@width+2.5*\@wl@axis@height,-2.5*\@wl@axis@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \else%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,below left,inner xsep=0pt] at (\wl@width,0) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \fi%
                        \or%south
                            \ifwl@drawaxis%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,below] at (0.5*\wl@width,-2.5*\@wl@axis@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \else%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,below] at (0.5*\wl@width,0) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \fi%
                        \or%south west
                            \ifwl@drawaxis%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,below right,inner xsep=0pt] at (-2.5*\@wl@axis@height,-2.5*\@wl@axis@height) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \else%
                            \node[\wl@labelfontcolor,font=\wl@labelfont,below right,inner xsep=0pt] at (0,0) {\wl@labelbtext\wl@elt@chemsym\wl@labelatext};%
                            \fi%
                        \fi%
                \fi%
}%
\def\wl@utils@drawbackground#1{\ignorespaces% NEW v2.0.0 - in this version draws from UV, VIS to IV -> replaces \wl@utils@visiblespectrum#1
% reprocess visible background (only visible) -> needed because of the override in keys
    \wl@counta=0%
    \wl@countb=-1%
    \@for\@myarg:=\wl@visible@list\do{%
            \ifx\wl@back\@myarg\wl@countb=\wl@counta\fi%
            \advance\wl@counta by1%
            }%
        \ifnum\wl@countb>-1\let\wl@back\wl@visible\fi%
            \ifwl@usevisibleshade\relax% NEW v2.1.0
                \pgfmathparse{int(#1*100)}\edef\wl@bright{\pgfmathresult}%
                \ifnum\wl@begin>\wl@end% 0
                    \ifnum\wl@end<380\relax% 1
                        \pgfmathparse{(\wl@end-380)*\xscale}\edef\wl@pointA{\pgfmathresult pt}%
                        \ifnum\wl@begin>780\relax% 2
                            \pgfmathparse{(\wl@end-780)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                            \draw[draw=none,fill=\wl@background@UVcolor] (0,0) rectangle (\wl@pointA,\wl@height);%
                            \draw[draw=none,fill=\wl@background@IRcolor] (\wl@pointB,0) rectangle (-\wl@width,\wl@height);%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \pgfspectrashade(380,780){wl@visibleshade}%
                                    \fill[shading=wl@visibleshade,shading angle=180] (\wl@pointA,0) rectangle (\wl@pointB,\wl@height);%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (\wl@pointA,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \else% 2
                            \pgfmathparse{(\wl@end-\wl@begin)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                            \draw[draw=none,fill=\wl@background@UVcolor] (0,0) rectangle (\wl@pointA,\wl@height);%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \pgfspectrashade(380,\wl@begin){wl@visibleshade}%
                                    \fill[shading=wl@visibleshade,shading angle=180] (\wl@pointA,0) rectangle (\wl@pointB,\wl@height);%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (\wl@pointA,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \fi% 2
                    \else% 1
                        \ifnum\wl@begin>780\relax% 2
                            \pgfmathparse{(\wl@end-780)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                            \draw[draw=none,fill=\wl@background@IRcolor] (\wl@pointB,0) rectangle (-\wl@width,\wl@height);%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \pgfspectrashade(\wl@end,780){wl@visibleshade}%
                                    \fill[shading=wl@visibleshade,shading angle=180] (0,0) rectangle (\wl@pointB,\wl@height);%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (0,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \else% 2
                            \pgfmathparse{(\wl@end-\wl@begin)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \pgfspectrashade(\wl@end,\wl@begin){wl@visibleshade}%
                                    \fill[shading=wl@visibleshade,shading angle=180] (0,0) rectangle (\wl@pointB,\wl@height);%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (0,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \fi% 2
                    \fi% 1
                \else% 0
                    \ifnum\wl@begin<380\relax% 1
                        \pgfmathparse{(380-\wl@begin)*\xscale}\edef\wl@pointA{\pgfmathresult pt}%
                        \ifnum\wl@end>780\relax% 2
                            \pgfmathparse{(780-\wl@begin)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                            \draw[draw=none,fill=\wl@background@UVcolor] (0,0) rectangle (\wl@pointA,\wl@height);%
                            \draw[draw=none,fill=\wl@background@IRcolor] (\wl@pointB,0) rectangle (\wl@width,\wl@height);%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \pgfspectrashade(380,780){wl@visibleshade}%
                                    \fill[shading=wl@visibleshade] (\wl@pointA,0) rectangle (\wl@pointB,\wl@height);%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (\wl@pointA,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \else% 2
                            \pgfmathparse{(\wl@end-\wl@begin)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                            \draw[draw=none,fill=\wl@background@UVcolor] (0,0) rectangle (\wl@pointA,\wl@height);%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \pgfspectrashade(380,\wl@end){wl@visibleshade}%
                                    \fill[shading=wl@visibleshade] (\wl@pointA,0) rectangle (\wl@pointB,\wl@height);%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (\wl@pointA,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \fi% 2
                    \else% 1
                        \ifnum\wl@end>780\relax% 2
                            \pgfmathparse{(780-\wl@begin)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                            \draw[draw=none,fill=\wl@background@IRcolor] (\wl@pointB,0) rectangle (\wl@width,\wl@height);%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \pgfspectrashade(\wl@begin,780){wl@visibleshade}%
                                    \fill[shading=wl@visibleshade] (0,0) rectangle (\wl@pointB,\wl@height);%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (0,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \else% 2
                            \pgfmathparse{(\wl@end-\wl@begin)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \pgfspectrashade(\wl@begin,\wl@end){wl@visibleshade}%
                                    \fill[shading=wl@visibleshade] (0,0) rectangle (\wl@pointB,\wl@height);%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (0,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \fi% 2
                    \fi% 1
                \fi%0
            \else% wl@usevisibleshade (don't use shading, draw line by line...)
                \pgfmathparse{int(#1*100)}\edef\wl@bright{\pgfmathresult}%
                \pgfmathparse{1.4*\xscale+.09*\linewidth/\wl@width}\edef\@wl@linewidth{\pgfmathresult}% NEW v2.0.0 {\xscale} -> {1.4*\xscale+.09*\linewidth/\wl@width}
                \ifnum\wl@begin>\wl@end% 0
                    \ifnum\wl@end<380\relax% 1
                        \pgfmathparse{(\wl@end-380)*\xscale}\edef\wl@pointA{\pgfmathresult pt}%
                        \ifnum\wl@begin>780\relax% 2
                            \pgfmathparse{(\wl@end-780)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                            \draw[draw=none,fill=\wl@background@UVcolor] (0,0) rectangle (\wl@pointA,\wl@height);%
                            \draw[draw=none,fill=\wl@background@IRcolor] (\wl@pointB,0) rectangle (-\wl@width,\wl@height);%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \foreach \x in {780,...,380}{%
                                    \wlcolor{\x}%
                                    \colorlet{wlcolor}{wl@temp!\wl@bright!\wl@backvisible}% CHANGED v2.1.0
                                    \pgfmathparse{\wl@pointB+(780-\x)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                                    \draw[wlcolor,line width=\@wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);}%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (\wl@pointA,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \else% 2
                            \pgfmathparse{(\wl@end-\wl@begin)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                            \draw[draw=none,fill=\wl@background@UVcolor] (0,0) rectangle (\wl@pointA,\wl@height);%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \foreach \x in {\wl@begin,...,380}{%
                                    \wlcolor{\x}%
                                    \colorlet{wlcolor}{wl@temp!\wl@bright!\wl@backvisible}% CHANGED v2.1.0
                                    \pgfmathparse{\wl@pointB+(\wl@begin-\x)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                                    \draw[wlcolor,line width=\@wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);}%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (\wl@pointA,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \fi% 2
                    \else% 1
                        \ifnum\wl@begin>780\relax% 2
                            \pgfmathparse{(\wl@end-780)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                            \draw[draw=none,fill=\wl@background@IRcolor] (\wl@pointB,0) rectangle (-\wl@width,\wl@height);%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \foreach \x in {780,...,\wl@end}{%
                                    \wlcolor{\x}%
                                    \colorlet{wlcolor}{wl@temp!\wl@bright!\wl@backvisible}% CHANGED v2.1.0
                                    \pgfmathparse{\wl@pointB+(780-\x)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                                    \draw[wlcolor,line width=\@wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);}%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (0,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \else% 2
                            \pgfmathparse{(\wl@end-\wl@begin)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \foreach \x in {\wl@begin,...,\wl@end}{%
                                    \wlcolor{\x}%
                                    \colorlet{wlcolor}{wl@temp!\wl@bright!\wl@backvisible}% CHANGED v2.1.0
                                    \pgfmathparse{\wl@pointB+(\wl@begin-\x)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                                    \draw[wlcolor,line width=\@wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);}%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (0,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \fi% 2
                    \fi% 1
                \else% 0
                    \ifnum\wl@begin<380\relax% 1
                        \pgfmathparse{(380-\wl@begin)*\xscale}\edef\wl@pointA{\pgfmathresult pt}%
                        \ifnum\wl@end>780\relax% 2
                            \pgfmathparse{(780-\wl@begin)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                            \draw[draw=none,fill=\wl@background@UVcolor] (0,0) rectangle (\wl@pointA,\wl@height);%
                            \draw[draw=none,fill=\wl@background@IRcolor] (\wl@pointB,0) rectangle (\wl@width,\wl@height);%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \foreach \x in {380,...,780}{%
                                    \wlcolor{\x}%
                                    \colorlet{wlcolor}{wl@temp!\wl@bright!\wl@backvisible}% CHANGED v2.1.0
                                    \pgfmathparse{\wl@pointB-(780-\x)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                                    \draw[wlcolor,line width=\@wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);}%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (\wl@pointA,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \else% 2
                            \pgfmathparse{(\wl@end-\wl@begin)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                            \draw[draw=none,fill=\wl@background@UVcolor] (0,0) rectangle (\wl@pointA,\wl@height);%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \foreach \x in {\wl@end,...,380}{%
                                    \wlcolor{\x}%
                                    \colorlet{wlcolor}{wl@temp!\wl@bright!\wl@backvisible}% CHANGED v2.1.0
                                    \pgfmathparse{\wl@pointB-(\wl@end-\x)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                                    \draw[wlcolor,line width=\@wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);}%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (\wl@pointA,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \fi% 2
                    \else% 1
                        \ifnum\wl@end>780\relax% 2
                            \pgfmathparse{(780-\wl@begin)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                            \draw[draw=none,fill=\wl@background@IRcolor] (\wl@pointB,0) rectangle (\wl@width,\wl@height);%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \foreach \x in {\wl@begin,...,780}{%
                                    \wlcolor{\x}%
                                    \colorlet{wlcolor}{wl@temp!\wl@bright!\wl@backvisible}% CHANGED v2.1.0
                                    \pgfmathparse{(\x-\wl@begin)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                                    \draw[wlcolor,line width=\@wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);}%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (0,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \else% 2
                            \pgfmathparse{(\wl@end-\wl@begin)*\xscale}\edef\wl@pointB{\pgfmathresult pt}%
                                \ifx\wl@back\wl@visible% 3 visible background
                                    \foreach \x in {\wl@begin,...,\wl@end}{%
                                    \wlcolor{\x}%
                                    \colorlet{wlcolor}{wl@temp!\wl@bright!\wl@backvisible}% CHANGED v2.1.0
                                    \pgfmathparse{\x-\wl@begin)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                                    \draw[wlcolor,line width=\@wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);}%
                                \else% 3
                                    \draw[draw=none,fill=\wl@back] (0,0) rectangle (\wl@pointB,\wl@height);%
                                \fi% 3
                        \fi% 2
                    \fi% 1
                \fi%0
            \fi% wl@usevisibleshade
}%
\def\wl@utils@drawabsorptionlines{\ignorespaces%
                \ifnum\wl@begin>\wl@end%
                    \ifwl@intensity%
                        \ifwl@redshift\wl@utils@redshift\fi% NEW v2.0.0
                        \foreach \x/\y in \wl@list@@%
                        {%
                        \pgfmathparse{notless(\x,\wl@end)}\edef\wl@x@nl{\pgfmathresult}%
                        \pgfmathparse{notgreater(\x,\wl@begin)}\edef\wl@x@ng{\pgfmathresult}%
                        \pgfmathparse{and(\wl@x@nl,\wl@x@ng)}\edef\wl@plot@point{\pgfmathresult}%
                        \ifnum\wl@plot@point=1%
                        \pgfmathparse{(\wl@end-\x)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                        \pgfmathparse{int(\y*100)}\edef\wl@black{\pgfmathresult}%
                        \wlcolor{\x}%
                        \colorlet{wlcolor}{black!\wl@black!wl@temp}%
                        \draw[wlcolor,line width=\wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);%
                        \fi%
                        }%
                    \else%
                        \ifwl@redshift\wl@utils@redshift\fi% NEW v2.0.0
                        \foreach \x in \wl@list@@%
                        {%
                        \pgfmathparse{notless(\x,\wl@end)}\edef\wl@x@nl{\pgfmathresult}%
                        \pgfmathparse{notgreater(\x,\wl@begin)}\edef\wl@x@ng{\pgfmathresult}%
                        \pgfmathparse{and(\wl@x@nl,\wl@x@ng)}\edef\wl@plot@point{\pgfmathresult}%
                        \ifnum\wl@plot@point=1%
                        \pgfmathparse{(\wl@end-\x)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                        \wlcolor{\x}%
                        \colorlet{wlcolor}{black!\wl@lineint!wl@temp}%
                        \draw[wlcolor,line width=\wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);%
                        \fi%
                        }%
                    \fi%
                \else%
                    \ifwl@intensity%
                        \ifwl@redshift\wl@utils@redshift\fi% NEW v2.0.0
                        \foreach \x/\y in \wl@list@@%
                        {%
                        \pgfmathparse{notless(\x,\wl@begin)}\edef\wl@x@nl{\pgfmathresult}%
                        \pgfmathparse{notgreater(\x,\wl@end)}\edef\wl@x@ng{\pgfmathresult}%
                        \pgfmathparse{and(\wl@x@nl,\wl@x@ng)}\edef\wl@plot@point{\pgfmathresult}%
                        \ifnum\wl@plot@point=1%
                        \pgfmathparse{(\x-\wl@begin)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                        \pgfmathparse{int(\y*100)}\edef\wl@black{\pgfmathresult}%
                        \wlcolor{\x}%
                        \colorlet{wlcolor}{black!\wl@black!wl@temp}%
                        \draw[wlcolor,line width=\wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);%
                        \fi%
                        }%
                    \else%
                        \ifwl@redshift\wl@utils@redshift\fi% NEW v2.0.0
                        \foreach \x in \wl@list@@%
                        {%
                        \pgfmathparse{notless(\x,\wl@begin)}\edef\wl@x@nl{\pgfmathresult}%
                        \pgfmathparse{notgreater(\x,\wl@end)}\edef\wl@x@ng{\pgfmathresult}%
                        \pgfmathparse{and(\wl@x@nl,\wl@x@ng)}\edef\wl@plot@point{\pgfmathresult}%
                        \ifnum\wl@plot@point=1%
                        \pgfmathparse{(\x-\wl@begin)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                        \wlcolor{\x}%
                        \colorlet{wlcolor}{black!\wl@lineint!wl@temp}%
                        \draw[wlcolor,line width=\wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);%
                        \fi%
                        }%
                    \fi%
                \fi%
\ifwl@RSvalue% NEW v2.0.0
\ifnum\wl@begin>\wl@end%
\ifwl@drawaxis\pgfmathparse{-\wl@width-2.5*\@wl@axis@height}\edef\wl@redshiftinfo@x{\pgfmathresult pt}%
\else\pgfmathparse{-\wl@width}\edef\wl@redshiftinfo@x{\pgfmathresult pt}\fi%
\else%
\ifwl@drawaxis\pgfmathparse{-2.5*\@wl@axis@height}\edef\wl@redshiftinfo@x{\pgfmathresult pt}%
\else\edef\wl@redshiftinfo@x{0pt}\fi%
\fi%
\ifwl@drawaxis\pgfmathparse{-.75*\@wl@axis@height-1.3*\ht0-2pt}\edef\wl@redshiftinfo@y{\pgfmathresult pt}\else\edef\wl@redshiftinfo@y{0pt}\fi%
\node[below right,inner xsep=0pt,font=\wl@axisfont] at (\wl@redshiftinfo@x,\wl@redshiftinfo@y) {\wl@redshiftinfo};%
\fi% NEW v2.0.0
}%
\def\wl@utils@drawemissionlines{\ignorespaces%
                \ifnum\wl@begin>\wl@end%
                \ifwl@intensity%
                    \ifwl@redshift\wl@utils@redshift\fi% NEW v2.0.0
                        \foreach \x/\y in \wl@list@@%
                        {%
                        \wlcolor{\x}%
                        \pgfmathparse{notless(\x,\wl@end)}\edef\wl@x@nl{\pgfmathresult}%
                        \pgfmathparse{notgreater(\x,\wl@begin)}\edef\wl@x@ng{\pgfmathresult}%
                        \pgfmathparse{and(\wl@x@nl,\wl@x@ng)}\edef\wl@plot@point{\pgfmathresult}%
                        \ifnum\wl@plot@point=1%
                        \pgfmathparse{(\wl@end-\x)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                        \pgfmathparse{int(\y*100)}\edef\wl@black{\pgfmathresult}%
                        \colorlet{wlcolor}{wl@temp!\wl@black!black}%
                        \draw[wlcolor,line width=\wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);%
                        \fi%
                        }%
                \else%
                    \ifwl@redshift\wl@utils@redshift\fi% NEW v2.0.0
                        \foreach \x in \wl@list@@%
                        {%
                        \wlcolor{\x}%
                        \pgfmathparse{notless(\x,\wl@end)}\edef\wl@x@nl{\pgfmathresult}%
                        \pgfmathparse{notgreater(\x,\wl@begin)}\edef\wl@x@ng{\pgfmathresult}%
                        \pgfmathparse{and(\wl@x@nl,\wl@x@ng)}\edef\wl@plot@point{\pgfmathresult}%
                        \ifnum\wl@plot@point=1%
                        \pgfmathparse{(\wl@end-\x)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                        \colorlet{wlcolor}{wl@temp!\wl@lineint!black}%
                        \draw[wlcolor,line width=\wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);%
                        \fi%
                        }%
                \fi%
                \else%
                \ifwl@intensity%
                    \ifwl@redshift\wl@utils@redshift\fi% NEW v2.0.0
                        \foreach \x/\y in \wl@list@@%
                        {%
                        \wlcolor{\x}%
                        \pgfmathparse{notless(\x,\wl@begin)}\edef\wl@x@nl{\pgfmathresult}%
                        \pgfmathparse{notgreater(\x,\wl@end)}\edef\wl@x@ng{\pgfmathresult}%
                        \pgfmathparse{and(\wl@x@nl,\wl@x@ng)}\edef\wl@plot@point{\pgfmathresult}%
                        \ifnum\wl@plot@point=1%
                        \pgfmathparse{(\x-\wl@begin)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                        \pgfmathparse{int(\y*100)}\edef\wl@black{\pgfmathresult}%
                        \colorlet{wlcolor}{wl@temp!\wl@black!black}%
                        \draw[wlcolor,line width=\wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);%
                        \fi%
                        }%
                \else%
                    \ifwl@redshift\wl@utils@redshift\fi% NEW v2.0.0
                        \foreach \x in \wl@list@@%
                        {%
                        \wlcolor{\x}%
                        \pgfmathparse{notless(\x,\wl@begin)}\edef\wl@x@nl{\pgfmathresult}%
                        \pgfmathparse{notgreater(\x,\wl@end)}\edef\wl@x@ng{\pgfmathresult}%
                        \pgfmathparse{and(\wl@x@nl,\wl@x@ng)}\edef\wl@plot@point{\pgfmathresult}%
                        \ifnum\wl@plot@point=1%
                        \pgfmathparse{(\x-\wl@begin)*\xscale}\edef\wl@currentx{\pgfmathresult pt}%
                        \colorlet{wlcolor}{wl@temp!\wl@lineint!black}%
                        \draw[wlcolor,line width=\wl@linewidth] (\wl@currentx,0) -- ++(0,\wl@height);%
                        \fi%
                        }%
                \fi%
                \fi%
\ifwl@RSvalue% NEW v2.0.0
\ifnum\wl@begin>\wl@end%
\ifwl@drawaxis\pgfmathparse{-\wl@width-2.5*\@wl@axis@height}\edef\wl@redshiftinfo@x{\pgfmathresult pt}%
\else\pgfmathparse{-\wl@width}\edef\wl@redshiftinfo@x{\pgfmathresult pt}\fi%
\else%
\ifwl@drawaxis\pgfmathparse{-2.5*\@wl@axis@height}\edef\wl@redshiftinfo@x{\pgfmathresult pt}%
\else\edef\wl@redshiftinfo@x{0pt}\fi%
\fi%
\ifwl@drawaxis\pgfmathparse{-.75*\@wl@axis@height-1.3*\ht0-2pt}\edef\wl@redshiftinfo@y{\pgfmathresult pt}\else\edef\wl@redshiftinfo@y{0pt}\fi%
\node[below right,inner xsep=0pt,font=\wl@axisfont] at (\wl@redshiftinfo@x,\wl@redshiftinfo@y) {\wl@redshiftinfo};%
\fi% NEW v2.0.0
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% return: integer with position (e.g. '0' for west, ... )
\def\wl@get@label@position{\ignorespaces%
\wl@countc=0%
\@for\@mylabel:=\wl@label@position@list%
            \do{%
            \ifx\@mylabel\wl@labelposition\edef\wl@label@position{\the\wl@countc}\fi%
            \advance\wl@countc by1%
            }%
}%
% NEW v2.0.0 ----------------------
% redshift: lambda(obs)=lambda(emit)*{(1+v/c*cos(theta))/sqrt(1-v^2/c^2)} ---> Relativistic Doppler
% vbar-> v/c -> normalized velocity of the source (e.g. '0.9' for v=0.9c )
% theta ->angle between the direction of relative motion of the source and the direction of emission in the observer's frame (zero angle is directly away from the observer)
\def\wl@processredshiftkey#1{\ignorespaces%
\wl@redshiftfalse%
\edef\wl@redshiftkey@expand{#1}% to expand a value passed by a macro (not necessary if the user provided a number...)
\expandafter\wl@redshiftkey@firstchar\wl@redshiftkey@expand\relax%
\ifcat1\wl@@RedShift\relax%
\pgfmathparse{1+#1}\relax%
\edef\wl@UMMAISZ{\pgfmathresult}\wl@redshifttrue%
\edef\wl@redshiftinfo{redshift z=#1}%
\else%
\edef\wl@redshiftkey@expand{#1}%
\expandafter\wl@process@redshift\wl@redshiftkey@expand\relax%
\fi%
}%
\def\wl@redshiftkey@firstchar#1#2\relax{\edef\wl@@RedShift{#1}}%
\def\wl@process@redshift#1=#2/#3\relax{%
\edef\wl@redshifttest{#1}%
\ifx\wl@redshifttest\wl@redshift@D\relax%
\pgfmathparse{(1+#2*cos(#3))/sqrt(1-#2*#2)}%
\edef\wl@UMMAISZ{\pgfmathresult}\wl@redshifttrue%
\pgfmathparse{#2*cos(#3))/sqrt(1-#2*#2)}%
\edef\wl@redshiftinfo{Relativistic Doppler redshift z=\pgfmathresult\ (\mbox{v\hskip.1ex=\hskip.1ex#2\hskip.1exc\hskip.5ex;\hskip.5ex\ensuremath{\theta}\hskip.1ex=\hskip.1ex#3\ensuremath{^\circ}})}%
\fi%
}%
% \wl@utils@redshift ---------------------------------------------------------------------
% returns the wllist with the shift computed
\def\wl@utils@redshift{\ignorespaces%
    \let\wt@backlist@@\wl@list@@\relax%
    \let\wl@list@@\@empty\relax%
    \wl@firsttrue\relax%
    \ifwl@intensity% list (lambda/intensity)
        \foreach \x/\y in \wt@backlist@@{%
            \pgfmathparse{\x*\wl@UMMAISZ}\edef\@currentline@wl{\pgfmathresult}%
            \ifwl@first\global\wl@addt@list{\wl@list@@}{\@currentline@wl/\y}\else%
                \global\wl@addt@list{\wl@list@@}{,\@currentline@wl/\y}\fi%
            \ifwl@first\global\wl@firstfalse\fi%
        }%
    \else% list (lambda)
        \foreach \x in \wt@backlist@@{%
            \pgfmathparse{\x*\wl@UMMAISZ}\edef\@currentline@wl{\pgfmathresult}%
            \ifwl@first\global\wl@addt@list{}{\@currentline@wl}\else%
                \global\wl@addt@list{\wl@list@@}{,\@currentline@wl}\fi%
            \ifwl@first\global\wl@firstfalse\fi%
        }%
    \fi%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% NEW v2.1.0 ---------------------->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \pgfspectrashade[type=<h|v>](start,end){name} ---> type: h-horizontal (default) | v-vertical
\def\pgfspectrashade{\ignorespaces\@ifnextchar[\wl@pgfspectrashade{\wl@pgfspectrashade[h]}}%
\def\wl@pgfspectrashade[#1](#2,#3)#4{\ignorespaces%
\ifnum#2>#3\relax\PackageError{pgf-spectra}%
{in \textbackslash pgfspectrashade the starting wavelength (#2) must be lesser then the finishing wavelength (#3)}%
{Try typing the wavelengths in the correct order: \textbackslash pgfspectrashade(#3,#2)...}\else%
\ifnum#3<381\relax\PackageError{pgf-spectra}{in \textbackslash pgfspectrashade the finishing wavelength (#3) must be at least 381...}%
{Please type a finishing wavelength greater then 380...}\else%
\ifnum#2<380\relax\def\wl@shade@begin{380}\else\pgfmathparse{int(#2)}\edef\wl@shade@begin{\pgfmathresult}\fi%
\ifnum#3>780\relax\def\wl@shade@end{780}\else\pgfmathparse{int(#3)}\edef\wl@shade@end{\pgfmathresult}\fi%
\pgfmathparse{(\wl@shade@end-\wl@shade@begin)/50}\edef\wl@shadecolor@step{\pgfmathresult}%
%\foreach \n in {1,...,51}{%
\@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,%
                21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,%
                39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
\pgfmathparse{\wl@shade@begin+(\n-1)*\wl@shadecolor@step}\edef\wl@currentwl{\pgfmathresult}%
\wlcolor{\wl@currentwl}%
\edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%%
}%
\def\wl@test{#1}\def\wl@v{v}\def\wl@h{h}%
\ifx\wl@test\wl@h\relax%
% the horizontal pgfshading
\pgfdeclarehorizontalshading{#4}{100bp}{color(0bp)=(wlshcolI); color(25bp)=(wlshcolI); color(26bp)=(wlshcolII); color(27bp)=(wlshcolIII); color(28bp)=(wlshcolIV); color(29bp)=(wlshcolV); color(30bp)=(wlshcolVI); color(31bp)=(wlshcolVII); color(32bp)=(wlshcolVIII); color(33bp)=(wlshcolIX); color(34bp)=(wlshcolX); color(35bp)=(wlshcolXI); color(36bp)=(wlshcolXII); color(37bp)=(wlshcolXIII); color(38bp)=(wlshcolXIV); color(39bp)=(wlshcolXV); color(40bp)=(wlshcolXVI); color(41bp)=(wlshcolXVII); color(42bp)=(wlshcolXVIII); color(43bp)=(wlshcolXIX); color(44bp)=(wlshcolXX); color(45bp)=(wlshcolXXI); color(46bp)=(wlshcolXXII); color(47bp)=(wlshcolXXIII); color(48bp)=(wlshcolXXIV); color(49bp)=(wlshcolXXV); color(50bp)=(wlshcolXXVI); color(51bp)=(wlshcolXXVII); color(52bp)=(wlshcolXXVIII); color(53bp)=(wlshcolXXIX); color(54bp)=(wlshcolXXX); color(55bp)=(wlshcolXXXI); color(56bp)=(wlshcolXXXII); color(57bp)=(wlshcolXXXIII); color(58bp)=(wlshcolXXXIV); color(59bp)=(wlshcolXXXV); color(60bp)=(wlshcolXXXVI); color(61bp)=(wlshcolXXXVII); color(62bp)=(wlshcolXXXVIII); color(63bp)=(wlshcolXXXIX); color(64bp)=(wlshcolXL); color(65bp)=(wlshcolXLI); color(66bp)=(wlshcolXLII); color(67bp)=(wlshcolXLIII); color(68bp)=(wlshcolXLIV); color(69bp)=(wlshcolXLV); color(70bp)=(wlshcolXLVI); color(71bp)=(wlshcolXLVII); color(72bp)=(wlshcolXLVIII); color(73bp)=(wlshcolXLIX); color(74bp)=(wlshcolL); color(75bp)=(wlshcolLI); color(100bp)=(wlshcolLI)}%
\else\ifx\wl@test\wl@v\relax%
% the vertical pgfshading
\pgfdeclareverticalshading{#4}{100bp}{color(0bp)=(wlshcolI); color(25bp)=(wlshcolI); color(26bp)=(wlshcolII); color(27bp)=(wlshcolIII); color(28bp)=(wlshcolIV); color(29bp)=(wlshcolV); color(30bp)=(wlshcolVI); color(31bp)=(wlshcolVII); color(32bp)=(wlshcolVIII); color(33bp)=(wlshcolIX); color(34bp)=(wlshcolX); color(35bp)=(wlshcolXI); color(36bp)=(wlshcolXII); color(37bp)=(wlshcolXIII); color(38bp)=(wlshcolXIV); color(39bp)=(wlshcolXV); color(40bp)=(wlshcolXVI); color(41bp)=(wlshcolXVII); color(42bp)=(wlshcolXVIII); color(43bp)=(wlshcolXIX); color(44bp)=(wlshcolXX); color(45bp)=(wlshcolXXI); color(46bp)=(wlshcolXXII); color(47bp)=(wlshcolXXIII); color(48bp)=(wlshcolXXIV); color(49bp)=(wlshcolXXV); color(50bp)=(wlshcolXXVI); color(51bp)=(wlshcolXXVII); color(52bp)=(wlshcolXXVIII); color(53bp)=(wlshcolXXIX); color(54bp)=(wlshcolXXX); color(55bp)=(wlshcolXXXI); color(56bp)=(wlshcolXXXII); color(57bp)=(wlshcolXXXIII); color(58bp)=(wlshcolXXXIV); color(59bp)=(wlshcolXXXV); color(60bp)=(wlshcolXXXVI); color(61bp)=(wlshcolXXXVII); color(62bp)=(wlshcolXXXVIII); color(63bp)=(wlshcolXXXIX); color(64bp)=(wlshcolXL); color(65bp)=(wlshcolXLI); color(66bp)=(wlshcolXLII); color(67bp)=(wlshcolXLIII); color(68bp)=(wlshcolXLIV); color(69bp)=(wlshcolXLV); color(70bp)=(wlshcolXLVI); color(71bp)=(wlshcolXLVII); color(72bp)=(wlshcolXLVIII); color(73bp)=(wlshcolXLIX); color(74bp)=(wlshcolL); color(75bp)=(wlshcolLI); color(100bp)=(wlshcolLI)}%
\fi\fi%
\fi\fi%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newif\ifwl@logshade% NEW v2.1.1
\pgfkeys{/wl/.cd,%
shade begin/.get=\wl@shadebegin,% NEW v2.1.1
shade begin/.store in=\wl@shadebegin,% NEW v2.1.1
shade begin/.default=380,% NEW v2.1.1
shade end/.get=\wl@shadeend,%
shade end/.store in=\wl@shadeend,%
shade end/.default=780,%
shade opacity/.get=\wl@shade@opacity,%
shade opacity/.store in=\wl@shade@opacity,%
shade opacity/.default=1,%
shade opacity color/.get=\wl@shade@opacitycolor,%
shade opacity color/.store in=\wl@shade@opacitycolor,%
shade opacity color/.default=white,%
logarithmic/.is if=wl@logshade% NEW v2.1.1
}%
\pgfkeys{/wl/.cd,shade begin,shade end,shade opacity,shade opacity color,logarithmic=false}%
% \pgfspectraplotshade{name} or
% \pgfspectraplotshade[options]{name}
% --- recoded in v2.1.1 ---
\def\pgfspectraplotshade{\@ifnextchar[\wl@pgfspectraplotshade{\wl@pgfspectraplotshade[]}}%
\def\wl@pgfspectraplotshade[#1]#2{\ignorespaces%
\pgfkeys{/wl/.cd,shade begin=380,shade end=780,shade opacity=1,shade opacity color=white,logarithmic=false}%
\pgfkeys{/wl/.cd,UVcolor=wlUVcolor,IRcolor=wlIRcolor,gamma=.8}%
\pgfkeys{/wl/.cd,#1}%
\pgfmathparse{100*\wl@shade@opacity}\edef\@wl@shade@opacity{\pgfmathresult}%
% ---------------------------------------------------------------------------------------------------------------------
% verifying start & end
\edef\wl@shadebegin@pt{\wl@shadebegin pt}%
\edef\wl@shadeend@pt{\wl@shadeend pt}%
\ifdim\wl@shadebegin@pt<0pt\relax%
\PackageError{pgf-spectra}{pgfspectraplotshade - minimum wavelength is 0nm!}{}%
\else\ifdim\wl@shadeend@pt>16000pt\relax%
\PackageError{pgf-spectra}{pgfspectraplotshade - maximum wavelength is 16000nm!}{}%
\else\ifdim\wl@shadeend@pt<\wl@shadebegin@pt\relax%
\PackageError{pgf-spectra}{pgfspectraplotshade - shade end must be greater then shade begin!}{}%
\else\relax%
\ifdim\wl@shadeend@pt<380pt\relax%
\pgfdeclarehorizontalshading{#2}{100bp}{color(0bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(100bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor)}%
\else%
\ifdim\wl@shadebegin@pt>780pt\relax%
\pgfdeclarehorizontalshading{#2}{100bp}{color(0bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(100bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor)}%
\else%
\pgfkeys{/pgf/number format/.cd,fixed,precision=4,set thousands separator={},assume math mode=true}%
%  ----------------------------------------------------
    \ifdim\wl@shadebegin@pt<380pt\relax%
        \ifdim\wl@shadeend@pt>780pt\relax%
            % ---------------------------------------------------------------------------------------------------------------------
            % \wl@shadebegin<380nm & \wl@shadeend>780nm ----------------------------------------------------
            % Shade structure:
            %       xShade(bp) = f(wl)
            %       x_from_\wl@shadebegin[bp]@25bp -- x_to_\wl@shadeend[bp]@75bp:
            %           x_UV_from_\wl@shadebegin[bp]@25bp -- xUV_to_379.9nm@x_end_UV[bp] --
            %           -- x_VIS_from_380nm@x_start_VIS[bp] -- xVIS_to_780nm@x_end_VIS[bp] --
            %           -- x_IR_from_780.1nm@x_start_IR[bp] -- -- x\wl@shadeend[bp]@75bp
            % ------------------------------------------------------------------------------------------------------
            % if wl@shadebegin=0nm let \wl@shadebegin=0.0001 (log only)
            % (approximation for supporting shading from 0... not a real situation in a logarithmic plot,
            % but not detected in the resulting shade if used for other purposes... )
            % -----------------------------------------------------------------------------------------------------
            \ifwl@logshade% \wl@logshadetrue
                \ifnum\wl@shadebegin=0\relax\edef\wl@shadebegin{0.00001}\fi%
                \pgfmathparse{(\wl@shadeend-\wl@shadebegin)/50}%
                \pgfmathprintnumberto{\pgfmathresult}{\wl@shadestep}%
                \pgfmathparse{50/(log10(\wl@shadeend)-log10(\wl@shadebegin))}%
                \pgfmathprintnumberto{\pgfmathresult}{\wl@shade@logscale@factor}%
                \pgfmathparse{25+(log10(379.9)-log10(\wl@shadebegin))*\wl@shade@logscale@factor}%
                \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
                \edef\wl@X@UV{\wl@X@tmp bp}%
                \pgfmathparse{25+(log10(780.1)-log10(\wl@shadebegin))*\wl@shade@logscale@factor}%
                \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
                \edef\wl@X@IR{\wl@X@tmp bp}%
                \pgfmathparse{25+(log10(380)-log10(\wl@shadebegin))*\wl@shade@logscale@factor}%
                \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
                \edef\wl@x@start@VIS@log{\wl@X@tmp}%
                \@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,%
                            21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,%
                            38,39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
                            \pgfmathparse{372+8*\n}%
                            \pgfmathprintnumberto{\pgfmathresult}{\wl@currentwl}%
                            \wlcolor{\wl@currentwl}%
                            \colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
                            \edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%
                            \pgfmathparse{\wl@x@start@VIS@log+(log10(372+8*\n)-log10(380))*\wl@shade@logscale@factor}%
                            \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
                            \expandafter\edef\csname x\@Roman\n\endcsname{\wl@X@tmp bp}%
                            }%
            \else% \wl@logshadefalse
                \pgfmathparse{(\wl@shadeend-\wl@shadebegin)/50}%
                \edef\wl@shade@scale{\pgfmathresult}%
                \pgfmathparse{25+(379.9-\wl@shadebegin)/\wl@shade@scale}%
                \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
                \edef\wl@X@UV{\wl@X@tmp bp}%
                \pgfmathparse{25+(780.1-\wl@shadebegin)/\wl@shade@scale}%
                \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
                \edef\wl@X@IR{\wl@X@tmp bp}%
                \@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,%
                            21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,%
                            38,39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
                            \pgfmathparse{372+8*\n}% MANTER !!!
                            \pgfmathprintnumberto{\pgfmathresult}{\wl@currentwl}%
                            \wlcolor{\wl@currentwl}%
                            \colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
                            \edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%
                            \pgfmathparse{25+(372-\wl@shadebegin+8*\n)/\wl@shade@scale}%
                            \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
                            \expandafter\edef\csname x\@Roman\n\endcsname{\wl@X@tmp bp}%
                            }%
            \fi% \ifwl@logshade
            % the horizontal shading
            \pgfdeclarehorizontalshading{#2}{100bp}{color(0bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(\wl@X@UV)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);%
            color(\xI)=(wlshcolI);color(\xII)=(wlshcolII);color(\xIII)=(wlshcolIII);color(\xIV)=(wlshcolIV);color(\xV)=(wlshcolV);color(\xVI)=(wlshcolVI);color(\xVII)=(wlshcolVII);color(\xVIII)=(wlshcolVIII);color(\xIX)=(wlshcolIX);color(\xX)=(wlshcolX);color(\xXI)=(wlshcolXI);color(\xXII)=(wlshcolXII);color(\xXIII)=(wlshcolXIII);color(\xXIV)=(wlshcolXIV);color(\xXV)=(wlshcolXV);color(\xXVI)=(wlshcolXVI);color(\xXVII)=(wlshcolXVII);color(\xXVIII)=(wlshcolXVIII);color(\xXIX)=(wlshcolXIX);color(\xXX)=(wlshcolXX);color(\xXXI)=(wlshcolXXI);color(\xXXII)=(wlshcolXXII);color(\xXXIII)=(wlshcolXXIII);color(\xXXIV)=(wlshcolXXIV);color(\xXXV)=(wlshcolXXV);color(\xXXVI)=(wlshcolXXVI);color(\xXXVII)=(wlshcolXXVII);color(\xXXVIII)=(wlshcolXXVIII);color(\xXXIX)=(wlshcolXXIX);color(\xXXX)=(wlshcolXXX);color(\xXXXI)=(wlshcolXXXI);color(\xXXXII)=(wlshcolXXXII);color(\xXXXIII)=(wlshcolXXXIII);color(\xXXXIV)=(wlshcolXXXIV);color(\xXXXV)=(wlshcolXXXV);color(\xXXXVI)=(wlshcolXXXVI);color(\xXXXVII)=(wlshcolXXXVII);color(\xXXXVIII)=(wlshcolXXXVIII);color(\xXXXIX)=(wlshcolXXXIX);color(\xXL)=(wlshcolXL);color(\xXLI)=(wlshcolXLI);color(\xXLII)=(wlshcolXLII);color(\xXLIII)=(wlshcolXLIII);color(\xXLIV)=(wlshcolXLIV);color(\xXLV)=(wlshcolXLV);color(\xXLVI)=(wlshcolXLVI);color(\xXLVII)=(wlshcolXLVII);color(\xXLVIII)=(wlshcolXLVIII);color(\xXLIX)=(wlshcolXLIX);color(\xL)=(wlshcolL);color(\xLI)=(wlshcolLI);%
            color(\wl@X@IR)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(100bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor)}%
        \else% \wl@shadeendt@pt>780pt
            % ---------------------------------------------------------------------------------------------------------------------
            % \wl@shadebegin<380nm & \wl@shadeend<=780nm ----------------------------------------------------
            % Shade structure:
            %       25bp -- UV -- \wl@X@UV -- \wl@X@VIS@i --- xVIS_to_\wl@shadeend[bp]@75bp
            %       VIS region in shade (51 points) -> \n=1,2,...,51
            % ------------------------------------------------------------------------------------------------------
            \pgfmathparse{int(\wl@shadeend-380)}\pgfmathprintnumberto{\pgfmathresult}{\wl@shade@VIS@amp@int}%
            \ifwl@logshade% \wl@logshadetrue
                \ifnum\wl@shadebegin=0\relax\edef\wl@shadebegin{0.00001}\fi%
                \ifnum\wl@shade@VIS@amp@int>20\relax%
                    \pgfmathparse{50/(log10(\wl@shadeend)-log10(\wl@shadebegin))}%
                    \pgfmathprintnumberto{\pgfmathresult}{\wl@shade@logscale@factor}%
                    \pgfmathparse{25+(log10(379.9)-log10(\wl@shadebegin))*\wl@shade@logscale@factor}%
                    \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
                    \edef\wl@X@UV{\wl@X@tmp bp}%
                    \pgfmathparse{25+(log10(380)-log10(\wl@shadebegin))*\wl@shade@logscale@factor}%
                    \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
                    \edef\wl@X@VIS{\wl@X@tmp bp}%
                    \pgfmathparse{(\wl@shadeend-380)/50}%
                    \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
                    \edef\wl@step@VIS{\wl@X@tmp}%
                    \@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,%
                            21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,%
                            38,39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
                            \pgfmathparse{380+\wl@step@VIS*(\n-1)}%
                            \pgfmathprintnumberto{\pgfmathresult}{\wl@currentwl}%
                            \wlcolor{\wl@currentwl}%
                            \colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
                            \edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%
                            \pgfmathparse{\wl@X@VIS+log10(1+(\n-1)*(\wl@step@VIS/380))*\wl@shade@logscale@factor}% correction factor for log10 calc
                            \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
                            \pgfmathparse{\wl@X@tmp*0.99638}% correction factor for log10 calc
                            \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
                            \expandafter\edef\csname x\@Roman\n\endcsname{\wl@X@tmp bp}%
                            }%
                    \edef\xLI{75bp}% not always at 75bp... so forcing it!
                    % the horizontal shading
                    \pgfdeclarehorizontalshading{#2}{100bp}{color(0bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(\wl@X@UV)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);%
                    color(\xI)=(wlshcolI);color(\xII)=(wlshcolII);color(\xIII)=(wlshcolIII);color(\xIV)=(wlshcolIV);color(\xV)=(wlshcolV);color(\xVI)=(wlshcolVI);color(\xVII)=(wlshcolVII);color(\xVIII)=(wlshcolVIII);color(\xIX)=(wlshcolIX);color(\xX)=(wlshcolX);color(\xXI)=(wlshcolXI);color(\xXII)=(wlshcolXII);color(\xXIII)=(wlshcolXIII);color(\xXIV)=(wlshcolXIV);color(\xXV)=(wlshcolXV);color(\xXVI)=(wlshcolXVI);color(\xXVII)=(wlshcolXVII);color(\xXVIII)=(wlshcolXVIII);color(\xXIX)=(wlshcolXIX);color(\xXX)=(wlshcolXX);color(\xXXI)=(wlshcolXXI);color(\xXXII)=(wlshcolXXII);color(\xXXIII)=(wlshcolXXIII);color(\xXXIV)=(wlshcolXXIV);color(\xXXV)=(wlshcolXXV);color(\xXXVI)=(wlshcolXXVI);color(\xXXVII)=(wlshcolXXVII);color(\xXXVIII)=(wlshcolXXVIII);color(\xXXIX)=(wlshcolXXIX);color(\xXXX)=(wlshcolXXX);color(\xXXXI)=(wlshcolXXXI);color(\xXXXII)=(wlshcolXXXII);color(\xXXXIII)=(wlshcolXXXIII);color(\xXXXIV)=(wlshcolXXXIV);color(\xXXXV)=(wlshcolXXXV);color(\xXXXVI)=(wlshcolXXXVI);color(\xXXXVII)=(wlshcolXXXVII);color(\xXXXVIII)=(wlshcolXXXVIII);color(\xXXXIX)=(wlshcolXXXIX);color(\xXL)=(wlshcolXL);color(\xXLI)=(wlshcolXLI);color(\xXLII)=(wlshcolXLII);color(\xXLIII)=(wlshcolXLIII);color(\xXLIV)=(wlshcolXLIV);color(\xXLV)=(wlshcolXLV);color(\xXLVI)=(wlshcolXLVI);color(\xXLVII)=(wlshcolXLVII);color(\xXLVIII)=(wlshcolXLVIII);color(\xXLIX)=(wlshcolXLIX);color(\xL)=(wlshcolL);color(\xLI)=(wlshcolLI);%
                    color(75.01bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(100bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor)}%
                \else% VIS@amp@int<=20%
                    \pgfmathparse{1/(log10(\wl@shadeend)-log10(\wl@shadebegin))}%
                    \pgfmathprintnumberto{\pgfmathresult}{\wl@shade@logscale@factor}%
                    \pgfmathparse{25+(log10(379.999)-log10(\wl@shadebegin))*50*\wl@shade@logscale@factor}%
                    \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
                    \ifnum\wl@shade@VIS@amp@int=0\relax%
                        \pgfmathparse{\wl@X@tmp*0.99621-.1898}% correction factor for log10 calc
                    \else%
                        \pgfmathparse{\wl@X@tmp*0.99621}% correction factor for log10 calc
                    \fi%
                    \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
                    \edef\wl@X@UV{\wl@X@tmp bp}%
                    \pgfmathparse{25+(log10(380)-log10(\wl@shadebegin))*50*\wl@shade@logscale@factor}%
                    \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
                    \ifnum\wl@shade@VIS@amp@int=0\relax%
                        \pgfmathparse{\wl@X@tmp*0.99621-.1898}% correction factor for log10 calc
                    \else%
                        \pgfmathparse{\wl@X@tmp*0.99621}% correction factor for log10 calc
                    \fi%
                    \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
                    \edef\wl@X@VIS{\wl@X@tmp bp}%
                    \pgfmathparse{(\wl@shadeend-380)/50}%
                    \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
                    \edef\wl@step@VIS{\wl@X@tmp}%
                    \@for\n:={1,6,11,16,21,26,31,36,41,46,51}\do{%
                            \pgfmathparse{380+\wl@step@VIS*(\n-1)}%
                            \pgfmathprintnumberto{\pgfmathresult}{\wl@currentwl}%
                            \wlcolor{\wl@currentwl}%
                            \colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
                            \edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%
                            \pgfmathparse{\wl@X@VIS+log10(1+(\n-1)*(\wl@step@VIS/380))*50*\wl@shade@logscale@factor}%
                            \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
                            \expandafter\edef\csname x\@Roman\n\endcsname{\wl@X@tmp bp}%
                            }%
                    \edef\xLI{75bp}%
                    % the horizontal shading
                    \pgfdeclarehorizontalshading{#2}{100bp}{color(0bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(\wl@X@UV)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);%
                    color(\xI)=(wlshcolI);color(\xVI)=(wlshcolVI);color(\xXI)=(wlshcolXI);color(\xXVI)=(wlshcolXVI);color(\xXXI)=(wlshcolXXI);color(\xXXVI)=(wlshcolXXVI);color(\xXXXI)=(wlshcolXXXI);color(\xXXXVI)=(wlshcolXXXVI);color(\xXLI)=(wlshcolXLI);color(\xXLVI)=(wlshcolXLVI);color(\xLI)=(wlshcolLI);%
                    color(75.01bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(100bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor)}%
                \fi%
            \else% \wl@logshadefalse
                \ifnum\wl@shade@VIS@amp@int=0\relax%
                    \wlcolor{380}%
                    \colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
                    \pgfmathparse{(\wl@shadeend-\wl@shadebegin)/50}%
                    \edef\wl@shade@scale{\pgfmathresult}%
                    \pgfmathparse{25+(379.9-\wl@shadebegin)/\wl@shade@scale-.1898}%
                    \pgfmathprintnumberto{\pgfmathresult}{\wl@X@UV}%
                    \pgfmathparse{25+(379.99-\wl@shadebegin)/\wl@shade@scale-.1898}%
                    \pgfmathprintnumberto{\pgfmathresult}{\wl@X@VIS}%
                    % the horizontal shading
                    \pgfdeclarehorizontalshading{#2}{100bp}{color(0bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(\wl@X@UV)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);%
                    color(\wl@X@VIS)=(wlcolor);color(75bp)=(wlcolor);%
                    color(75.01bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(100bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor)}%
                \else%
                    \pgfmathparse{(\wl@shadeend-\wl@shadebegin)/50}%
                    \edef\wl@shade@scale{\pgfmathresult}%
                    \pgfmathparse{25+(379.99-\wl@shadebegin)/\wl@shade@scale}%
                    \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
                    \edef\wl@X@UV{\wl@X@tmp bp}%
                    \@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,%
                            21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,%
                            38,39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
                            \pgfmathparse{380+(\wl@shadeend-380)/50*(\n-1)}%
                            \pgfmathprintnumberto{\pgfmathresult}{\wl@currentwl}%
                            \wlcolor{\wl@currentwl}%
                            \colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
                            \edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%
                            \pgfmathparse{25+(380-\wl@shadebegin+(\wl@shadeend-380)/50*(\n-1))/\wl@shade@scale}%
                            \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
                            \expandafter\edef\csname x\@Roman\n\endcsname{\wl@X@tmp bp}%
                            }%
                    % the horizontal shading
                    \pgfdeclarehorizontalshading{#2}{100bp}{color(0bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(\wl@X@UV)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);%
                    color(\xI)=(wlshcolI);color(\xII)=(wlshcolII);color(\xIII)=(wlshcolIII);color(\xIV)=(wlshcolIV);color(\xV)=(wlshcolV);color(\xVI)=(wlshcolVI);color(\xVII)=(wlshcolVII);color(\xVIII)=(wlshcolVIII);color(\xIX)=(wlshcolIX);color(\xX)=(wlshcolX);color(\xXI)=(wlshcolXI);color(\xXII)=(wlshcolXII);color(\xXIII)=(wlshcolXIII);color(\xXIV)=(wlshcolXIV);color(\xXV)=(wlshcolXV);color(\xXVI)=(wlshcolXVI);color(\xXVII)=(wlshcolXVII);color(\xXVIII)=(wlshcolXVIII);color(\xXIX)=(wlshcolXIX);color(\xXX)=(wlshcolXX);color(\xXXI)=(wlshcolXXI);color(\xXXII)=(wlshcolXXII);color(\xXXIII)=(wlshcolXXIII);color(\xXXIV)=(wlshcolXXIV);color(\xXXV)=(wlshcolXXV);color(\xXXVI)=(wlshcolXXVI);color(\xXXVII)=(wlshcolXXVII);color(\xXXVIII)=(wlshcolXXVIII);color(\xXXIX)=(wlshcolXXIX);color(\xXXX)=(wlshcolXXX);color(\xXXXI)=(wlshcolXXXI);color(\xXXXII)=(wlshcolXXXII);color(\xXXXIII)=(wlshcolXXXIII);color(\xXXXIV)=(wlshcolXXXIV);color(\xXXXV)=(wlshcolXXXV);color(\xXXXVI)=(wlshcolXXXVI);color(\xXXXVII)=(wlshcolXXXVII);color(\xXXXVIII)=(wlshcolXXXVIII);color(\xXXXIX)=(wlshcolXXXIX);color(\xXL)=(wlshcolXL);color(\xXLI)=(wlshcolXLI);color(\xXLII)=(wlshcolXLII);color(\xXLIII)=(wlshcolXLIII);color(\xXLIV)=(wlshcolXLIV);color(\xXLV)=(wlshcolXLV);color(\xXLVI)=(wlshcolXLVI);color(\xXLVII)=(wlshcolXLVII);color(\xXLVIII)=(wlshcolXLVIII);color(\xXLIX)=(wlshcolXLIX);color(\xL)=(wlshcolL);color(\xLI)=(wlshcolLI);%
                    color(75.01bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(100bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor)}%
                \fi%
            \fi% \ifwl@logshade
        \fi% \wl@shadeendt@pt>780pt
    \else%\wl@shadebegin@pt<380pt
        \ifdim\wl@shadeend@pt>780pt\relax%
            % ---------------------------------------------------------------------------------------------------------------------
            % \wl@shadebegin>=380nm & \wl@shadeend>780nm ----------------------------------------------------
            % Shade structure:
            %       xShade(bp) = f(wl)
            %       xVIS_from_\wl@shadebegin[bp]@25bp -- xVIS_to_\wl@shadeend[bp]@75bp
            %       VIS region in shade (51 points) -> \n=1,2,...,51
            % ------------------------------------------------------------------------------------------------------
            \ifwl@logshade% \wl@logshadetrue
            \pgfmathparse{int(780-\wl@shadebegin)}\pgfmathprintnumberto{\pgfmathresult}{\wl@shade@VIS@amp@int}%
                \ifnum\wl@shade@VIS@amp@int>20\relax%
                    \pgfmathparse{50/(log10(\wl@shadeend)-log10(\wl@shadebegin))}%
                    \pgfmathprintnumberto{\pgfmathresult}{\wl@shade@logscale@factor}%
                    \pgfmathparse{25+(log10(780.1)-log10(\wl@shadebegin))*\wl@shade@logscale@factor}%
                    \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
                    \edef\wl@X@IR{\wl@X@tmp bp}%
                    \@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,%
                            21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,%
                            38,39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
                            \pgfmathparse{\wl@shadebegin+(780-\wl@shadebegin)/50*(\n-1)}%
                            \pgfmathprintnumberto{\pgfmathresult}{\wl@currentwl}%
                            \wlcolor{\wl@currentwl}%
                            \colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
                            \edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%
                            \pgfmathparse{25+(log10(\wl@shadebegin+(780-\wl@shadebegin)/50*(\n-1))-log10(\wl@shadebegin))*\wl@shade@logscale@factor}%
                            \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
                            \expandafter\edef\csname x\@Roman\n\endcsname{\wl@X@tmp bp}%
                            }%
                    % the horizontal shading
                    \pgfdeclarehorizontalshading{#2}{100bp}{color(0bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(24.99bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);%
                    color(\xI)=(wlshcolI);color(\xII)=(wlshcolII);color(\xIII)=(wlshcolIII);color(\xIV)=(wlshcolIV);color(\xV)=(wlshcolV);color(\xVI)=(wlshcolVI);color(\xVII)=(wlshcolVII);color(\xVIII)=(wlshcolVIII);color(\xIX)=(wlshcolIX);color(\xX)=(wlshcolX);color(\xXI)=(wlshcolXI);color(\xXII)=(wlshcolXII);color(\xXIII)=(wlshcolXIII);color(\xXIV)=(wlshcolXIV);color(\xXV)=(wlshcolXV);color(\xXVI)=(wlshcolXVI);color(\xXVII)=(wlshcolXVII);color(\xXVIII)=(wlshcolXVIII);color(\xXIX)=(wlshcolXIX);color(\xXX)=(wlshcolXX);color(\xXXI)=(wlshcolXXI);color(\xXXII)=(wlshcolXXII);color(\xXXIII)=(wlshcolXXIII);color(\xXXIV)=(wlshcolXXIV);color(\xXXV)=(wlshcolXXV);color(\xXXVI)=(wlshcolXXVI);color(\xXXVII)=(wlshcolXXVII);color(\xXXVIII)=(wlshcolXXVIII);color(\xXXIX)=(wlshcolXXIX);color(\xXXX)=(wlshcolXXX);color(\xXXXI)=(wlshcolXXXI);color(\xXXXII)=(wlshcolXXXII);color(\xXXXIII)=(wlshcolXXXIII);color(\xXXXIV)=(wlshcolXXXIV);color(\xXXXV)=(wlshcolXXXV);color(\xXXXVI)=(wlshcolXXXVI);color(\xXXXVII)=(wlshcolXXXVII);color(\xXXXVIII)=(wlshcolXXXVIII);color(\xXXXIX)=(wlshcolXXXIX);color(\xXL)=(wlshcolXL);color(\xXLI)=(wlshcolXLI);color(\xXLII)=(wlshcolXLII);color(\xXLIII)=(wlshcolXLIII);color(\xXLIV)=(wlshcolXLIV);color(\xXLV)=(wlshcolXLV);color(\xXLVI)=(wlshcolXLVI);color(\xXLVII)=(wlshcolXLVII);color(\xXLVIII)=(wlshcolXLVIII);color(\xXLIX)=(wlshcolXLIX);color(\xL)=(wlshcolL);color(\xLI)=(wlshcolLI);%
                    color(\wl@X@IR)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(75.01bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(100bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor)}%
                \else% amp<=20
                    \pgfmathparse{1/(log10(\wl@shadeend)-log10(\wl@shadebegin))}%
                    \pgfmathprintnumberto{\pgfmathresult}{\wl@shade@logscale@factor}%
                    \ifnum\wl@shade@VIS@amp@int=0\relax%
                        \pgfmathparse{25+(log10(780.1)-log10(\wl@shadebegin))*50*\wl@shade@logscale@factor}%
                        \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
                        \edef\wl@X@IR{\wl@X@tmp bp}%
                    \else%
                        \pgfmathparse{25+(log10(781)-log10(\wl@shadebegin))*50*\wl@shade@logscale@factor}%
                        \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
                        \edef\wl@X@IR{\wl@X@tmp bp}%
                    \fi%
                    \@for\n:={1,6,11,16,21,26,31,36,41,46,51}\do{%
                            \pgfmathparse{\wl@shadebegin+(780-\wl@shadebegin)/50*(\n-1)}%
                            \pgfmathprintnumberto{\pgfmathresult}{\wl@currentwl}%
                            \wlcolor{\wl@currentwl}%
                            \colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
                            \edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%
                            \pgfmathparse{25+(log10(\wl@shadebegin+(780-\wl@shadebegin)/50*(\n-1))-log10(\wl@shadebegin))*50*\wl@shade@logscale@factor}%
                            \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
                            \expandafter\edef\csname x\@Roman\n\endcsname{\wl@X@tmp bp}%
                            }%
                    % the horizontal shading
                    \pgfdeclarehorizontalshading{#2}{100bp}{color(0bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(24.99bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);%
                    color(\xI)=(wlshcolI);color(\xVI)=(wlshcolVI);color(\xXI)=(wlshcolXI);color(\xXVI)=(wlshcolXVI);color(\xXXI)=(wlshcolXXI);color(\xXXVI)=(wlshcolXXVI);color(\xXXXI)=(wlshcolXXXI);color(\xXXXVI)=(wlshcolXXXVI);color(\xXLI)=(wlshcolXLI);color(\xXLVI)=(wlshcolXLVI);color(\xLI)=(wlshcolLI);%
                    color(\wl@X@IR)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(75.01bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(100bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor)}%
                \fi%
            \else% \wl@logshadefalse
                \pgfmathparse{(\wl@shadeend-\wl@shadebegin)/50}%
                \edef\wl@shade@scale{\pgfmathresult}%
                \pgfmathparse{25+(780.01-\wl@shadebegin)/\wl@shade@scale}%
                \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
                \edef\wl@X@IR{\wl@X@tmp bp}%
                \@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,%
                            21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,%
                            38,39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
                            \pgfmathparse{\wl@shadebegin+(780-\wl@shadebegin)/50*(\n-1)}%
                            \pgfmathprintnumberto{\pgfmathresult}{\wl@currentwl}%
                            \wlcolor{\wl@currentwl}%
                            \colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
                            \edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%
                            \pgfmathparse{25+(780-\wl@shadebegin)/50*(\n-1)/\wl@shade@scale}%
                            \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
                            \expandafter\edef\csname x\@Roman\n\endcsname{\wl@X@tmp bp}%
                            }%
                % the horizontal shading
                \pgfdeclarehorizontalshading{#2}{100bp}{color(0bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(24.99bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);%
                color(\xI)=(wlshcolI);color(\xII)=(wlshcolII);color(\xIII)=(wlshcolIII);color(\xIV)=(wlshcolIV);color(\xV)=(wlshcolV);color(\xVI)=(wlshcolVI);color(\xVII)=(wlshcolVII);color(\xVIII)=(wlshcolVIII);color(\xIX)=(wlshcolIX);color(\xX)=(wlshcolX);color(\xXI)=(wlshcolXI);color(\xXII)=(wlshcolXII);color(\xXIII)=(wlshcolXIII);color(\xXIV)=(wlshcolXIV);color(\xXV)=(wlshcolXV);color(\xXVI)=(wlshcolXVI);color(\xXVII)=(wlshcolXVII);color(\xXVIII)=(wlshcolXVIII);color(\xXIX)=(wlshcolXIX);color(\xXX)=(wlshcolXX);color(\xXXI)=(wlshcolXXI);color(\xXXII)=(wlshcolXXII);color(\xXXIII)=(wlshcolXXIII);color(\xXXIV)=(wlshcolXXIV);color(\xXXV)=(wlshcolXXV);color(\xXXVI)=(wlshcolXXVI);color(\xXXVII)=(wlshcolXXVII);color(\xXXVIII)=(wlshcolXXVIII);color(\xXXIX)=(wlshcolXXIX);color(\xXXX)=(wlshcolXXX);color(\xXXXI)=(wlshcolXXXI);color(\xXXXII)=(wlshcolXXXII);color(\xXXXIII)=(wlshcolXXXIII);color(\xXXXIV)=(wlshcolXXXIV);color(\xXXXV)=(wlshcolXXXV);color(\xXXXVI)=(wlshcolXXXVI);color(\xXXXVII)=(wlshcolXXXVII);color(\xXXXVIII)=(wlshcolXXXVIII);color(\xXXXIX)=(wlshcolXXXIX);color(\xXL)=(wlshcolXL);color(\xXLI)=(wlshcolXLI);color(\xXLII)=(wlshcolXLII);color(\xXLIII)=(wlshcolXLIII);color(\xXLIV)=(wlshcolXLIV);color(\xXLV)=(wlshcolXLV);color(\xXLVI)=(wlshcolXLVI);color(\xXLVII)=(wlshcolXLVII);color(\xXLVIII)=(wlshcolXLVIII);color(\xXLIX)=(wlshcolXLIX);color(\xL)=(wlshcolL);color(\xLI)=(wlshcolLI);%
                color(\wl@X@IR)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(75.01bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(100bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor)}%
            \fi% \ifwl@logshade
        \else% \wl@shadeend@pt>780pt
            % -----------------------------------------------------------------------------------------------------
            % \wl@shadebegin>=380nm & \wl@shadeend<=780nm ---------------------------------
            % Shade structure:
            %       xShade(bp) = f(wl)
            %       xVIS_from_\wl@shadebegin[bp]@25bp -- xVIS_to_\wl@shadeend[bp]@75bp
            %       VIS region in shade (51 points) -> \n=1,2,...,51
            % ------------------------------------------------------------------------------------------------------
            \pgfmathparse{(\wl@shadeend-\wl@shadebegin)/50}\pgfmathprintnumberto{\pgfmathresult}{\wl@shade@step}%
            \ifwl@logshade% \wl@logshadetrue
                % scale (25 to 75 bp): \wl@shade@amp=\wl@shadeend-\wl@shadebegin ; \wl@shade@scale=\wl@shade@amp/50
                \pgfmathparse{\wl@shadeend-\wl@shadebegin}\edef\wl@shade@amp{\pgfmathresult}%
                \pgfmathprintnumberto{\wl@shade@amp}{\wl@shade@amp@int}%
                \ifnum\wl@shade@amp@int>5\relax%
                    \pgfmathparse{50/(log10(\wl@shadeend)-log10(\wl@shadebegin))}\pgfmathprintnumberto{\pgfmathresult}{\wl@shade@logscale@factor}%
                    \@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,%
                            21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,%
                            38,39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
                            \pgfmathparse{\wl@shadebegin+(\n-1)*\wl@shade@step}%
                            \pgfmathprintnumberto{\pgfmathresult}{\wl@currentwl}%
                            \wlcolor{\wl@currentwl}%
                            \colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
                            \edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%
                            \pgfmathparse{25+((log10(\wl@currentwl)-log10(\wl@shadebegin))*\wl@shade@logscale@factor}%
                            \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
                            \expandafter\edef\csname x\@Roman\n\endcsname{\wl@X@tmp bp}%
                            }%
                    \edef\xLI{75bp}%
                    % the horizontal shading
                    \pgfdeclarehorizontalshading{#2}{100bp}{color(0bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(24.94bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(24.95bp)=(wlshcolI);%
                        color(\xI)=(wlshcolI);color(\xII)=(wlshcolII);color(\xIII)=(wlshcolIII);color(\xIV)=(wlshcolIV);color(\xV)=(wlshcolV);color(\xVI)=(wlshcolVI);color(\xVII)=(wlshcolVII);color(\xVIII)=(wlshcolVIII);color(\xIX)=(wlshcolIX);color(\xX)=(wlshcolX);color(\xXI)=(wlshcolXI);color(\xXII)=(wlshcolXII);color(\xXIII)=(wlshcolXIII);color(\xXIV)=(wlshcolXIV);color(\xXV)=(wlshcolXV);color(\xXVI)=(wlshcolXVI);color(\xXVII)=(wlshcolXVII);color(\xXVIII)=(wlshcolXVIII);color(\xXIX)=(wlshcolXIX);color(\xXX)=(wlshcolXX);color(\xXXI)=(wlshcolXXI);color(\xXXII)=(wlshcolXXII);color(\xXXIII)=(wlshcolXXIII);color(\xXXIV)=(wlshcolXXIV);color(\xXXV)=(wlshcolXXV);color(\xXXVI)=(wlshcolXXVI);color(\xXXVII)=(wlshcolXXVII);color(\xXXVIII)=(wlshcolXXVIII);color(\xXXIX)=(wlshcolXXIX);color(\xXXX)=(wlshcolXXX);color(\xXXXI)=(wlshcolXXXI);color(\xXXXII)=(wlshcolXXXII);color(\xXXXIII)=(wlshcolXXXIII);color(\xXXXIV)=(wlshcolXXXIV);color(\xXXXV)=(wlshcolXXXV);color(\xXXXVI)=(wlshcolXXXVI);color(\xXXXVII)=(wlshcolXXXVII);color(\xXXXVIII)=(wlshcolXXXVIII);color(\xXXXIX)=(wlshcolXXXIX);color(\xXL)=(wlshcolXL);color(\xXLI)=(wlshcolXLI);color(\xXLII)=(wlshcolXLII);color(\xXLIII)=(wlshcolXLIII);color(\xXLIV)=(wlshcolXLIV);color(\xXLV)=(wlshcolXLV);color(\xXLVI)=(wlshcolXLVI);color(\xXLVII)=(wlshcolXLVII);color(\xXLVIII)=(wlshcolXLVIII);color(\xXLIX)=(wlshcolXLIX);color(\xL)=(wlshcolL);color(\xLI)=(wlshcolLI);%
                        color(75.01bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(100bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor)}%
                \else% \wl@shade@amp@int<5
                    \pgfmathparse{(log10(\wl@shadeend)-log10(\wl@shadebegin))}\pgfmathprintnumberto{\pgfmathresult}{\wl@shade@logscale@factor}%
                    \wlcolor{\wl@shadebegin}%
                    \colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
                    \colorlet{wlshcolI}{wlcolor}%
                    \edef\xI{25bp}%
                    \@for\n:={11,21,31,41}\do{%
                            \pgfmathparse{\wl@shadebegin+(\n-1)*\wl@shade@step}%
                            \pgfmathprintnumberto{\pgfmathresult}{\wl@currentwl}%
                            \wlcolor{\wl@currentwl}%
                            \colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
                            \edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%
                            \pgfmathparse{25+(log10(\wl@currentwl)*50-log10(\wl@shadebegin)*50)/\wl@shade@logscale@factor}%
                            \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
                            \expandafter\edef\csname x\@Roman\n\endcsname{\wl@X@tmp bp}%
                            }%
                    \wlcolor{\wl@shadeend}%
                    \colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
                    \colorlet{wlshcolLI}{wlcolor}%
                    \edef\xLI{75bp}%
                    % the horizontal shading
                    \pgfdeclarehorizontalshading{#2}{100bp}{color(0bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(24.94bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(24.95bp)=(wlshcolI);%
                        color(\xI)=(wlshcolI);color(\xXI)=(wlshcolXI);color(\xXXI)=(wlshcolXXI);color(\xXXXI)=(wlshcolXXXI);color(\xXLI)=(wlshcolXLI);color(\xLI)=(wlshcolLI);%
                        color(75.01bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(100bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor)}%
                \fi% amp>5
            \else% \wl@logshadefalse
                \@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,%
                            21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,%
                            38,39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
                            \pgfmathparse{\wl@shadebegin+(\n-1)*\wl@shade@step}%
                            \pgfmathprintnumberto{\pgfmathresult}{\wl@currentwl}%
                            \wlcolor{\wl@currentwl}%
                            \colorlet{wlcolor}{wl@temp!\@wl@shade@opacity!\wl@shade@opacitycolor}%
                            \edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%
                            \pgfmathparse{24+\n}%
                            \pgfmathprintnumberto{\pgfmathresult}{\wl@X@tmp}%
                            \expandafter\edef\csname x\@Roman\n\endcsname{\wl@X@tmp bp}%
                            }%
                % the horizontal shading
                \pgfdeclarehorizontalshading{#2}{100bp}{color(0bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(24.94bp)=(\wl@UVcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(24.95bp)=(wlshcolI);%
                    color(\xI)=(wlshcolI);color(\xII)=(wlshcolII);color(\xIII)=(wlshcolIII);color(\xIV)=(wlshcolIV);color(\xV)=(wlshcolV);color(\xVI)=(wlshcolVI);color(\xVII)=(wlshcolVII);color(\xVIII)=(wlshcolVIII);color(\xIX)=(wlshcolIX);color(\xX)=(wlshcolX);color(\xXI)=(wlshcolXI);color(\xXII)=(wlshcolXII);color(\xXIII)=(wlshcolXIII);color(\xXIV)=(wlshcolXIV);color(\xXV)=(wlshcolXV);color(\xXVI)=(wlshcolXVI);color(\xXVII)=(wlshcolXVII);color(\xXVIII)=(wlshcolXVIII);color(\xXIX)=(wlshcolXIX);color(\xXX)=(wlshcolXX);color(\xXXI)=(wlshcolXXI);color(\xXXII)=(wlshcolXXII);color(\xXXIII)=(wlshcolXXIII);color(\xXXIV)=(wlshcolXXIV);color(\xXXV)=(wlshcolXXV);color(\xXXVI)=(wlshcolXXVI);color(\xXXVII)=(wlshcolXXVII);color(\xXXVIII)=(wlshcolXXVIII);color(\xXXIX)=(wlshcolXXIX);color(\xXXX)=(wlshcolXXX);color(\xXXXI)=(wlshcolXXXI);color(\xXXXII)=(wlshcolXXXII);color(\xXXXIII)=(wlshcolXXXIII);color(\xXXXIV)=(wlshcolXXXIV);color(\xXXXV)=(wlshcolXXXV);color(\xXXXVI)=(wlshcolXXXVI);color(\xXXXVII)=(wlshcolXXXVII);color(\xXXXVIII)=(wlshcolXXXVIII);color(\xXXXIX)=(wlshcolXXXIX);color(\xXL)=(wlshcolXL);color(\xXLI)=(wlshcolXLI);color(\xXLII)=(wlshcolXLII);color(\xXLIII)=(wlshcolXLIII);color(\xXLIV)=(wlshcolXLIV);color(\xXLV)=(wlshcolXLV);color(\xXLVI)=(wlshcolXLVI);color(\xXLVII)=(wlshcolXLVII);color(\xXLVIII)=(wlshcolXLVIII);color(\xXLIX)=(wlshcolXLIX);color(\xL)=(wlshcolL);color(\xLI)=(wlshcolLI);%
                    color(75.01bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor);color(100bp)=(\wl@IRcolor!\@wl@shade@opacity!\wl@shade@opacitycolor)}%
            \fi% \ifwl@logshade
        \fi% \wl@shadeend@pt>780pt
    \fi%\wl@shadebegin@pt<380pt\relax
\fi\fi% \wl@shadeend@pt<380pt || \wl@shadebegin@pt>780pt
\fi% \wl@shadeend@pt<\wl@shadebegin@pt
\fi\fi% wl<0nm && wl > 16000 nm
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \pgfspectraplotmap[<l|h>]{name}
% l -> low resolution (51 colors -> 380 to 780 nm ; step 8 nm) ! Default
% h -> high resolution (401 colors -> 380 to 780 nm ; step 1 nm)
\def\pgfspectraplotmap{\ignorespaces\@ifnextchar[\wl@pgfspectraplotmap{\wl@pgfspectraplotmap[l]}}%
\def\wl@pgfspectraplotmap[#1]#2{\ignorespaces%
\def\wl@test{#1}\def\wl@l{l}\def\wl@h{h}%
\ifx\wl@test\wl@l\relax%
\@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,%
21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,%
38,39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
%\pgfmathparse{380+(\n-1)*8}\edef\wl@currentwl{\pgfmathresult}%
\pgfmathparse{372+8*\n}\edef\wl@currentwl{\pgfmathresult}%
\wlcolor{\wl@currentwl}%
\edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor}%%
}%
% the pgfplots colormap
\pgfplotsset{/pgfplots/colormap={#2}{color(0bp)=(wlshcolI); color(1bp)=(wlshcolII); color(2bp)=(wlshcolIII); color(3bp)=(wlshcolIV); color(4bp)=(wlshcolV); color(5bp)=(wlshcolVI); color(6bp)=(wlshcolVII); color(7bp)=(wlshcolVIII); color(8bp)=(wlshcolIX); color(9bp)=(wlshcolX); color(10bp)=(wlshcolXI); color(11bp)=(wlshcolXII); color(12bp)=(wlshcolXIII); color(13bp)=(wlshcolXIV); color(14bp)=(wlshcolXV); color(15bp)=(wlshcolXVI); color(16bp)=(wlshcolXVII); color(17bp)=(wlshcolXVIII); color(18bp)=(wlshcolXIX); color(19bp)=(wlshcolXX); color(20bp)=(wlshcolXXI); color(21bp)=(wlshcolXXII); color(22bp)=(wlshcolXXIII); color(23bp)=(wlshcolXXIV); color(24bp)=(wlshcolXXV); color(25bp)=(wlshcolXXVI); color(26bp)=(wlshcolXXVII); color(27bp)=(wlshcolXXVIII); color(28bp)=(wlshcolXXIX); color(29bp)=(wlshcolXXX); color(30bp)=(wlshcolXXXI); color(31bp)=(wlshcolXXXII); color(32bp)=(wlshcolXXXIII); color(33bp)=(wlshcolXXXIV); color(34bp)=(wlshcolXXXV); color(35bp)=(wlshcolXXXVI); color(36bp)=(wlshcolXXXVII); color(37bp)=(wlshcolXXXVIII); color(38bp)=(wlshcolXXXIX); color(39bp)=(wlshcolXL); color(40bp)=(wlshcolXLI); color(41bp)=(wlshcolXLII); color(42bp)=(wlshcolXLIII); color(43bp)=(wlshcolXLIV); color(44bp)=(wlshcolXLV); color(45bp)=(wlshcolXLVI); color(46bp)=(wlshcolXLVII); color(47bp)=(wlshcolXLVIII); color(48bp)=(wlshcolXLIX); color(49bp)=(wlshcolL); color(50bp)=(wlshcolLI)}}%
\else\ifx\wl@test\wl@h\relax%%
\pgfplotsset{/pgfplots/colormap={#2}{rgb(0bp)=(.3,0,.3); rgb(1bp)=(.3122,0,.3175); rgb(2bp)=(.3238,0,.335); rgb(3bp)=(.3349,0,.3525); rgb(4bp)=(.3453,0,.37); rgb(5bp)=(.3552,0,.3875); rgb(6bp)=(.3645,0,.405); rgb(7bp)=(.3732,0,.4225); rgb(8bp)=(.3813,0,.44); rgb(9bp)=(.3889,0,.4575); rgb(10bp)=(.3958,0,.475); rgb(11bp)=(.4022,0,.4925); rgb(12bp)=(.408,0,.51); rgb(13bp)=(.4132,0,.5275); rgb(14bp)=(.4178,0,.545); rgb(15bp)=(.4219,0,.5625); rgb(16bp)=(.4253,0,.58); rgb(17bp)=(.4282,0,.5975); rgb(18bp)=(.4305,0,.615); rgb(19bp)=(.4322,0,.6325); rgb(20bp)=(.4333,0,.65); rgb(21bp)=(.4339,0,.6675); rgb(22bp)=(.4338,0,.685); rgb(23bp)=(.4332,0,.7025); rgb(24bp)=(.432,0,.72); rgb(25bp)=(.4302,0,.7375); rgb(26bp)=(.4278,0,.755); rgb(27bp)=(.4249,0,.7725); rgb(28bp)=(.4213,0,.79); rgb(29bp)=(.4172,0,.8075); rgb(30bp)=(.4125,0,.825); rgb(31bp)=(.4072,0,.8425); rgb(32bp)=(.4013,0,.86); rgb(33bp)=(.3949,0,.8775); rgb(34bp)=(.3878,0,.895); rgb(35bp)=(.3802,0,.9125); rgb(36bp)=(.372,0,.93); rgb(37bp)=(.3632,0,.9475); rgb(38bp)=(.3538,0,.965); rgb(39bp)=(.3439,0,.9825); rgb(40bp)=(.3333,0,1); rgb(41bp)=(.3167,0,1); rgb(42bp)=(.3,0,1); rgb(43bp)=(.2833,0,1); rgb(44bp)=(.2667,0,1); rgb(45bp)=(.25,0,1); rgb(46bp)=(.2333,0,1); rgb(47bp)=(.2167,0,1); rgb(48bp)=(.2,0,1); rgb(49bp)=(.1833,0,1); rgb(50bp)=(.1667,0,1); %
rgb(51bp)=(.15,0,1); rgb(52bp)=(.1333,0,1); rgb(53bp)=(.1167,0,1); rgb(54bp)=(.1,0,1); rgb(55bp)=(.0833,0,1); rgb(56bp)=(.0667,0,1); rgb(57bp)=(.05,0,1); rgb(58bp)=(.0333,0,1); rgb(59bp)=(.0167,0,1); rgb(60bp)=(0,0,1); rgb(61bp)=(0,.02,1); rgb(62bp)=(0,.04,1); rgb(63bp)=(0,.06,1); rgb(64bp)=(0,.08,1); rgb(65bp)=(0,.1,1); rgb(66bp)=(0,.12,1); rgb(67bp)=(0,.14,1); rgb(68bp)=(0,.16,1); rgb(69bp)=(0,.18,1); rgb(70bp)=(0,.2,1); rgb(71bp)=(0,.22,1); rgb(72bp)=(0,.24,1); rgb(73bp)=(0,.26,1); rgb(74bp)=(0,.28,1); rgb(75bp)=(0,.3,1); rgb(76bp)=(0,.32,1); rgb(77bp)=(0,.34,1); rgb(78bp)=(0,.36,1); rgb(79bp)=(0,.38,1); rgb(80bp)=(0,.4,1); rgb(81bp)=(0,.42,1); rgb(82bp)=(0,.44,1); rgb(83bp)=(0,.46,1); rgb(84bp)=(0,.48,1); rgb(85bp)=(0,.5,1); rgb(86bp)=(0,.52,1); rgb(87bp)=(0,.54,1); rgb(88bp)=(0,.56,1); rgb(89bp)=(0,.58,1); rgb(90bp)=(0,.6,1); rgb(91bp)=(0,.62,1); rgb(92bp)=(0,.64,1); rgb(93bp)=(0,.66,1); rgb(94bp)=(0,.68,1); rgb(95bp)=(0,.7,1); rgb(96bp)=(0,.72,1); rgb(97bp)=(0,.74,1); rgb(98bp)=(0,.76,1); rgb(99bp)=(0,.78,1); rgb(100bp)=(0,.8,1); %
rgb(101bp)=(0,.82,1); rgb(102bp)=(0,.84,1); rgb(103bp)=(0,.86,1); rgb(104bp)=(0,.88,1); rgb(105bp)=(0,.9,1); rgb(106bp)=(0,.92,1); rgb(107bp)=(0,.94,1); rgb(108bp)=(0,.96,1); rgb(109bp)=(0,.98,1); rgb(110bp)=(0,1,1); rgb(111bp)=(0,1,.95); rgb(112bp)=(0,1,.9); rgb(113bp)=(0,1,.85); rgb(114bp)=(0,1,.8); rgb(115bp)=(0,1,.75); rgb(116bp)=(0,1,.7); rgb(117bp)=(0,1,.65); rgb(118bp)=(0,1,.6); rgb(119bp)=(0,1,.55); rgb(120bp)=(0,1,.5); rgb(121bp)=(0,1,.45); rgb(122bp)=(0,1,.4); rgb(123bp)=(0,1,.35); rgb(124bp)=(0,1,.3); rgb(125bp)=(0,1,.25); rgb(126bp)=(0,1,.2); rgb(127bp)=(0,1,.15); rgb(128bp)=(0,1,.1); rgb(129bp)=(0,1,.05); rgb(130bp)=(0,1,0); rgb(131bp)=(.0143,1,0); rgb(132bp)=(.0286,1,0); rgb(133bp)=(.0429,1,0); rgb(134bp)=(.0571,1,0); rgb(135bp)=(.0714,1,0); rgb(136bp)=(.0857,1,0); rgb(137bp)=(.1,1,0); rgb(138bp)=(.1143,1,0); rgb(139bp)=(.1286,1,0); rgb(140bp)=(.1429,1,0); rgb(141bp)=(.1571,1,0); rgb(142bp)=(.1714,1,0); rgb(143bp)=(.1857,1,0); rgb(144bp)=(.2,1,0); rgb(145bp)=(.2143,1,0); rgb(146bp)=(.2286,1,0); rgb(147bp)=(.2429,1,0); rgb(148bp)=(.2571,1,0); rgb(149bp)=(.2714,1,0); rgb(150bp)=(.2857,1,0); %
rgb(151bp)=(.3,1,0); rgb(152bp)=(.3143,1,0); rgb(153bp)=(.3286,1,0); rgb(154bp)=(.3429,1,0); rgb(155bp)=(.3571,1,0); rgb(156bp)=(.3714,1,0); rgb(157bp)=(.3857,1,0); rgb(158bp)=(.4,1,0); rgb(159bp)=(.4143,1,0); rgb(160bp)=(.4286,1,0); rgb(161bp)=(.4429,1,0); rgb(162bp)=(.4571,1,0); rgb(163bp)=(.4714,1,0); rgb(164bp)=(.4857,1,0); rgb(165bp)=(.5,1,0); rgb(166bp)=(.5143,1,0); rgb(167bp)=(.5286,1,0); rgb(168bp)=(.5429,1,0); rgb(169bp)=(.5571,1,0); rgb(170bp)=(.5714,1,0); rgb(171bp)=(.5857,1,0); rgb(172bp)=(.6,1,0); rgb(173bp)=(.6143,1,0); rgb(174bp)=(.6286,1,0); rgb(175bp)=(.6429,1,0); rgb(176bp)=(.6571,1,0); rgb(177bp)=(.6714,1,0); rgb(178bp)=(.6857,1,0); rgb(179bp)=(.7,1,0); rgb(180bp)=(.7143,1,0); rgb(181bp)=(.7286,1,0); rgb(182bp)=(.7429,1,0); rgb(183bp)=(.7571,1,0); rgb(184bp)=(.7714,1,0); rgb(185bp)=(.7857,1,0); rgb(186bp)=(.8,1,0); rgb(187bp)=(.8143,1,0); rgb(188bp)=(.8286,1,0); rgb(189bp)=(.8429,1,0); rgb(190bp)=(.8571,1,0); rgb(191bp)=(.8714,1,0); rgb(192bp)=(.8857,1,0); rgb(193bp)=(.9,1,0); rgb(194bp)=(.9143,1,0); rgb(195bp)=(.9286,1,0); rgb(196bp)=(.9429,1,0); rgb(197bp)=(.9571,1,0); rgb(198bp)=(.9714,1,0); rgb(199bp)=(.9857,1,0); rgb(200bp)=(1,1,0); %
rgb(201bp)=(1,.9846,0); rgb(202bp)=(1,.9692,0); rgb(203bp)=(1,.9538,0); rgb(204bp)=(1,.9385,0); rgb(205bp)=(1,.9231,0); rgb(206bp)=(1,.9077,0); rgb(207bp)=(1,.8923,0); rgb(208bp)=(1,.8769,0); rgb(209bp)=(1,.8615,0); rgb(210bp)=(1,.8462,0); rgb(211bp)=(1,.8308,0); rgb(212bp)=(1,.8154,0); rgb(213bp)=(1,.8,0); rgb(214bp)=(1,.7846,0); rgb(215bp)=(1,.7692,0); rgb(216bp)=(1,.7538,0); rgb(217bp)=(1,.7385,0); rgb(218bp)=(1,.7231,0); rgb(219bp)=(1,.7077,0); rgb(220bp)=(1,.6923,0); rgb(221bp)=(1,.6769,0); rgb(222bp)=(1,.6615,0); rgb(223bp)=(1,.6462,0); rgb(224bp)=(1,.6308,0); rgb(225bp)=(1,.6154,0); rgb(226bp)=(1,.6,0); rgb(227bp)=(1,.5846,0); rgb(228bp)=(1,.5692,0); rgb(229bp)=(1,.5538,0); rgb(230bp)=(1,.5385,0); rgb(231bp)=(1,.5231,0); rgb(232bp)=(1,.5077,0); rgb(233bp)=(1,.4923,0); rgb(234bp)=(1,.4769,0); rgb(235bp)=(1,.4615,0); rgb(236bp)=(1,.4462,0); rgb(237bp)=(1,.4308,0); rgb(238bp)=(1,.4154,0); rgb(239bp)=(1,.4,0); rgb(240bp)=(1,.3846,0); rgb(241bp)=(1,.3692,0); rgb(242bp)=(1,.3538,0); rgb(243bp)=(1,.3385,0); rgb(244bp)=(1,.3231,0); rgb(245bp)=(1,.3077,0); rgb(246bp)=(1,.2923,0); rgb(247bp)=(1,.2769,0); rgb(248bp)=(1,.2615,0); rgb(249bp)=(1,.2462,0); rgb(250bp)=(1,.2308,0); %
rgb(251bp)=(1,.2154,0); rgb(252bp)=(1,.2,0); rgb(253bp)=(1,.1846,0); rgb(254bp)=(1,.1692,0); rgb(255bp)=(1,.1538,0); rgb(256bp)=(1,.1385,0); rgb(257bp)=(1,.1231,0); rgb(258bp)=(1,.1077,0); rgb(259bp)=(1,.0923,0); rgb(260bp)=(1,.0769,0); rgb(261bp)=(1,.0615,0); rgb(262bp)=(1,.0462,0); rgb(263bp)=(1,.0308,0); rgb(264bp)=(1,.0154,0); rgb(265bp)=(1,0,0); rgb(266bp)=(1,0,0); rgb(267bp)=(1,0,0); rgb(268bp)=(1,0,0); rgb(269bp)=(1,0,0); rgb(270bp)=(1,0,0); rgb(271bp)=(1,0,0); rgb(272bp)=(1,0,0); rgb(273bp)=(1,0,0); rgb(274bp)=(1,0,0); rgb(275bp)=(1,0,0); rgb(276bp)=(1,0,0); rgb(277bp)=(1,0,0); rgb(278bp)=(1,0,0); rgb(279bp)=(1,0,0); rgb(280bp)=(1,0,0); rgb(281bp)=(1,0,0); rgb(282bp)=(1,0,0); rgb(283bp)=(1,0,0); rgb(284bp)=(1,0,0); rgb(285bp)=(1,0,0); rgb(286bp)=(1,0,0); rgb(287bp)=(1,0,0); rgb(288bp)=(1,0,0); rgb(289bp)=(1,0,0); rgb(290bp)=(1,0,0); rgb(291bp)=(1,0,0); rgb(292bp)=(1,0,0); rgb(293bp)=(1,0,0); rgb(294bp)=(1,0,0); rgb(295bp)=(1,0,0); rgb(296bp)=(1,0,0); rgb(297bp)=(1,0,0); rgb(298bp)=(1,0,0); rgb(299bp)=(1,0,0); rgb(300bp)=(1,0,0); %
rgb(301bp)=(1,0,0); rgb(302bp)=(1,0,0); rgb(303bp)=(1,0,0); rgb(304bp)=(1,0,0); rgb(305bp)=(1,0,0); rgb(306bp)=(1,0,0); rgb(307bp)=(1,0,0); rgb(308bp)=(1,0,0); rgb(309bp)=(1,0,0); rgb(310bp)=(1,0,0); rgb(311bp)=(1,0,0); rgb(312bp)=(1,0,0); rgb(313bp)=(1,0,0); rgb(314bp)=(1,0,0); rgb(315bp)=(1,0,0); rgb(316bp)=(1,0,0); rgb(317bp)=(1,0,0); rgb(318bp)=(1,0,0); rgb(319bp)=(1,0,0); rgb(320bp)=(1,0,0); rgb(321bp)=(.9913,0,0); rgb(322bp)=(.9825,0,0); rgb(323bp)=(.9738,0,0); rgb(324bp)=(.965,0,0); rgb(325bp)=(.9563,0,0); rgb(326bp)=(.9475,0,0); rgb(327bp)=(.9388,0,0); rgb(328bp)=(.93,0,0); rgb(329bp)=(.9213,0,0); rgb(330bp)=(.9125,0,0); rgb(331bp)=(.9038,0,0); rgb(332bp)=(.895,0,0); rgb(333bp)=(.8863,0,0); rgb(334bp)=(.8775,0,0); rgb(335bp)=(.8688,0,0); rgb(336bp)=(.86,0,0); rgb(337bp)=(.8513,0,0); rgb(338bp)=(.8425,0,0); rgb(339bp)=(.8338,0,0); rgb(340bp)=(.825,0,0); rgb(341bp)=(.8163,0,0); rgb(342bp)=(.8075,0,0); rgb(343bp)=(.7988,0,0); rgb(344bp)=(.79,0,0); rgb(345bp)=(.7813,0,0); rgb(346bp)=(.7725,0,0); rgb(347bp)=(.7638,0,0); rgb(348bp)=(.755,0,0); rgb(349bp)=(.7463,0,0); rgb(350bp)=(.7375,0,0); %
rgb(351bp)=(.7288,0,0); rgb(352bp)=(.72,0,0); rgb(353bp)=(.7113,0,0); rgb(354bp)=(.7025,0,0); rgb(355bp)=(.6938,0,0); rgb(356bp)=(.685,0,0); rgb(357bp)=(.6763,0,0); rgb(358bp)=(.6675,0,0); rgb(359bp)=(.6588,0,0); rgb(360bp)=(.65,0,0); rgb(361bp)=(.6413,0,0); rgb(362bp)=(.6325,0,0); rgb(363bp)=(.6238,0,0); rgb(364bp)=(.615,0,0); rgb(365bp)=(.6063,0,0); rgb(366bp)=(.5975,0,0); rgb(367bp)=(.5888,0,0); rgb(368bp)=(.58,0,0); rgb(369bp)=(.5713,0,0); rgb(370bp)=(.5625,0,0); rgb(371bp)=(.5538,0,0); rgb(372bp)=(.545,0,0); rgb(373bp)=(.5363,0,0); rgb(374bp)=(.5275,0,0); rgb(375bp)=(.5188,0,0); rgb(376bp)=(.51,0,0); rgb(377bp)=(.5013,0,0); rgb(378bp)=(.4925,0,0); rgb(379bp)=(.4838,0,0); rgb(380bp)=(.475,0,0); rgb(381bp)=(.4663,0,0); rgb(382bp)=(.4575,0,0); rgb(383bp)=(.4488,0,0); rgb(384bp)=(.44,0,0); rgb(385bp)=(.4313,0,0); rgb(386bp)=(.4225,0,0); rgb(387bp)=(.4138,0,0); rgb(388bp)=(.405,0,0); rgb(389bp)=(.3963,0,0); rgb(390bp)=(.3875,0,0); rgb(391bp)=(.3788,0,0); rgb(392bp)=(.37,0,0); rgb(393bp)=(.3613,0,0); rgb(394bp)=(.3525,0,0); rgb(395bp)=(.3438,0,0); rgb(396bp)=(.335,0,0); rgb(397bp)=(.3263,0,0); rgb(398bp)=(.3175,0,0); rgb(399bp)=(.3088,0,0); rgb(400bp)=(.3,0,0); %
}}%
\fi\fi%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \pgfspectrarainbow[<tikz options>](<rainbow fade>,<rainbow start>,<rainbow knock out>,<rainbow background>,<rainbow transparency>){radius}
% tikz options -> color, opacity,scope fading
% rainbow clip -> applies a scope fading in clipped region
% ...
\pgfkeys{/wl/.cd,%
rainbow fade/.get=\wl@rainbowfade,%
rainbow fade/.store in=\wl@rainbowfade,%
rainbow fade/.default={},%
rainbow start/.get=\wl@rainbow@start,%
rainbow start/.store in=\wl@rainbow@start,%
rainbow start/.default=.6,% -> 60%
rainbow knock out/.get=\wl@rainbow@KO,%
rainbow knock out/.store in=\wl@rainbow@KO,%
rainbow knock out/.default=.4,% -> 40%
rainbow background/.get=\wl@rainbowback,%
rainbow background/.store in=\wl@rainbowback,%
rainbow background/.default=white,%
rainbow transparency/.get=\wl@rainbowtransp,%
rainbow transparency/.store in=\wl@rainbowtransp,%
rainbow transparency/.default=0}% -> 0%
%
\def\pgfspectrarainbow{\ignorespaces\@ifnextchar[\pgf@spectrarainbow{\pgf@spectrarainbow[]}}%
\def\pgf@spectrarainbow[#1]{\ignorespaces\@ifnextchar({\pgf@spectra@rainbow{#1}}{\pgf@spectra@rainbow{#1}()}}%
%
\def\pgf@spectra@rainbow#1(#2)#3{\ignorespaces%
\pgfkeys{/wl/.cd,rainbow fade,rainbow start,rainbow knock out,rainbow background,rainbow transparency}%
\pgfkeys{/wl/.cd,#2}%
\pgfmathparse{100-\wl@rainbowtransp*100}\edef\wl@rainbow@transp{\pgfmathresult}%
\pgfmathparse{\wl@rainbowtransp*100}\edef\wl@rainbow@transp@w{\pgfmathresult}%
\edef\wl@rainbowend{.8875cm}\pgfmathparse{\wl@rainbow@start*\wl@rainbowend/1cm}\edef\wl@rainbowstart{\pgfmathresult cm}%
\pgfmathparse{\wl@rainbow@KO*#3/1cm}\edef\wl@rainbowKO{\pgfmathresult cm}%%\edef\wl@rainbowKO{\wl@rainbow@KO cm}%
\ifdim\wl@rainbowstart<\wl@rainbowend\relax%
\ifdim\wl@rainbowstart<.0175cm\relax\edef\wl@rainbowstart{.0175cm}\fi% ensuring there is no error in radial shading
\pgfkeys{/pgf/number format/.cd,fixed,precision=3,set thousands separator={},assume math mode=true}%
\pgfmathparse{\wl@rainbowstart-1/50*(\wl@rainbowend-\wl@rainbowstart)}%
\pgfmathprintnumberto{\pgfmathresult}{\wl@rainbowresult}%
\edef\rO{\wl@rainbowresult pt}%
\@for\n:={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,%
21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,%
38,39,40,41,42,43,44,45,46,47,48,49,50,51}\do{%
%\pgfmathparse{380+(\n-1)*8}\edef\wl@currentwl{\pgfmathresult}%
\pgfmathparse{372+8*\n}\edef\wl@currentwl{\pgfmathresult}%
\wlcolor{\wl@currentwl}%
\edef\wl@colorname{wlshcol\@Roman\n}\relax\colorlet{\wl@colorname}{wlcolor!100!transparent!\wl@rainbow@transp}%
\pgfmathparse{\wl@rainbowstart+1/50*(\n-1)*(\wl@rainbowend-\wl@rainbowstart)}%
\pgfmathprintnumberto{\pgfmathresult}{\wl@rainbowresult}%
\expandafter\edef\csname r\@Roman\n\endcsname{\wl@rainbowresult pt}%
}%
\pgfdeclareradialshading{pgfspectrarainbow}{\pgfpoint{0pt}{0pt}}{%
color(0cm)=(\wl@rainbowback!\wl@rainbow@transp@w!white);color(4/5*\rO)=(\wl@rainbowback!\wl@rainbow@transp@w!white!50);color(\rO)=(white);%
color(\rI)=(wlshcolI);color(\rII)=(wlshcolII);color(\rIII)=(wlshcolIII);color(\rIV)=(wlshcolIV);color(\rV)=(wlshcolV);color(\rVI)=(wlshcolVI);color(\rVII)=(wlshcolVII);color(\rVIII)=(wlshcolVIII);color(\rIX)=(wlshcolIX);color(\rX)=(wlshcolX);%
color(\rXI)=(wlshcolXI);color(\rXII)=(wlshcolXII);color(\rXIII)=(wlshcolXIII);color(\rXIV)=(wlshcolXIV);color(\rXV)=(wlshcolXV);color(\rXVI)=(wlshcolXVI);color(\rXVII)=(wlshcolXVII);color(\rXVIII)=(wlshcolXVIII);color(\rXIX)=(wlshcolXIX);color(\rXX)=(wlshcolXX);%
color(\rXXI)=(wlshcolXXI);color(\rXXII)=(wlshcolXXII);color(\rXXIII)=(wlshcolXXIII);color(\rXXIV)=(wlshcolXXIV);color(\rXXV)=(wlshcolXXV);color(\rXXVI)=(wlshcolXXVI);color(\rXXVII)=(wlshcolXXVII);color(\rXXVIII)=(wlshcolXXVIII);color(\rXXIX)=(wlshcolXXIX);color(\rXXX)=(wlshcolXXX);%
color(\rXXXI)=(wlshcolXXXI);color(\rXXXII)=(wlshcolXXXII);color(\rXXXIII)=(wlshcolXXXIII);color(\rXXXIV)=(wlshcolXXXIV);color(\rXXXV)=(wlshcolXXXV);color(\rXXXVI)=(wlshcolXXXVI);color(\rXXXVII)=(wlshcolXXXVII);color(\rXXXVIII)=(wlshcolXXXVIII);color(\rXXXIX)=(wlshcolXXXIX);color(\rXL)=(wlshcolXL);%
color(\rXLI)=(wlshcolXLI);color(\rXLII)=(wlshcolXLII);color(\rXLIII)=(wlshcolXLIII);color(\rXLIV)=(wlshcolXLIV);color(\rXLV)=(wlshcolXLV);color(\rXLVI)=(wlshcolXLVI);color(\rXLVII)=(wlshcolXLVII);color(\rXLVIII)=(wlshcolXLVIII);color(\rXLIX)=(wlshcolXLIX);color(\rL)=(wlshcolL);color(\rLI)=(wlshcolLI);%
color(.95cm)=(wlshcolLI)%
}%
\ifx\wl@rainbowfade\@empty\relax%
\tikz{\clip(-#3,\wl@rainbowKO) rectangle ++(2*#3,#3-\wl@rainbowKO);%
\fill[#1,shading=pgfspectrarainbow] (0,0) circle(#3);}%
\else%
\tikz{\clip[scope fading=\wl@rainbowfade] (-#3,\wl@rainbowKO) rectangle ++(2*#3,#3-\wl@rainbowKO);%
\fill[shading=pgfspectrarainbow,\wl@rainbowback,#1] (0,0) circle(#3);}%
\fi%
\else\PackageError{pgf-spectra}{invalid 'rainbow start' value (rainbow start=\wl@rainbow@start). The rainbow start should be greater or equal then 0 and lower then 1.}{Don't forget that 'rainbow start' value is the fraction from witch the  colors begin, relative to the center of a circle with radius 1...}%
\fi
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \tempercolor -> Convert a temperature in Kelvin to rgb color
%
% The original algorithm used in this macro can be found at
%
%                                    https://github.com/neilbartlett/color-temperature
%
% More information at...
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --------------------------------------------------------------------------------------------------------------
% https://tannerhelland.com/2012/09/18/convert-temperature-rgb-algorithm-code.html
%
% «Start with a temperature, in Kelvin, somewhere between 1000 and 40000.  (Other values may work,
% but I can't make any promises about the quality of the algorithm's estimates above 40000 K.)»
%                                                                                                                       Tanner Helland
% https://www.zombieprototypes.com/?p=210
%---------------------------------------------------------------------------------------------------------------
% and the improved algorithm at...
% --------------------------------------------------------------------------------------------------------------
% https://github.com/neilbartlett/color-temperature
%
% neilbartlett/color-temperature is licensed under the
%
% MIT License
% A short and simple permissive license with conditions only requiring preservation of copyright and license notices.
% Licensed works, modifications, and larger works may be distributed under different terms and without source code.
%
% Permissions
%      Commercial use, Modification,  Distribution,  Private use
% Limitations
%    Liability,  Warranty
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The MIT License (MIT)
%
% Copyright (c) 2015 Neil Bartlett
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
% of this software and associated documentation files (the "Software"), to deal
% in the Software without restriction, including without limitation the rights
% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
% copies of the Software, and to permit persons to whom the Software is
% furnished to do so, subject to the following conditions:
%
% The above copyright notice and this permission notice shall be included in
% all copies or substantial portions of the Software.
%
% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
% THE SOFTWARE.
% © 2021 GitHub, Inc.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\definecolor{tempercolor}{rgb}{0,0,0}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \tempercolor{Kelvin}
\def\tempercolor#1{\ignorespaces%
%Set Temperature = Temperature \ 100
\edef\wl@temperatura{#1sp}%
\ifdim\wl@temperatura>16380sp\relax% for supporting large values of T
\pgfkeys{/pgf/number format/.cd,fixed,precision=2,fixed zerofill,set thousands separator={},assume math mode=true}%
\pgfmathparse{#1sp/100sp*1.0026931+.002}% correction factor for the division made in sp
\pgfmathprintnumberto{\pgfmathresult}{\wl@T@tmp}%
\edef\wl@temperatura{\wl@T@tmp}%
\edef\wl@temperatura@pt{\pgfmathresult pt}%
\else%
\pgfmathparse{#1/100}%
\edef\wl@temperatura{\pgfmathresult}%
\edef\wl@temperatura@pt{\pgfmathresult pt}%
\fi%
\ifdim\wl@temperatura@pt<10pt\relax%
\PackageError{pgf-spectra}{tempercolor: the temperature must be at least 1000K}{Type a greater temperature...}%
\else\ifdim\wl@temperatura@pt>400pt\relax%
\PackageError{pgf-spectra}{tempercolor: the temperature must be at most 40000K}{Type a smaller temperature...}%
\else%
%Calculate Red:
\ifdim\wl@temperatura@pt>66pt\relax%
    \pgfmathparse{\wl@temperatura-55}\edef\wl@tempercolor@r{\pgfmathresult}%
    \pgfmathparse{351.976906+ 0.114207*\wl@tempercolor@r-40.253663*ln(\wl@tempercolor@r)}%
    \edef\wl@tempercolor@r{\pgfmathresult}%
    \edef\wl@tempercolor@r@pt{\pgfmathresult pt}%
    \ifdim\wl@tempercolor@r@pt<0pt\edef\wl@tempercolor@r{0}\relax\fi%
    \ifdim\wl@tempercolor@r@pt>255pt\edef\wl@tempercolor@r{255}\relax\fi%
    \pgfmathparse{\wl@tempercolor@r/255}\edef\wl@tempercolor@r{\pgfmathresult}%
\else%
    \edef\wl@tempercolor@r{1}%
\fi%
% Calculate Green:
\ifdim\wl@temperatura@pt>66pt\relax%
    \pgfmathparse{\wl@temperatura-50}\edef\wl@tempercolor@g{\pgfmathresult}%
    \pgfmathparse{325.449413+0.079435*\wl@tempercolor@g -28.085296*ln(\wl@tempercolor@g)}%
    \edef\wl@tempercolor@g{\pgfmathresult}%
    \edef\wl@tempercolor@g@pt{\pgfmathresult pt}%
    \ifdim\wl@tempercolor@g@pt<0pt\edef\wl@tempercolor@g{0}\relax\fi%
    \ifdim\wl@tempercolor@g@pt>255pt\edef\wl@tempercolor@g{255}\relax\fi%
    \pgfmathparse{\wl@tempercolor@g/255}\edef\wl@tempercolor@g{\pgfmathresult}%
\else%
    \pgfmathparse{\wl@temperatura-2}\edef\wl@tempercolor@g{\pgfmathresult}%
    \pgfmathparse{-155.254856-0.445970*\wl@tempercolor@g+104.492162*ln(\wl@tempercolor@g)}%
    \edef\wl@tempercolor@g{\pgfmathresult}%
    \edef\wl@tempercolor@g@pt{\pgfmathresult pt}%
    \ifdim\wl@tempercolor@g@pt<0pt\edef\wl@tempercolor@g{0}\relax\fi%
    \ifdim\wl@tempercolor@g@pt>255pt\edef\wl@tempercolor@b{255}\relax\fi%
    \pgfmathparse{\wl@tempercolor@g/255}\edef\wl@tempercolor@g{\pgfmathresult}%
\fi%
%Calculate Blue:
\ifdim\wl@temperatura@pt<66pt\relax%
    \ifdim\wl@temperatura@pt>20pt\relax%
    \pgfmathparse{\wl@temperatura-10}\edef\wl@tempercolor@b{\pgfmathresult}%
    \pgfmathparse{-254.769352+0.827410*\wl@tempercolor@b+115.679944*ln(\wl@tempercolor@b)}%
    \edef\wl@tempercolor@b{\pgfmathresult}%
    \edef\wl@tempercolor@b@pt{\pgfmathresult pt}%
    \ifdim\wl@tempercolor@b@pt<0pt\edef\wl@tempercolor@b{0}\relax\fi%
    \ifdim\wl@tempercolor@b@pt>255pt\edef\wl@tempercolor@b{255}\relax\fi%
    \pgfmathparse{\wl@tempercolor@b/255}\edef\wl@tempercolor@b{\pgfmathresult}%
    \else%
    \edef\wl@tempercolor@b{0}%
    \fi%
\else%
    \edef\wl@tempercolor@b{1}%
\fi%
\definecolor{wl@@tempercolor}{rgb}{\wl@tempercolor@r,\wl@tempercolor@g,\wl@tempercolor@b}%
\colorlet{tempercolor}{wl@@tempercolor}%
\fi\fi% check limits 1000K<T<40000K
}%
% <--- NEW v2.1.0 ------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% nm2rgb convert nanometre wavelength to rgb
% (380 <= Lambda <= 780 ) -> r,g,b on stack
%
% BASED on FORTRAN Code
% RGB VALUES FOR VISIBLE WAVELENGTHS by Dan Bruton (astro@tamu.edu)
% This program can be found at
% http://www.physics.sfasu.edu/astro/color.html
% and was last updated on February 20, 1996.
% The spectrum is generated using approximate RGB values for visible
% wavelengths between 380 nm and 780 nm.
% The red, green and blue values (RGB) are
% assumed to vary linearly with wavelength (for GAMMA=1).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newdimen\wl%wavelength
\newdimen\wl@i%intensity
\newdimen\@wl@gamma%gamma
\newdimen\wlc@lorr%red (0. - 1)
\newdimen\wlc@lorg%green (0. - 1)
\newdimen\wlc@lorb%blue (0. - 1) % wavelength to rgb values
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \wlcolor{wavelength}
\def\wlcolor#1{\ignorespaces%
\ifx\wl@bright\undefined\relax\def\wl@bright{100}\fi% NEW v2.1.0
\wl=#1pt%
\@wl@gamma=\wl@gamma pt%
% compute the rgb components
\ifdim\wl<10pt\relax\PackageWarning{pgf-spectra}{(#1nm) wavelength out of range ignored. The wavelength must be graeter or equal to 10nm (EUV)...}\else% NEW v2.0.0
\ifdim\wl<379.99999pt\relax\else%% NEW v2.0.0
\ifdim\wl<440pt\wlc@lorr=440pt\advance\wlc@lorr by-\wl\divide\wlc@lorr by60\wlc@lorg=0pt\wlc@lorb=1pt\else%
\ifdim\wl<490pt\wlc@lorr=0pt\wlc@lorg=\wl\advance\wlc@lorg by-440pt\divide\wlc@lorg by50\wlc@lorb=1pt\else%
\ifdim\wl<510pt\wlc@lorr=0pt\wlc@lorg=1pt\wlc@lorb=510pt\advance\wlc@lorb by-\wl\divide\wlc@lorb by20\else%
\ifdim\wl<580pt\wlc@lorr=\wl\advance\wlc@lorr by-510pt\divide\wlc@lorr by70\wlc@lorg=1pt\wlc@lorb=0pt\else%
\ifdim\wl<645pt\wlc@lorr=1pt\wlc@lorg=645pt\advance\wlc@lorg by-\wl\divide\wlc@lorg by65\wlc@lorb=0pt\else%
\ifdim\wl<780.00001pt\wlc@lorr=1pt\wlc@lorg=0pt\wlc@lorb=0pt\else%
\ifdim\wl>4000pt\relax\PackageWarning{pgf-spectra}{invalid wavelength (#1nm). The wavelength must be lesser or equal to 4000nm (NIR)...}% NEW v2.0.0
\relax%
\fi\fi\fi\fi\fi\fi\fi\fi\fi%
% intensity correction at vision limits
\ifdim\wl>700pt\ifdim\wl<780.00001pt\wl@i=780pt\advance\wl@i by-\wl\divide\wl@i by80\multiply\wl@i by7\advance\wl@i by3pt\divide\wl@i by10\fi\else%  NEW
\ifdim\wl<420pt\ifdim\wl>379.99999pt\wl@i=\wl\advance\wl@i by-380pt\divide\wl@i by40\multiply\wl@i by7\advance\wl@i by3pt\divide\wl@i by10\fi\else%
\wl@i=1pt%
\fi\fi%
%apply intensity at vision limits correction and  gamma
\ifdim\wl<380pt\colorlet{wl@temp}{\wl@UVcolor}\else\ifdim\wl>780pt\colorlet{wl@temp}{\wl@IRcolor}\else% NEW v2.0.0
\pgfmathparse{\wlc@lorr*\wl@i^\@wl@gamma}\edef\wl@red{\pgfmathresult}%
\pgfmathparse{\wlc@lorg*\wl@i^\@wl@gamma}\edef\wl@green{\pgfmathresult}%
\pgfmathparse{\wlc@lorb*\wl@i^\@wl@gamma}\edef\wl@blue{\pgfmathresult}%
\definecolor{wl@temp}{rgb}{\wl@red,\wl@green,\wl@blue}%
\fi\fi% NEW v2.0.0
\ifwl@usevisibleshade\relax% NEW v2.1.0
\colorlet{wlcolor}{wl@temp!\wl@bright!\wl@backvisible}%
\else%
\colorlet{wlcolor}{wl@temp}%
\fi%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\wl@elt@search#1#2#3#4{\ignorespaces%
% #1 Chemical Symbol, entered by USER
% #2 Chemical Symbol to compare to, e.g. Na
% #3 Emission Lines Data (or error message)
% #4 Imax
\edef\wl@CS@user{#1}\edef\wl@CS@comp{#2}\relax% New
\ifx\wl@CS@user\wl@CS@comp\relax% New -> was \iftthenelse{...
\def\wl@elt@chemsym{#2}%  set chemical symbol
\def\wl@elt@elemdata{#3}%  set element lines data
\def\wl@elt@Imax{#4}%  set element Imax
\fi%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\endinput
