diff options
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/endiagram/README | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/endiagram/endiagram_en.pdf | bin | 669690 -> 675068 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/endiagram/endiagram_en.tex | 294 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/endiagram/endiagram.sty | 1661 |
4 files changed, 1048 insertions, 911 deletions
diff --git a/Master/texmf-dist/doc/latex/endiagram/README b/Master/texmf-dist/doc/latex/endiagram/README index d67f8be38b8..cc0fe7d7243 100644 --- a/Master/texmf-dist/doc/latex/endiagram/README +++ b/Master/texmf-dist/doc/latex/endiagram/README @@ -1,9 +1,9 @@ -------------------------------------------------------------------------- -the ENdiagram package v0.1b +the ENdiagram package v0.1c easy creation of potential energy curve diagrams -2013/04/04 +2013/04/18 -------------------------------------------------------------------------- Clemens Niederberger Web: https://www.bitbucket.org/cgnieder/endiagram diff --git a/Master/texmf-dist/doc/latex/endiagram/endiagram_en.pdf b/Master/texmf-dist/doc/latex/endiagram/endiagram_en.pdf Binary files differindex a50d7e1e1f1..d731a0f3804 100644 --- a/Master/texmf-dist/doc/latex/endiagram/endiagram_en.pdf +++ b/Master/texmf-dist/doc/latex/endiagram/endiagram_en.pdf diff --git a/Master/texmf-dist/doc/latex/endiagram/endiagram_en.tex b/Master/texmf-dist/doc/latex/endiagram/endiagram_en.tex index 385ad45ce89..c268964c0db 100644 --- a/Master/texmf-dist/doc/latex/endiagram/endiagram_en.tex +++ b/Master/texmf-dist/doc/latex/endiagram/endiagram_en.tex @@ -43,8 +43,8 @@ subtitle = {Easy creation of potential energy curve diagrams.} , name = ENdiagram , info = {Easy creation of potential energy curve diagrams} , - date = 2013/04/04 , - version = 0.1b , + date = 2013/04/18 , + version = 0.1c , keywords = {energy diagrams,tikz,LaTeX}, modules = true , code-box = { @@ -65,38 +65,21 @@ \textcolor{main}{\partname~\thepart\autodot}} \addcmds{ - AddAxisLabel, - arrow, - calory, - ch, - chemfig, - chemsetup, - color, - command, - DeclareChemIUPAC, - draw, - ENcurve, - ENsetup, + AddAxisLabel, arrow, + calory, ch, chemfig, chemsetup, color, command, + DeclareChemIUPAC, draw, + ENcurve, ENsetup, fontfamily, iso, joule, kilo, lewis, - MakeOrigin, - mole, + MakeOrigin, mole, node, per, - schemestart, - schemestop, - selectfont, - setatomsep, - ShowEa, - ShowGain, - ShowNiveaus, - sisetup, - tert, - tikz, - transitionstatesymbol + schemestart, schemestop, selectfont, setatomsep, ShowEa, ShowGain, + ShowNiveaus, sisetup, + tert, tikz, transitionstatesymbol } \usepackage{endiagram,chemmacros,chemfig,ragged2e,fnpct} @@ -115,6 +98,7 @@ long = minimal working example } +\usepackage{filecontents} \begin{filecontents}{\jobname.ist} heading_prefix "{\\bfseries " heading_suffix "\\hfil}\\nopagebreak\n" @@ -140,11 +124,21 @@ year = {2009}, isbn = {978-3-8274-1579-0} } -@online{tikz, - author = {Till Tantau}, - title = {Ti\textbf{\textit{k}}Z/pgf}, - url = {http://sourceforge.net/projects/pgf/}, - urldate = {2012-01-31} +@package{pkg:tikz, + author = {Till Tantau and Mark Wibrow and Christian Feuersänger}, + title = {Ti\textbf{\textit{k}}Z/pgf}, + sorttitle = {TikZ}, + version = {2.10}, + date = {2010-20-25}, + url = {http://sourceforge.net/projects/pgf/}, + urldate = {2013-04-18} +} +@package{pkg:siunitx, + author = {Joseph Wright}, + title = {siunitx}, + version = {2.5q}, + date = {2013-03-11}, + url = {mirror.ctan.org/macros/latex/contrib/siunitx/} } \end{filecontents} @@ -168,19 +162,21 @@ { \hfill \newline } \ExplSyntaxOff +\def\code#1{\codefont{\frenchspacing#1}} + \begin{document} \section{Licence and Requirements} Permission is granted to copy, distribute and/or modify this software under the -terms of the LaTeX Project Public License, version 1.3 or later +terms of the \LaTeX{} Project Public License, version 1.3 or later (\url{http://www.latex-project.org/lppl.txt}). This package has the status ``maintained.'' \ENdiagram needs the \paket{l3kernel} and the package \paket{xparse}. \paket{xparse} is part of the \paket{l3packages} bundle. \ENdiagram also needs \paket[pgf]{\TIKZ} -and \paket{siunitx}. +and \paket{siunitx}~\cite{pkg:siunitx}. -Basic knowledge of \TikZ/pgf \cite{tikz} is recommended. +Basic knowledge of \TikZ/pgf \cite{pkg:tikz} is recommended. \section{Caveat} This package is in an experimental state. There is lots of code to clean up and @@ -198,11 +194,13 @@ This document presents commands and options in a consistent way: \begin{beschreibung} \Umg{environment}[<options>]{...} \Befehl{command}[<options>]{<arg>} - \option{option}{\default{default}|value} choice option with a \default{default value} - that will be used, if the option is set without value. - \option{option}{<type>} option that needs an input of a certain type. - \option[command]{option}{<type>} option that belongs to the module - \textcolor{module}{\code{command}}. + \Option{option}{\default{default}|value}\newline + choice option with a \default{default value} that will be used, if the option + is set without value. + \Option{option}{<type>}\newline + option that needs an input of a certain type. + \Option[command]{option}{<type>}\newline + option that belongs to the module \textcolor{module}{\code{command}}. \end{beschreibung} Options can be used in the \oa{<options>} arguments. There are two kinds of options: choice options where you can choose one of the values separated with @@ -268,8 +266,9 @@ Values given to \cmd{ENcurve} are multiples of \ENdiagram's \ac{su}. As a defaul it is set to \SI{.5}{cm} but can be changed using an option. There are other ways to influence the size of the diagram, too. \begin{beschreibung} - \Option{unit}{<length>}\Default{.5cm} The standard unit for \cmd{ENcurve} and - some other commands. This document refers to it with \ac{su}. + \Option{unit}{<length>}\Default{.5cm} + The standard unit for \cmd{ENcurve} and some other commands. This document + refers to it with \ac{su}. \Option{scale}{<factor>}\Default{1} \end{beschreibung} @@ -291,10 +290,12 @@ Scaled by the factor \code{1.5}: The \code{offset} options control the length and position of the horizontal axis relative to the curve. \begin{beschreibung} - \Option{offset}{<num>}\Default{0} \code{<num>} is a multiple of the \ac{su} (see - page~\pageref{key:unit}). - \Option{r-offset}{<num>}\Default{0} \code{<num>} is a multiple of the \ac{su}. - \Option{l-offset}{<num>}\Default{0} \code{<num>} is a multiple of the \ac{su}. + \Option{offset}{<num>}\Default{0} + \code{<num>} is a multiple of the \ac{su} (see page~\pageref{key:unit}). + \Option{r-offset}{<num>}\Default{0} + \code{<num>} is a multiple of the \ac{su}. + \Option{l-offset}{<num>}\Default{0} + \code{<num>} is a multiple of the \ac{su}. \end{beschreibung} The default behaviour for comparison: @@ -332,8 +333,8 @@ $x$ extended to the left and the right:\\ \subsubsection{Increment between the levels}\secidx[increment]{curve} With the option \begin{beschreibung} - \Option[ENcurve]{step}{<num>}\Default{2} \code{<num>} is a multiple of the \ac{su} - (see page~\pageref{key:unit}). + \Option[ENcurve]{step}{<num>}\Default{2} + \code{<num>} is a multiple of the \ac{su} (see page~\pageref{key:unit}). \end{beschreibung} the default increment between the levels can be changed. \begin{beispiel}[below] @@ -371,8 +372,8 @@ using an optional argument to the value of that level: \subsubsection{The shape}\secidx[shape]{curve} The option \begin{beschreibung} - \Option[ENcurve]{looseness}{<value>}\Default{.5} should be a number between - \code{0} and \code{1}. + \Option[ENcurve]{looseness}{<value>}\Default{.5} + should be a number between \code{0} and \code{1}. \end{beschreibung} changes the shape of the curve. \begin{beispiel}[below] @@ -405,8 +406,8 @@ en- or disables them: \subsubsection{\TIKZ\ style}\secidx[style]{curve} The style of the curve can be changed using \TikZ\ options: \begin{beschreibung} - \Option[ENcurve]{tikz}{<tikz>}\Default Valid are options that can be used with - \verb=\draw=. + \Option[ENcurve]{tikz}{<tikz>}\Default + Valid are options that can be used with \verb=\draw=. \end{beschreibung} \begin{beispiel} \begin{endiagram} @@ -417,25 +418,32 @@ The style of the curve can be changed using \TikZ\ options: \subsection{The Axes}\secidx[axes]{curve}\secidx{axes} There are also possibilities to customize the axes. \begin{beschreibung} - \Option{axes}{xy|y|y-l|y-r|x|all|false}\Default{xy} Number and type of axes. - \Option{x-axis}{<tikz>}\Default \TikZ options to the $x$ axis. - \Option{y-axis}{<tikz>}\Default \TikZ options to the $y$ axis. - \Option{x-label}{below|right}\Default{below} Position of the $x$ axis label. - \Option{y-label}{above|left}\Default{left} Position of the $y$ axis label. - \Option{x-label-pos}{<value>}\Default{.5} Position of the $x$ axis label when - \key{x-label}{below} is set. - \Option{y-label-pos}{<value>}\Default{.5} Position of the $y$ axis label when - \key{y-label}{left} is set. - \Option{x-label-offset}{<length>}\Default{0pt} Distance between label and $x$ - axis. - \Option{y-label-offset}{<length>}\Default{0pt} Distance between label and $y$ - axis. - \Option{x-label-angle}{<angle>}\Default{0} Angle which rotates the $x$ axis - label counter clockwise. - \Option{y-label-angle}{<angle>}\Default{0} Angle which rotates the $y$ axis - label counter clockwise. - \Option{x-label-text}{<text>}\Default{\$\cmd{xi}\$} $x$ axis label. - \Option{y-label-text}{<text>}\Default{\$E\$} $y$ axis label. + \Option{axes}{xy|y|y-l|y-r|x|all|false}\Default{xy} + Number and type of axes. + \Option{x-axis}{<tikz>}\Default + \TikZ options to the $x$ axis. + \Option{y-axis}{<tikz>}\Default + \TikZ options to the $y$ axis. + \Option{x-label}{below|right}\Default{below} + Position of the $x$ axis label. + \Option{y-label}{above|left}\Default{left} + Position of the $y$ axis label. + \Option{x-label-pos}{<value>}\Default{.5} + Position of the $x$ axis label when \key{x-label}{below} is set. + \Option{y-label-pos}{<value>}\Default{.5} + Position of the $y$ axis label when \key{y-label}{left} is set. + \Option{x-label-offset}{<length>}\Default{0pt} + Distance between label and $x$ axis. + \Option{y-label-offset}{<length>}\Default{0pt} + Distance between label and $y$ axis. + \Option{x-label-angle}{<angle>}\Default{0} + Angle which rotates the $x$ axis label counter clockwise. + \Option{y-label-angle}{<angle>}\Default{0} + Angle which rotates the $y$ axis label counter clockwise. + \Option{x-label-text}{<text>}\Default{\$\cmd{xi}\$} + $x$ axis label. + \Option{y-label-text}{<text>}\Default{\$E\$} + $y$ axis label. \end{beschreibung} No axes: @@ -497,8 +505,10 @@ described in the next sections -- some information is useful that is hidden normally. These options enable access: \begin{beschreibung} \Option{debug}{\default{true}|false}\Default{false} - \Option{draft}{\default{true}|false}\Default{false} An Alias to \key{debug}. - \Option{final}{\default{true}|false}\Default{true} The opposite of \key{draft}. + \Option{draft}{\default{true}|false}\Default{false} + An Alias to \key{debug}. + \Option{final}{\default{true}|false}\Default{true} + The opposite of \key{draft}. \end{beschreibung} \begin{beispiel}[below] \begin{endiagram}[debug] @@ -531,12 +541,14 @@ draws horizontal lines to the levels: \subsection{Customization} A number of options allow fine-tuning: \begin{beschreibung} - \Option[ShowNiveaus]{length}{<num>}\Default{1} The length of the lines. - \code{<num>} is a multiple of the \ac{su} (see page~\pageref{key:unit}). - \Option[ShowNiveaus]{shift}{<num>}\Default{0} Shift to the right (positive - values) or the left (negative values). \code{<num>} is a multiple of the \ac{su}. - \Option[ShowNiveaus]{tikz}{<tikz>}\Default \TikZ options to modify the style - of the lines. + \Option[ShowNiveaus]{length}{<num>}\Default{1} + The length of the lines. \code{<num>} is a multiple of the \ac{su} (see + page~\pageref{key:unit}). + \Option[ShowNiveaus]{shift}{<num>}\Default{0} + Shift to the right (positive values) or the left (negative values). + \code{<num>} is a multiple of the \ac{su}. + \Option[ShowNiveaus]{tikz}{<tikz>}\Default + \TikZ options to modify the style of the lines. \end{beschreibung} Longer lines: @@ -614,32 +626,34 @@ difference between the first and the last level. The command has options to modify the appearance. \begin{beschreibung} %% - \Option[ShowGain]{tikz}{<tikz>}\Default{<->} \TikZ options for the vertical line. + \Option[ShowGain]{tikz}{<tikz>}\Default{<->} + \TikZ options for the vertical line. %% - \Option[ShowGain]{connect}{<tikz>}\Default{dashed,help lines} \TikZ options for - the connecting line. + \Option[ShowGain]{connect}{<tikz>}\Default{dashed,help lines} + \TikZ options for the connecting line. %% - \Option[ShowGain]{connect-from-line}{\default{true}|false}\Default{false} The - connecting line starts either at the maximum/minimum or at the line drawn by - \cmd{ShowNiveaus}. This option works with the default values but otherwise can - lead to unwanted results. To avoid that you can either set \cmd{ShowGain} - \emph{before} \cmd{ShowNiveaus} or you need to choose another way. + \Option[ShowGain]{connect-from-line}{\default{true}|false}\Default{false} + The connecting line starts either at the maximum/minimum or at the line drawn + by \cmd{ShowNiveaus}. This option works with the default values but otherwise + can lead to unwanted results. To avoid that you can either set \cmd{ShowGain} + \emph{before} \cmd{ShowNiveaus} or you need to choose another way. %% - \Option[ShowGain]{offset}{<num>}\Default{0} Shifts the vertical line to the - right (positive value) or the left (negative value). \code{<num>} is a multiple - of \ac{su} (see page~\pageref{key:unit}). + \Option[ShowGain]{offset}{<num>}\Default{0} + Shifts the vertical line to the right (positive value) or the left (negative + value). \code{<num>} is a multiple of \ac{su} (see page~\pageref{key:unit}). %% - \Option[ShowGain]{label}{\default{true}|false|<text>}\Default{false} Use the - default label (\code{true}) or an own label (\code{<text>}).\label{key:showgain_label} + \Option[ShowGain]{label}{\default{true}|false|<text>}\Default{false} + Use the default label (\code{true}) or an own label (\code{<text>}).\label{key:showgain_label} %% - \Option[ShowGain]{label-side}{right|left}\Default{right} The side of the vertical - line on which the label should be placed. + \Option[ShowGain]{label-side}{right|left}\Default{right} + The side of the vertical line on which the label should be placed. %% - \Option[ShowGain]{label-pos}{<value>}\Default{.5} Position at the line. \code{0} - means at the height of $H_1$, \ie the starting level, \code{1} means at the - height of $H_2$, \ie the ending level. + \Option[ShowGain]{label-pos}{<value>}\Default{.5} + Position at the line. \code{0} means at the height of $H_1$, \ie the starting + level, \code{1} means at the height of $H_2$, \ie the ending level. %% - \Option[ShowGain]{label-tikz}{<tikz>}\Default \TikZ options for the label. + \Option[ShowGain]{label-tikz}{<tikz>}\Default + \TikZ options for the label. \end{beschreibung} \begin{beispiel} @@ -790,17 +804,19 @@ coordinate. \subsection{Customization} Again there are a number of options to customize the appearance. \begin{beschreibung} - \Option[ShowEa]{tikz}{<tikz>}\Default{<->} \TikZ options for the vertical line. - \Option[ShowEa]{connect}{<tikz>}\Default{dashed,help lines} \TikZ options for - the horizontal line. - \Option[ShowEa]{label}{\default{true}|false|<text>}\Default{false} Use the - default label ($E_{\mathrm{a}}$) or an own label.\label{key:showea_label} - \Option[ShowEa]{label-side}{right|left}\Default{right} The side of the vertical - line where the label should appear. - \Option[ShowEa]{label-pos}{<value>}\Default{.5} Determines the vertical position - of the label relative to the vertical line. \code{0} means at the lower end, - \code{1} means at the upper end. - \Option[ShowEa]{label-tikz}{<tikz>}\Default \TikZ options for the label. + \Option[ShowEa]{tikz}{<tikz>}\Default{<->} + \TikZ options for the vertical line. + \Option[ShowEa]{connect}{<tikz>}\Default{dashed,help lines} + \TikZ options for the horizontal line. + \Option[ShowEa]{label}{\default{true}|false|<text>}\Default{false} + Use the default label ($E_{\mathrm{a}}$) or an own label.\label{key:showea_label} + \Option[ShowEa]{label-side}{right|left}\Default{right} + The side of the vertical line where the label should appear. + \Option[ShowEa]{label-pos}{<value>}\Default{.5} + Determines the vertical position of the label relative to the vertical line. + \code{0} means at the lower end, \code{1} means at the upper end. + \Option[ShowEa]{label-tikz}{<tikz>}\Default + \TikZ options for the label. \end{beschreibung} \begin{beispiel} @@ -933,8 +949,8 @@ page~\pageref{key:debug}) \ldots \end{beispiel} \ldots\ or use this option: \begin{beschreibung} - \Option{tikz}{<tikz>}\Default \TikZ options for the \env{endiagram}{\ldots} - environment. + \Option{tikz}{<tikz>}\Default + \TikZ options for the \env{endiagram}{\ldots} environment. \end{beschreibung} With it you can pass arbitrary \TikZ options to the internal \code{tikzpicture} environment. @@ -971,10 +987,11 @@ drawing all curves: \subsection{Automatic Ticks}\ENsetup{AddAxisLabel/font=\fontfamily{fxlf}\selectfont} The $y$ axes can get ticks automatically. \begin{beschreibung} - \Option{ticks}{y|\default{y-l}|y-r|none}\Default{none} Adds ticks to the - specified axes. - \Option{ticks-step}{<num>}\Default{1} \code{<num>} is a multiple of the \ac{su}. - \key{ticks-step}{2} means that only every second tick is added. + \Option{ticks}{y|\default{y-l}|y-r|none}\Default{none} + Adds ticks to the specified axes. + \Option{ticks-step}{<num>}\Default{1} + \code{<num>} is a multiple of the \ac{su}. \key{ticks-step}{2} means that + only every second tick is added. \end{beschreibung} \begin{beispiel} \ENsetup{ticks,y-label=above} @@ -991,8 +1008,8 @@ These ticks obey the \key{energy-unit} option, see section~\ref{sec:reale_werte} % TODO auf Unterschied zwischen den Ticks produziert durch AddAxisLabel und Option ticks hinweisen To be able to add labels to the ticks there is the command \begin{beschreibung} - \Befehl{AddAxisLabel}[<options>]{(<point1>)[<opt. label>];(<point2>);...} - \Befehl{AddAxisLabel}*[<options>]{<level1>[<opt. label>];<level2>;...} + \Befehl{AddAxisLabel}[<options>]{(<point1>)[<opt.\@ label>];(<point2>);...} + \Befehl{AddAxisLabel}*[<options>]{<level1>[<opt.\@ label>];<level2>;...} \end{beschreibung} As you can see there are two variants. The first one awaits a list of coordinates in the \TikZ sense. The second awaits $y$ values. Every of these values has an @@ -1024,8 +1041,8 @@ Example for the first variant: The optional arguments can also get \TikZ options. The description should read: \begin{beschreibung} - \Befehl{AddAxisLabel}{(<point>)[<opt. label>,<tikz>]} - \Befehl{AddAxisLabel}*{<level>[<opt. label>,<tikz>]} + \Befehl{AddAxisLabel}{(<point>)[<opt.\@ label>,<tikz>]} + \Befehl{AddAxisLabel}*{<level>[<opt.\@ label>,<tikz>]} \end{beschreibung} \begin{beispiel} @@ -1042,12 +1059,13 @@ The optional arguments can also get \TikZ options. The description should read: \subsection{Customization} You have several options to customize the labels: \begin{beschreibung} - \Option[AddAxisLabel]{axis}{y-l|y-r|x}\Default{y-l} Choose which axis gets the - labels. - \Option[AddAxisLabel]{connect}{<tikz>}\Default{dashed,help lines} Change the - style of the lines. - \Option[AddAxisLabel]{font}{<commands>}\Default You can add commands like - \verb=\footnotesize= and/or \verb=\color{red}= to format the label text. + \Option[AddAxisLabel]{axis}{y-l|y-r|x}\Default{y-l} + Choose which axis gets the labels. + \Option[AddAxisLabel]{connect}{<tikz>}\Default{dashed,help lines} + Change the style of the lines. + \Option[AddAxisLabel]{font}{<commands>}\Default + You can add commands like \verb=\footnotesize= and/or \verb=\color{red}= to + format the label text. \end{beschreibung} \begin{beispiel}[below] @@ -1071,17 +1089,19 @@ You have several options to customize the labels: If you want to have a more quantitative diagram or use actual values for the energies you can use these options: \begin{beschreibung} - \Option{energy-unit}{<unit>}\Default The unit of the energy scale. A unit in - the \paket{siunitx} sense. - \Option{energy-step}{<num>}\Default{1} Determines which increment on the energy - scale corresponds to the \ac{su}. - \Option{energy-zero}{<num>}\Default{0} Shifts the origin of the energy scale by - \code{<num>} in multiples of the energy scale. - \Option{energy-unit-separator}{<anything>}\Default{/} Separates the $y$ axes - label from the unit. - \Option{energy-round}{<num>}\Default{3} Rounds the value to this number of figures. - \Option{energy-round-places}{\default{true}|false}\Default{false} Switch rounding - mode to places. + \Option{energy-unit}{<unit>}\Default + The unit of the energy scale. A unit in the \paket{siunitx} sense. + \Option{energy-step}{<num>}\Default{1} + Determines which increment on the energy scale corresponds to the \ac{su}. + \Option{energy-zero}{<num>}\Default{0} + Shifts the origin of the energy scale by \code{<num>} in multiples of the + energy scale. + \Option{energy-unit-separator}{<anything>}\Default{/} + Separates the $y$ axes label from the unit. + \Option{energy-round}{<num>}\Default{3} + Rounds the value to this number of figures. + \Option{energy-round-places}{\default{true}|false}\Default{false} + Switch rounding mode to places. \end{beschreibung} Choosing a unit will add ticks and labels to the $y$ axis automatically and has an impact on the commands \cmd{ShowGain} and \cmd{ShowEa}, see section~\ref{ssec:real_einfluss}. @@ -1171,7 +1191,7 @@ an exception to the principle. The figure is a reproduction of a similar figure in~\cite{brueckner}. \begin{beispiel}[code and float] % uses the packages `chemmacros', `chemfig' and `libertine' -\begin{figure}[h] +\begin{figure}[ht] \centering \setatomsep{1.5em} \DeclareChemIUPAC\iso{\textit{i}} diff --git a/Master/texmf-dist/tex/latex/endiagram/endiagram.sty b/Master/texmf-dist/tex/latex/endiagram/endiagram.sty index 4b9970c0902..1d4e164062e 100644 --- a/Master/texmf-dist/tex/latex/endiagram/endiagram.sty +++ b/Master/texmf-dist/tex/latex/endiagram/endiagram.sty @@ -32,13 +32,13 @@ \usetikzlibrary{calc} \ProvidesExplPackage {endiagram} - {2013/04/04} - {0.1b} + {2013/04/18} + {0.1c} {Easy creation of potential energy curve diagrams} % --------------------------------------------------------------------------- % % error and warning messages -\msg_set:nnnn { ENdiagram } { points-missing } +\msg_new:nnnn { ENdiagram } { points-missing } { You~need~at~least~three~values~for~drawing~the~energy~curve~ \msg_line_context: @@ -48,11 +48,11 @@ \msg_line_context: } -\msg_set:nnnn { ENdiagram } { ShowEa } +\msg_new:nnnn { ENdiagram } { ShowEa } { Wrong~argument~syntax.~ \msg_line_context: } { Wrong~argument~syntax.~ \msg_line_context: } -\msg_set:nnnn { ENdiagram } { MakeOrigin } +\msg_new:nnnn { ENdiagram } { MakeOrigin } { You~can't~use~\token_to_str:N \ENcurve \c_space_tl after~ \token_to_str:N \MakeOrigin \c_space_tl \msg_line_context: @@ -62,282 +62,318 @@ \token_to_str:N \MakeOrigin \c_space_tl \msg_line_context: } +\msg_new:nnnn { ENdiagram } { outside-ENdiagram } + { + The~command~\token_to_str:N #1 \c_space_tl can~only~be~used~inside~the~ + `endiagram'~environment. + } + { + It~seems~you~have~used~\token_to_str:N #1 \c_space_tl outside~the~ + `endiagram'~environment~where~it~isn't~allowed~(and~not~at~all~useful,~ + anyway).~ However,~it~can~only~be~used~inside~the~`endiagram'~environment. + } + % --------------------------------------------------------------------------- % % tikz helper functions -\cs_new_nopar:Npn \ENdiagram_node:n #1 +\cs_new:Npn \endiagram_node:n #1 { \node [ #1 ] } -\cs_generate_variant:Nn \ENdiagram_node:n { o,f,x } +\cs_generate_variant:Nn \endiagram_node:n { o,f,x } -\cs_new_nopar:Npn \ENdiagram_draw:n #1 +\cs_new:Npn \endiagram_draw:n #1 { \draw [ #1 ] } -\cs_generate_variant:Nn \ENdiagram_draw:n { o,f,x } +\cs_generate_variant:Nn \endiagram_draw:n { o,f,x } -\cs_new_nopar:Npn \ENdiagram_draw:nn #1#2 +\cs_new:Npn \endiagram_draw:nn #1#2 { \draw [ #1 ] #2 ; } -\cs_generate_variant:Nn \ENdiagram_draw:nn +\cs_generate_variant:Nn \endiagram_draw:nn { no,nf,nx,oo,of,ox,fn,fo,ff,fx,xn,xo,xf,xx } -\cs_new_nopar:Npn \ENdiagram_tikz:n #1 +\cs_new:Npn \endiagram_tikz:n #1 { \tikz [ #1 ] } -\cs_generate_variant:Nn \ENdiagram_tikz:n { o,f,x } +\cs_generate_variant:Nn \endiagram_tikz:n { o,f,x } -\cs_new_nopar:Npn \ENdiagram_tikz:nn #1#2 +\cs_new:Npn \endiagram_tikz:nn #1#2 { \tikz [ #1 ] { #2 } } -\cs_generate_variant:Nn \ENdiagram_tikz:nn +\cs_generate_variant:Nn \endiagram_tikz:nn { no,nf,nx,oo,of,ox,fn,fo,ff,fx,xn,xo,xf,xx } -\cs_new_nopar:Npn \ENdiagram_start_tikzpicture:n #1 +\cs_new:Npn \endiagram_start_tikzpicture:n #1 { \tikzpicture [ #1 ] } -\cs_generate_variant:Nn \ENdiagram_start_tikzpicture:n { o,f,x } +\cs_generate_variant:Nn \endiagram_start_tikzpicture:n { o,f,x } -\cs_new_eq:NN \ENdiagram_end_tikzpicture: \endtikzpicture +\cs_new_eq:NN \endiagram_end_tikzpicture: \endtikzpicture % --------------------------------------------------------------------------- % -\cs_if_exist:NF \l_tmpa_fp { \fp_new:N \l_tmpa_fp } -\cs_if_exist:NF \l_tmpb_fp { \fp_new:N \l_tmpb_fp } -\cs_if_exist:NF \l_tmpc_fp { \fp_new:N \l_tmpc_fp } -\cs_if_exist:NF \g_tmpa_fp { \fp_new:N \g_tmpa_fp } +% temporary variables: +\tl_new:N \l__Endiagram_tmpa_tl +\tl_new:N \l__Endiagram_tmpb_tl +\tl_new:N \l__Endiagram_tmpc_tl + +\fp_new:N \l__Endiagram_tmpa_fp +\fp_new:N \l__Endiagram_tmpb_fp +\fp_new:N \l__Endiagram_tmpc_fp +\fp_new:N \g__Endiagram_tmpa_fp + +\dim_new:N \l__endiagram_tmpa_dim +\dim_new:N \g__Endiagram_tmpa_dim + +% --------------------------------------------------------------------------- % +% restrict commands to use inside the endiagram environment: +\bool_new:N \l__Endiagram_inside_env_bool + +\cs_new_protected:Npn \Endiagram_new_environment_command:Nnn #1#2#3 + { + \NewDocumentCommand #1 { #2 } + { + \bool_if:NTF \l__Endiagram_inside_env_bool + { #3 } + { \msg_warning:nnn { ENdiagram } { outside-ENdiagram } { #1 } } + } + } % --------------------------------------------------------------------------- % % draw the curve -\clist_new:N \l_ENdiagram_points_clist -\prop_new:N \l_ENdiagram_points_prop -\int_new:N \l_ENdiagram_points_int -\int_zero:N \l_ENdiagram_points_int +\clist_new:N \l__endiagram_points_clist +\prop_new:N \l__endiagram_points_prop +\int_new:N \l__endiagram_points_int +\int_zero:N \l__endiagram_points_int -\int_new:N \g_ENdiagram_curve_int -\int_gzero:N \g_ENdiagram_curve_int +\int_new:N \g__endiagram_curve_int +\int_gzero:N \g__endiagram_curve_int -\int_new:N \g_ENdiagram_points_max_int +\int_new:N \g__endiagram_points_max_int -\int_new:N \l_ENdiagram_points_counter_int -\int_set:Nn \l_ENdiagram_points_counter_int { 1 } +\int_new:N \l__endiagram_points_counter_int +\int_set:Nn \l__endiagram_points_counter_int { 1 } -\tl_new:N \l_ENdiagram_draw_curve_tl -\tl_new:N \l_ENdiagram_curve_tikz_tl +\tl_new:N \l__endiagram_draw_curve_tl +\tl_new:N \l__endiagram_curve_tikz_tl -\tl_new:N \l_ENdiagram_curve_looseness_tl -\tl_set:Nn \l_ENdiagram_curve_looseness_tl { .5 } +\tl_new:N \l__endiagram_curve_looseness_tl +\tl_set:Nn \l__endiagram_curve_looseness_tl { .5 } -\tl_new:N \l_ENdiagram_points_step_tl -\tl_set:Nn \l_ENdiagram_points_step_tl { 2 } -\tl_new:N \l_ENdiagram_points_step_default_tl -\tl_set_eq:NN \l_ENdiagram_points_step_default_tl \l_ENdiagram_points_step_tl +\tl_new:N \l__endiagram_points_step_tl +\tl_set:Nn \l__endiagram_points_step_tl { 2 } +\tl_new:N \l__endiagram_points_step_default_tl +\tl_set_eq:NN \l__endiagram_points_step_default_tl \l__endiagram_points_step_tl -\fp_new:N \g_ENdiagram_y_min_fp -\fp_gzero:N \g_ENdiagram_y_min_fp -\fp_new:N \g_ENdiagram_y_max_fp -\fp_gzero:N \g_ENdiagram_y_max_fp +\fp_new:N \g__endiagram_y_min_fp +\fp_gzero:N \g__endiagram_y_min_fp +\fp_new:N \g__endiagram_y_max_fp +\fp_gzero:N \g__endiagram_y_max_fp -\fp_new:N \g_ENdiagram_x_min_fp -\fp_gzero:N \g_ENdiagram_x_min_fp -\fp_new:N \g_ENdiagram_x_max_fp -\fp_gzero:N \g_ENdiagram_x_max_fp +\fp_new:N \g__endiagram_x_min_fp +\fp_gzero:N \g__endiagram_x_min_fp +\fp_new:N \g__endiagram_x_max_fp +\fp_gzero:N \g__endiagram_x_max_fp -\bool_new:N \l_ENdiagram_debug_bool -\bool_new:N \l_ENdiagram_curve_minima_bool +\bool_new:N \l__endiagram_debug_bool +\bool_new:N \l__endiagram_curve_minima_bool \keys_define:nn { ENdiagram / ENcurve } { - step .tl_set:N = \l_ENdiagram_points_step_tl , - looseness .tl_set:N = \l_ENdiagram_curve_looseness_tl , - tikz .tl_set:N = \l_ENdiagram_curve_tikz_tl , - minima .bool_set:N = \l_ENdiagram_curve_minima_bool + step .tl_set:N = \l__endiagram_points_step_tl , + looseness .tl_set:N = \l__endiagram_curve_looseness_tl , + tikz .tl_set:N = \l__endiagram_curve_tikz_tl , + minima .bool_set:N = \l__endiagram_curve_minima_bool } -\cs_new_nopar:Npn \ENdiagram_determine_yaxis_length:n #1 +\cs_new_protected:Npn \__endiagram_determine_yaxis_length:n #1 { - \fp_compare:nNnT { #1 } < { \g_ENdiagram_y_min_fp } - { \fp_gset:Nn \g_ENdiagram_y_min_fp { #1 } } - \fp_compare:nNnT { #1 } > { \g_ENdiagram_y_max_fp } - { \fp_gset:Nn \g_ENdiagram_y_max_fp { #1 } } + \fp_compare:nNnT { #1 } < { \g__endiagram_y_min_fp } + { \fp_gset:Nn \g__endiagram_y_min_fp { #1 } } + \fp_compare:nNnT { #1 } > { \g__endiagram_y_max_fp } + { \fp_gset:Nn \g__endiagram_y_max_fp { #1 } } } -\cs_new_nopar:Npn \ENdiagram_determine_xaxis_length: +\cs_new_protected:Npn \__endiagram_determine_xaxis_length: { - \fp_gset:Nn \g_ENdiagram_x_max_fp { \int_to_arabic:n { \g_ENdiagram_points_max_int } } - \fp_gsub:Nn \g_ENdiagram_x_max_fp { 1 } - \exp_args:NNo \fp_gmul:Nn \g_ENdiagram_x_max_fp { \l_ENdiagram_points_step_tl } + % TODO: adapt to (not so) new l3fp: + \fp_gset:Nn \g__endiagram_x_max_fp + { \int_to_arabic:n { \g__endiagram_points_max_int } } + \fp_gsub:Nn \g__endiagram_x_max_fp { 1 } + \exp_args:NNo \fp_gmul:Nn \g__endiagram_x_max_fp + { \l__endiagram_points_step_tl } } -\NewDocumentCommand \ENdiagram_curve:w { o m } +\Endiagram_new_environment_command:Nnn \ENcurve { o m } { - \bool_if:NT \l_ENdiagram_origin_made_bool + \bool_if:NT \l__endiagram_origin_made_bool { \msg_error:nn { ENdiagram } { MakeOrigin } } - \int_gincr:N \g_ENdiagram_curve_int - \tl_set_eq:NN \l_ENdiagram_points_step_tl \l_ENdiagram_points_step_default_tl + \int_gincr:N \g__endiagram_curve_int + \tl_set_eq:NN \l__endiagram_points_step_tl \l__endiagram_points_step_default_tl \IfNoValueF { #1 } { \keys_set:nn { ENdiagram / ENcurve } { #1 } } - \clist_clear:N \l_ENdiagram_points_clist - \tl_clear:N \l_ENdiagram_draw_curve_tl - \int_set:Nn \l_ENdiagram_points_counter_int { 1 } + \clist_clear:N \l__endiagram_points_clist + \tl_clear:N \l__endiagram_draw_curve_tl + \int_set:Nn \l__endiagram_points_counter_int { 1 } \clist_map_inline:nn { #2 } { - \fp_set:Nn \l_tmpa_tl { \int_to_arabic:n { \l_ENdiagram_points_int } } - \fp_mul:Nn \l_tmpa_tl { \l_ENdiagram_points_step_tl } + \fp_set:Nn \l__Endiagram_tmpa_fp + { ( \int_to_arabic:n { \l__endiagram_points_int } ) * \l__endiagram_points_step_tl } \tl_if_in:nnTF { ##1 } { [ } { - \exp_args:Nfx \ENdiagram_save_points:nnnn - { \int_use:N \l_ENdiagram_points_int } - { \fp_to_tl:N \l_tmpa_tl } ##1 + \__endiagram_save_points:fxnn + { \int_use:N \l__endiagram_points_int } + { \fp_to_tl:N \l__Endiagram_tmpa_fp } ##1 } { - \exp_args:Nfx \ENdiagram_save_points:nnnn - { \int_use:N \l_ENdiagram_points_int } - { \fp_to_tl:N \l_tmpa_tl } { ##1 } [ 0 ] + \__endiagram_save_points:fxnn + { \int_use:N \l__endiagram_points_int } + { \fp_to_tl:N \l__Endiagram_tmpa_fp } { ##1 } [ 0 ] } } - \int_zero:N \l_ENdiagram_points_int - \int_gset:Nn \g_ENdiagram_points_max_int - { \clist_count:N \l_ENdiagram_points_clist } - \int_compare:nT { \g_ENdiagram_points_max_int < 3 } + \int_zero:N \l__endiagram_points_int + \int_gset:Nn \g__endiagram_points_max_int + { \clist_count:N \l__endiagram_points_clist } + \int_compare:nT { \g__endiagram_points_max_int < 3 } { \msg_error:nn { ENdiagram } { points-missing } } - \clist_map_inline:Nn \l_ENdiagram_points_clist + \clist_map_inline:Nn \l__endiagram_points_clist { - \int_compare:nT { \l_ENdiagram_points_counter_int = 1 } + \int_compare:nT { \l__endiagram_points_counter_int = 1 } { - \fp_gset:Nn \g_ENdiagram_y_min_fp { ##1 } - \bool_if:NT \l_ENdiagram_curve_minima_bool + \fp_gset:Nn \g__endiagram_y_min_fp { ##1 } + \bool_if:NT \l__endiagram_curve_minima_bool { - \tl_put_right:Nn \l_ENdiagram_draw_curve_tl + \tl_put_right:Nn \l__endiagram_draw_curve_tl { ($(-.5,##1)+(0,.2)$) to [bend~right] } } } - \ENdiagram_determine_yaxis_length:n { ##1 } - \ENdiagram_determine_xaxis_length: - \fp_set:Nn \l_tmpa_tl { \int_to_arabic:n { \l_ENdiagram_points_counter_int } } - \fp_sub:Nn \l_tmpa_tl { 1 } - \exp_args:NNx \prop_get:NnN \l_ENdiagram_points_prop - { \fp_to_tl:N \l_tmpa_tl } \l_tmpb_tl - \tl_put_right:Nx \l_ENdiagram_draw_curve_tl + \__endiagram_determine_yaxis_length:n { ##1 } + \__endiagram_determine_xaxis_length: + \fp_set:Nn \l__Endiagram_tmpa_fp + { \int_to_arabic:n { \l__endiagram_points_counter_int } -1 } + \prop_get:NxN \l__endiagram_points_prop + { \fp_to_tl:N \l__Endiagram_tmpa_fp } \l__Endiagram_tmpb_tl + \tl_put_right:Nx \l__endiagram_draw_curve_tl { ($ { - \l_tmpb_tl + \l__Endiagram_tmpb_tl } *(1,0)+(0,##1) $) node[inner~sep=0] ( - N \int_to_arabic:n { \g_ENdiagram_curve_int } - - \int_to_arabic:n { \l_ENdiagram_points_counter_int } + N \int_to_arabic:n { \g__endiagram_curve_int } - + \int_to_arabic:n { \l__endiagram_points_counter_int } ) {} } - \bool_if:NT \l_ENdiagram_debug_bool + \bool_if:NT \l__endiagram_debug_bool { - \tl_put_right:Nx \l_ENdiagram_draw_curve_tl + \tl_put_right:Nx \l__endiagram_draw_curve_tl { node[anchor=north~west,font={\exp_not:N \tiny},inner~sep=0,color=black,fill=yellow!20] { - N \int_to_arabic:n { \g_ENdiagram_curve_int } - - \int_to_arabic:n { \l_ENdiagram_points_counter_int } + N \int_to_arabic:n { \g__endiagram_curve_int } - + \int_to_arabic:n { \l__endiagram_points_counter_int } } node[inner~sep=0,above,color=red,font={\exp_not:N \tiny}] - {(\l_tmpb_tl,##1)} + {(\l__Endiagram_tmpb_tl,##1)} } } - \int_compare:nT { \l_ENdiagram_points_counter_int < \g_ENdiagram_points_max_int } - { - \tl_put_right:Nn \l_ENdiagram_draw_curve_tl { to } - } - \int_compare:nT { \l_ENdiagram_points_counter_int = \g_ENdiagram_points_max_int } + \int_compare:nT { \l__endiagram_points_counter_int < \g__endiagram_points_max_int } + { \tl_put_right:Nn \l__endiagram_draw_curve_tl { to } } + \int_compare:nT { \l__endiagram_points_counter_int = \g__endiagram_points_max_int } { - \bool_if:NT \l_ENdiagram_curve_minima_bool + \bool_if:NT \l__endiagram_curve_minima_bool { - \tl_put_right:Nx \l_ENdiagram_draw_curve_tl + \tl_put_right:Nx \l__endiagram_draw_curve_tl { to [bend~right] ($ { - \l_ENdiagram_points_step_tl * - (\int_to_arabic:n { \l_ENdiagram_points_counter_int } - 1 ) + \l__endiagram_points_step_tl * + (\int_to_arabic:n { \l__endiagram_points_counter_int } - 1 ) } *(1,0)+(0,##1)+(.5,.2) $) } } } - \int_incr:N \l_ENdiagram_points_counter_int + \int_incr:N \l__endiagram_points_counter_int } - \ENdiagram_draw:xo + \endiagram_draw:xo { - \l_ENdiagram_curve_tikz_tl, + \l__endiagram_curve_tikz_tl, out=0,in=180, - looseness=\l_ENdiagram_curve_looseness_tl + looseness=\l__endiagram_curve_looseness_tl } - { \l_ENdiagram_draw_curve_tl } - \tl_clear:N \l_ENdiagram_curve_tikz_tl + { \l__endiagram_draw_curve_tl } + \tl_clear:N \l__endiagram_curve_tikz_tl } \cs_generate_variant:Nn \tl_put_right:Nn { Nx } -\cs_new_nopar:Npn \ENdiagram_save_points:nnnn #1#2#3[#4] +\cs_new_protected:Npn \__endiagram_save_points:nnnn #1#2#3[#4] { - \fp_set:Nn \l_tmpa_tl { #2 } - \fp_add:Nn \l_tmpa_tl { #4 } - \clist_put_right:Nn \l_ENdiagram_points_clist { #3 } - \exp_args:NNox \prop_put:Nnn \l_ENdiagram_points_prop { #1 } { \fp_to_tl:N \l_tmpa_tl } - \int_incr:N \l_ENdiagram_points_int + \fp_set:Nn \l__Endiagram_tmpa_fp { #2 + #4 } + \clist_put_right:Nn \l__endiagram_points_clist { #3 } + \prop_put:Nox \l__endiagram_points_prop + { #1 } + { \fp_to_tl:N \l__Endiagram_tmpa_fp } + \int_incr:N \l__endiagram_points_int } +\cs_generate_variant:Nn \__endiagram_save_points:nnnn { fx } +\cs_generate_variant:Nn \prop_put:Nnn { Nox } % --------------------------------------------------------------------------- % % show the energy levels -\int_new:N \l_ENdiagram_niveau_counter_int -\int_set:Nn \l_ENdiagram_niveau_counter_int { 1 } - -\tl_new:N \l_ENdiagram_niveau_tikz_tl - -\tl_new:N \l_ENdiagram_niveau_length_tl -\tl_set:Nn \l_ENdiagram_niveau_length_tl { 1 } - -\tl_new:N \l_ENdiagram_niveau_shift_tl -\tl_set:Nn \l_ENdiagram_niveau_shift_tl { 0 } - -\bool_new:N \l_ENdiagram_niveau_pick_bool -\clist_new:N \l_ENdiagram_niveau_clist +\int_new:N \l__endiagram_niveau_counter_int +\int_set:Nn \l__endiagram_niveau_counter_int { 1 } +\tl_new:N \l__endiagram_niveau_tikz_tl +\tl_new:N \l__endiagram_niveau_length_tl +\tl_set:Nn \l__endiagram_niveau_length_tl { 1 } +\tl_new:N \l__endiagram_niveau_shift_tl +\tl_set:Nn \l__endiagram_niveau_shift_tl { 0 } +\bool_new:N \l__endiagram_niveau_pick_bool +\clist_new:N \l__endiagram_niveau_clist \keys_define:nn { ENdiagram / ShowNiveaus } { - tikz .tl_set:N = \l_ENdiagram_niveau_tikz_tl , - length .tl_set:N = \l_ENdiagram_niveau_length_tl , - shift .tl_set:N = \l_ENdiagram_niveau_shift_tl , + tikz .tl_set:N = \l__endiagram_niveau_tikz_tl , + length .tl_set:N = \l__endiagram_niveau_length_tl , + shift .tl_set:N = \l__endiagram_niveau_shift_tl , niveau .code:n = { - \bool_set_true:N \l_ENdiagram_niveau_pick_bool - \clist_clear:N \l_ENdiagram_niveau_clist - \clist_set:Nn \l_ENdiagram_niveau_clist { #1 } + \bool_set_true:N \l__endiagram_niveau_pick_bool + \clist_clear:N \l__endiagram_niveau_clist + \clist_set:Nn \l__endiagram_niveau_clist { #1 } } } -\NewDocumentCommand \ENdiagram_show_niveaus:w { o } +\Endiagram_new_environment_command:Nnn \ShowNiveaus { o } { \group_begin: \IfNoValueF { #1 } { \keys_set:nn { ENdiagram / ShowNiveaus } { #1 } } - \bool_if:NTF \l_ENdiagram_niveau_pick_bool + \bool_if:NTF \l__endiagram_niveau_pick_bool { - \clist_map_inline:Nn \l_ENdiagram_niveau_clist + \clist_map_inline:Nn \l__endiagram_niveau_clist { - \ENdiagram_draw:xn { \l_ENdiagram_niveau_tikz_tl } + \endiagram_draw:xn + { \exp_not:V \l__endiagram_niveau_tikz_tl } { - (##1) ++ (\l_ENdiagram_niveau_shift_tl,0) - ++(-.5*\l_ENdiagram_niveau_length_tl,0) -- ++(\l_ENdiagram_niveau_length_tl,0) + (##1) ++ (\l__endiagram_niveau_shift_tl,0) + ++(-.5*\l__endiagram_niveau_length_tl,0) -- ++(\l__endiagram_niveau_length_tl,0) } } } { - \int_do_until:nn { \l_ENdiagram_niveau_counter_int > \g_ENdiagram_points_max_int } + \int_do_until:nn + { \l__endiagram_niveau_counter_int > \g__endiagram_points_max_int } { - \ENdiagram_draw:xn { \l_ENdiagram_niveau_tikz_tl } + \endiagram_draw:xn + { \exp_not:V \l__endiagram_niveau_tikz_tl } { ( N - \int_to_arabic:n { \g_ENdiagram_curve_int } + \int_to_arabic:n { \g__endiagram_curve_int } - - \int_to_arabic:n { \l_ENdiagram_niveau_counter_int } + \int_to_arabic:n { \l__endiagram_niveau_counter_int } ) - ++ (\l_ENdiagram_niveau_shift_tl,0) - ++(-.5*\l_ENdiagram_niveau_length_tl,0) -- ++(\l_ENdiagram_niveau_length_tl,0) + ++ (\l__endiagram_niveau_shift_tl,0) + ++(-.5*\l__endiagram_niveau_length_tl,0) -- ++(\l__endiagram_niveau_length_tl,0) } - \int_incr:N \l_ENdiagram_niveau_counter_int + \int_incr:N \l__endiagram_niveau_counter_int } } \group_end: @@ -345,169 +381,176 @@ % --------------------------------------------------------------------------- % % show the energy gain -\bool_new:N \l_ENdiagram_show_gain_right_bool -\bool_set_false:N \l_ENdiagram_show_gain_right_bool -\bool_new:N \l_ENdiagram_gain_label_bool -\bool_set_false:N \l_ENdiagram_gain_label_bool -\bool_new:N \l_ENdiagram_gain_own_label_bool -\bool_set_false:N \l_ENdiagram_gain_own_label_bool -\bool_new:N \l_ENdiagram_gain_connect_from_niveau_bool -\bool_set_false:N \l_ENdiagram_gain_connect_from_niveau_bool - -\tl_new:N \l_ENdiagram_gain_label_text_tl -\tl_new:N \l_ENdiagram_gain_label_side_tl -\tl_set:Nn \l_ENdiagram_gain_label_side_tl { right } -\tl_new:N \l_ENdiagram_gain_label_pos_tl -\tl_set:Nn \l_ENdiagram_gain_label_pos_tl { .5 } -\tl_new:N \l_ENdiagram_gain_label_tikz_tl -\tl_new:N \l_ENdiagram_gain_tikz_tl -\tl_set:Nn \l_ENdiagram_gain_tikz_tl { <-> } -\tl_new:N \l_ENdiagram_gain_connect_tikz_tl -\tl_set:Nn \l_ENdiagram_gain_connect_tikz_tl { dashed,help~lines } -\tl_new:N \l_ENdiagram_gain_x_value_tl -\tl_new:N \l_ENdiagram_gain_offset_tl -\tl_set:Nn \l_ENdiagram_gain_offset_tl { 0 } -\tl_new:N \g_ENdiagram_gain_offset_tl -\tl_gset:Nn \g_ENdiagram_gain_offset_tl { 0 } -\tl_new:N \l_ENdiagram_gain_value_tl +\bool_new:N \l__endiagram_show_gain_right_bool +\bool_new:N \l__endiagram_gain_label_bool +\bool_new:N \l__endiagram_gain_own_label_bool +\bool_new:N \l__endiagram_gain_connect_from_niveau_bool + +\tl_new:N \l__endiagram_gain_label_text_tl +\tl_new:N \l__endiagram_gain_label_side_tl +\tl_set:Nn \l__endiagram_gain_label_side_tl { right } +\tl_new:N \l__endiagram_gain_label_pos_tl +\tl_set:Nn \l__endiagram_gain_label_pos_tl { .5 } +\tl_new:N \l__endiagram_gain_label_tikz_tl +\tl_new:N \l__endiagram_gain_tikz_tl +\tl_set:Nn \l__endiagram_gain_tikz_tl { <-> } +\tl_new:N \l__endiagram_gain_connect_tikz_tl +\tl_set:Nn \l__endiagram_gain_connect_tikz_tl { dashed,help~lines } +\tl_new:N \l__endiagram_gain_x_value_tl +\tl_new:N \l__endiagram_gain_offset_tl +\tl_set:Nn \l__endiagram_gain_offset_tl { 0 } +\tl_new:N \g__endiagram_gain_offset_tl +\tl_gset:Nn \g__endiagram_gain_offset_tl { 0 } +\tl_new:N \l__endiagram_gain_value_tl \keys_define:nn { ENdiagram / ShowGain } { - tikz .tl_set:N = \l_ENdiagram_gain_tikz_tl , - connect .tl_set:N = \l_ENdiagram_gain_connect_tikz_tl , - connect-from-line .bool_set:N = \l_ENdiagram_gain_connect_from_niveau_bool , + tikz .tl_set:N = \l__endiagram_gain_tikz_tl , + connect .tl_set:N = \l__endiagram_gain_connect_tikz_tl , + connect-from-line .bool_set:N = \l__endiagram_gain_connect_from_niveau_bool , connect-from-line .default:n = true , - offset .tl_set:N = \l_ENdiagram_gain_offset_tl , + offset .tl_set:N = \l__endiagram_gain_offset_tl , label .code:n = { \tl_if_eq:nnTF { true } { #1 } - { \bool_set_true:N \l_ENdiagram_gain_label_bool } + { \bool_set_true:N \l__endiagram_gain_label_bool } { \tl_if_eq:nnF { false } { #1 } { - \bool_set_true:N \l_ENdiagram_gain_label_bool - \bool_set_true:N \l_ENdiagram_gain_own_label_bool - \tl_set:Nn \l_ENdiagram_gain_label_text_tl { #1 } + \bool_set_true:N \l__endiagram_gain_label_bool + \bool_set_true:N \l__endiagram_gain_own_label_bool + \tl_set:Nn \l__endiagram_gain_label_text_tl { #1 } } } } , label .default:n = true , label-side .choice: , label-side / right .code:n = - { \tl_set:Nn \l_ENdiagram_gain_label_side_tl { right } } , + { \tl_set:Nn \l__endiagram_gain_label_side_tl { right } } , label-side / left .code:n = - { \tl_set:Nn \l_ENdiagram_gain_label_side_tl { left } } , - label-pos .tl_set:N = \l_ENdiagram_gain_label_pos_tl , - label-tikz .tl_set:N = \l_ENdiagram_gain_label_tikz_tl + { \tl_set:Nn \l__endiagram_gain_label_side_tl { left } } , + label-pos .tl_set:N = \l__endiagram_gain_label_pos_tl , + label-tikz .tl_set:N = \l__endiagram_gain_label_tikz_tl } -\NewDocumentCommand \ENdiagram_show_gain:w { o } +\Endiagram_new_environment_command:Nnn \ShowGain { o } { - \bool_set_true:N \l_ENdiagram_show_gain_right_bool + \bool_set_true:N \l__endiagram_show_gain_right_bool \group_begin: \IfNoValueF { #1 } { \keys_set:nn { ENdiagram / ShowGain } { #1 } } - \fp_compare:nNnT { \g_ENdiagram_gain_offset_tl } < { \l_ENdiagram_gain_offset_tl } - { \tl_gset_eq:NN \g_ENdiagram_gain_offset_tl \l_ENdiagram_gain_offset_tl } - \tl_set:Nx \l_ENdiagram_gain_x_value_tl - { \int_to_arabic:n { \int_eval:n { \g_ENdiagram_points_max_int - 1} } } - \ENdiagram_draw:xn { \l_ENdiagram_gain_tikz_tl } + \fp_compare:nNnT { \g__endiagram_gain_offset_tl } < { \l__endiagram_gain_offset_tl } + { \tl_gset_eq:NN \g__endiagram_gain_offset_tl \l__endiagram_gain_offset_tl } + \tl_set:Nx \l__endiagram_gain_x_value_tl + { \int_to_arabic:n { \int_eval:n { \g__endiagram_points_max_int - 1} } } + \endiagram_draw:xn { \exp_not:V \l__endiagram_gain_tikz_tl } { - let \p1 = (N\int_to_arabic:n { \g_ENdiagram_curve_int }-1) , - \p2 = (N\int_to_arabic:n { \g_ENdiagram_curve_int }-\int_to_arabic:n { \g_ENdiagram_points_max_int }) + let \p1 = (N\int_to_arabic:n { \g__endiagram_curve_int }-1) , + \p2 = (N\int_to_arabic:n { \g__endiagram_curve_int }-\int_to_arabic:n { \g__endiagram_points_max_int }) in - ($\l_ENdiagram_points_step_tl*(\l_ENdiagram_gain_x_value_tl,0)+(\l_ENdiagram_gain_offset_tl+1,\y1)$) + ($\l__endiagram_points_step_tl*(\l__endiagram_gain_x_value_tl,0)+(\l__endiagram_gain_offset_tl+1,\y1)$) -- - ($\l_ENdiagram_points_step_tl*(\l_ENdiagram_gain_x_value_tl,0)+(\l_ENdiagram_gain_offset_tl+1,\y2)$) - node[pos=0,inner~sep=0] (gain-start\int_to_arabic:n { \g_ENdiagram_curve_int }) {} - node[pos=1,inner~sep=0] (gain-end\int_to_arabic:n { \g_ENdiagram_curve_int }) {} + ($\l__endiagram_points_step_tl*(\l__endiagram_gain_x_value_tl,0)+(\l__endiagram_gain_offset_tl+1,\y2)$) + node[pos=0,inner~sep=0] (gain-start\int_to_arabic:n { \g__endiagram_curve_int }) {} + node[pos=1,inner~sep=0] (gain-end\int_to_arabic:n { \g__endiagram_curve_int }) {} } - \fp_set:Nn \l_tmpa_tl - { \clist_item:Nn \l_ENdiagram_points_clist { 1 } } - \fp_set:Nn \l_tmpb_tl - { \clist_item:Nn \l_ENdiagram_points_clist { \g_ENdiagram_points_max_int } } -% \fp_sub:Nn \l_tmpb_tl { 1 } - \fp_set:Nn \l_tmpc_tl + \fp_set:Nn \l__Endiagram_tmpa_fp + { \clist_item:Nn \l__endiagram_points_clist { 1 } } + \fp_set:Nn \l__Endiagram_tmpb_fp + { \clist_item:Nn \l__endiagram_points_clist { \g__endiagram_points_max_int } } +% \fp_sub:Nn \l__Endiagram_tmpb_tl { 1 } + \fp_set:Nn \l__Endiagram_tmpc_fp { - \l_ENdiagram_gain_x_value_tl * \l_ENdiagram_points_step_tl - + \l_ENdiagram_gain_offset_tl + 1 + \l__endiagram_gain_x_value_tl * \l__endiagram_points_step_tl + + \l__endiagram_gain_offset_tl + 1 } - \bool_if:NT \l_ENdiagram_debug_bool + \bool_if:NT \l__endiagram_debug_bool { - \ENdiagram_draw:nn {font=\tiny,inner~sep=0} + \endiagram_draw:nn {font=\tiny,inner~sep=0} { - let \p1 = ( gain-start\int_to_arabic:n { \g_ENdiagram_curve_int } ) , - \p2 = ( gain-end\int_to_arabic:n { \g_ENdiagram_curve_int } ) + let \p1 = ( gain-start\int_to_arabic:n { \g__endiagram_curve_int } ) , + \p2 = ( gain-end\int_to_arabic:n { \g__endiagram_curve_int } ) in node[right=2pt,fill=yellow!10] at ( \p1 ) - { gain-start\int_to_arabic:n { \g_ENdiagram_curve_int } } + { gain-start\int_to_arabic:n { \g__endiagram_curve_int } } node[right=2pt,fill=yellow!10] at ( \p2 ) - { gain-end\int_to_arabic:n { \g_ENdiagram_curve_int } } - node[above~right,red] at (\p1) {(\fp_to_tl:N \l_tmpc_tl,\fp_to_tl:N \l_tmpa_tl)} - node[above~right,red] at (\p2) {(\fp_to_tl:N \l_tmpc_tl,\fp_to_tl:N \l_tmpb_tl)} + { gain-end\int_to_arabic:n { \g__endiagram_curve_int } } + node[above~right,red] + at (\p1) + {(\fp_to_tl:N \l__Endiagram_tmpc_fp,\fp_to_tl:N \l__Endiagram_tmpa_fp)} + node[above~right,red] + at (\p2) + {(\fp_to_tl:N \l__Endiagram_tmpc_fp,\fp_to_tl:N \l__Endiagram_tmpb_fp)} } } - \bool_if:NT \l_ENdiagram_gain_label_bool + \bool_if:NT \l__endiagram_gain_label_bool { - \bool_if:NF \l_ENdiagram_gain_own_label_bool + \bool_if:NF \l__endiagram_gain_own_label_bool { \bool_if:nTF - { \l_ENdiagram_energy_unit_bool && \l_ENdiagram_calculate_bool } + { \l__endiagram_energy_unit_bool && \l__endiagram_calculate_bool } { - \fp_set:Nn \l_tmpb_fp { (\l_tmpb_tl - \l_tmpa_tl) * \l_ENdiagram_energy_step_tl } - \bool_if:NTF \l_ENdiagram_energy_round_places_bool + \fp_set:Nn \l__Endiagram_tmpb_fp + { (\l__Endiagram_tmpb_fp - \l__Endiagram_tmpa_fp) * \l__endiagram_energy_step_tl } + \bool_if:NTF \l__endiagram_energy_round_places_bool { - \fp_round_places:Nn \l_tmpb_fp - { \l_ENdiagram_energy_round_tl } + \fp_round_places:Nn \l__Endiagram_tmpb_fp + { \l__endiagram_energy_round_tl } } { - \fp_round_figures:Nn \l_tmpb_fp - { \l_ENdiagram_energy_round_tl } + \fp_round_figures:Nn \l__Endiagram_tmpb_fp + { \l__endiagram_energy_round_tl } } - \tl_set:Nn \l_ENdiagram_gain_value_tl + \tl_set:Nn \l__endiagram_gain_value_tl { = \exp_args:Noo \SI - { \fp_to_tl:N \l_tmpb_fp } - { \l_ENdiagram_energy_unit_tl } + { \fp_to_tl:N \l__Endiagram_tmpb_fp } + { \l__endiagram_energy_unit_tl } } } { - \fp_compare:nNnTF { \l_tmpa_tl } > { \l_tmpb_tl } - { \tl_set:Nn \l_ENdiagram_gain_value_tl { < 0 } } - { \tl_set:Nn \l_ENdiagram_gain_value_tl { > 0 } } + \fp_compare:nNnTF { \l__Endiagram_tmpa_fp } > { \l__Endiagram_tmpb_fp } + { \tl_set:Nn \l__endiagram_gain_value_tl { < 0 } } + { \tl_set:Nn \l__endiagram_gain_value_tl { > 0 } } } - \tl_set:Nn \l_ENdiagram_gain_label_text_tl { $\Delta H \l_ENdiagram_gain_value_tl$ } + \tl_set:Nn \l__endiagram_gain_label_text_tl { $\Delta H \l__endiagram_gain_value_tl$ } } - \ENdiagram_draw:nx {} + \endiagram_draw:nx {} { ($ - (gain-end\int_to_arabic:n { \g_ENdiagram_curve_int }) - !\l_ENdiagram_gain_label_pos_tl! - (gain-start\int_to_arabic:n { \g_ENdiagram_curve_int })$) - node[\l_ENdiagram_gain_label_side_tl,\l_ENdiagram_gain_label_tikz_tl] - { \exp_not:N \l_ENdiagram_gain_label_text_tl } + (gain-end\int_to_arabic:n { \g__endiagram_curve_int }) + !\l__endiagram_gain_label_pos_tl! + (gain-start\int_to_arabic:n { \g__endiagram_curve_int })$) + node + [ + \l__endiagram_gain_label_side_tl , + \exp_not:V \l__endiagram_gain_label_tikz_tl + ] + { \exp_not:V \l__endiagram_gain_label_text_tl } } } - \bool_if:NTF \l_ENdiagram_gain_connect_from_niveau_bool + \bool_if:NTF \l__endiagram_gain_connect_from_niveau_bool { - \ENdiagram_draw:xf { \l_ENdiagram_gain_connect_tikz_tl } - { - let \p1 = (N\int_to_arabic:n { \g_ENdiagram_curve_int }-1) , - \p2 = (N\int_to_arabic:n { \g_ENdiagram_curve_int }-\int_to_arabic:n { \g_ENdiagram_points_max_int }) + \endiagram_draw:xf + { \exp_not:V \l__endiagram_gain_connect_tikz_tl } + { + let \p1 = (N\int_to_arabic:n { \g__endiagram_curve_int }-1) , + \p2 = (N\int_to_arabic:n { \g__endiagram_curve_int }-\int_to_arabic:n { \g__endiagram_points_max_int }) in - (gain-end\int_to_arabic:n { \g_ENdiagram_curve_int }) ++ (.5,0) -- ($(\p2)+(.5*\l_ENdiagram_niveau_length_tl,0)$) - (gain-start\int_to_arabic:n { \g_ENdiagram_curve_int }) ++ (.5,0) -- ($(\p1)+(.5*\l_ENdiagram_niveau_length_tl,0)$) + (gain-end\int_to_arabic:n { \g__endiagram_curve_int }) ++ (.5,0) -- ($(\p2)+(.5*\l__endiagram_niveau_length_tl,0)$) + (gain-start\int_to_arabic:n { \g__endiagram_curve_int }) ++ (.5,0) -- ($(\p1)+(.5*\l__endiagram_niveau_length_tl,0)$) } } { - \ENdiagram_draw:xf { \l_ENdiagram_gain_connect_tikz_tl } + \endiagram_draw:xf + { \exp_not:V \l__endiagram_gain_connect_tikz_tl } { - let \p1 = (N\int_to_arabic:n { \g_ENdiagram_curve_int }-1) , - \p2 = (N\int_to_arabic:n { \g_ENdiagram_curve_int }-\int_to_arabic:n { \g_ENdiagram_points_max_int }) + let \p1 = (N\int_to_arabic:n { \g__endiagram_curve_int }-1) , + \p2 = (N\int_to_arabic:n { \g__endiagram_curve_int }-\int_to_arabic:n { \g__endiagram_points_max_int }) in - (gain-end\int_to_arabic:n { \g_ENdiagram_curve_int }) ++ (.5,0) -- (\p2) - (gain-start\int_to_arabic:n { \g_ENdiagram_curve_int }) ++ (.5,0) -- (\p1) + (gain-end\int_to_arabic:n { \g__endiagram_curve_int }) ++ (.5,0) -- (\p2) + (gain-start\int_to_arabic:n { \g__endiagram_curve_int }) ++ (.5,0) -- (\p1) } } \group_end: @@ -515,192 +558,198 @@ % --------------------------------------------------------------------------- % % show the activation energy -\bool_new:N \l_ENdiagram_ea_all_bool -\bool_new:N \l_ENdiagram_ea_coordinates_bool -\bool_new:N \l_ENdiagram_ea_coordinates_points_bool -\bool_new:N \l_ENdiagram_ea_label_bool -\bool_new:N \l_ENdiagram_ea_own_label_bool - -\int_new:N \g_ENdiagram_ea_int -\int_gzero:N \g_ENdiagram_ea_int -\int_new:N \l_ENdiagram_ea_count_int -\int_zero:N \l_ENdiagram_ea_count_int - -\tl_new:N \l_ENdiagram_ea_tikz_tl -\tl_set:Nn \l_ENdiagram_ea_tikz_tl { <-> } -\tl_new:N \l_ENdiagram_ea_connect_tikz_tl -\tl_set:Nn \l_ENdiagram_ea_connect_tikz_tl { dashed, help~lines } -\tl_new:N \l_ENdiagram_ea_label_text_tl -\tl_set_rescan:Nnn \l_ENdiagram_ea_label_text_tl +\bool_new:N \l__endiagram_ea_all_bool +\bool_new:N \l__endiagram_ea_coordinates_bool +\bool_new:N \l__endiagram_ea_coordinates_points_bool +\bool_new:N \l__endiagram_ea_label_bool +\bool_new:N \l__endiagram_ea_own_label_bool + +\int_new:N \g__endiagram_ea_int +\int_gzero:N \g__endiagram_ea_int +\int_new:N \l__endiagram_ea_count_int +\int_zero:N \l__endiagram_ea_count_int + +\tl_new:N \l__endiagram_ea_tikz_tl +\tl_set:Nn \l__endiagram_ea_tikz_tl { <-> } +\tl_new:N \l__endiagram_ea_connect_tikz_tl +\tl_set:Nn \l__endiagram_ea_connect_tikz_tl { dashed, help~lines } +\tl_new:N \l__endiagram_ea_label_text_tl +\tl_set_rescan:Nnn \l__endiagram_ea_label_text_tl { \char_set_catcode_math_subscript:N \_ } { $E_{\mathrm{a}}$ } -\tl_new:N \l_ENdiagram_ea_value_tl -\tl_new:N \l_ENdiagram_ea_label_tikz_tl -\tl_new:N \l_ENdiagram_ea_label_side_tl -\tl_set:Nn \l_ENdiagram_ea_label_side_tl { right } -\tl_new:N \l_ENdiagram_ea_label_pos_tl -\tl_set:Nn \l_ENdiagram_ea_label_pos_tl { .5} -\tl_new:N \l_ENdiagram_ea_start_node_tl -\tl_new:N \l_ENdiagram_ea_end_node_tl - -\fp_new:N \l_ENdiagram_ea_connect_start_fp -\fp_new:N \l_ENdiagram_ea_connect_end_fp +\tl_new:N \l__endiagram_ea_value_tl +\tl_new:N \l__endiagram_ea_label_tikz_tl +\tl_new:N \l__endiagram_ea_label_side_tl +\tl_set:Nn \l__endiagram_ea_label_side_tl { right } +\tl_new:N \l__endiagram_ea_label_pos_tl +\tl_set:Nn \l__endiagram_ea_label_pos_tl { .5} +\tl_new:N \l__endiagram_ea_start_node_tl +\tl_new:N \l__endiagram_ea_end_node_tl + +\fp_new:N \l__endiagram_ea_connect_start_fp +\fp_new:N \l__endiagram_ea_connect_end_fp \keys_define:nn { ENdiagram / ShowEa } { max .choice: , - max / all .code:n = \bool_set_true:N \l_ENdiagram_ea_all_bool , - max / first .code:n = \bool_set_false:N \l_ENdiagram_ea_all_bool , - tikz .tl_set:N = \l_ENdiagram_ea_tikz_tl , - connect .tl_set:N = \l_ENdiagram_ea_connect_tikz_tl , + max / all .code:n = \bool_set_true:N \l__endiagram_ea_all_bool , + max / first .code:n = \bool_set_false:N \l__endiagram_ea_all_bool , + tikz .tl_set:N = \l__endiagram_ea_tikz_tl , + connect .tl_set:N = \l__endiagram_ea_connect_tikz_tl , from .code:n = { - \bool_set_true:N \l_ENdiagram_ea_coordinates_bool - \ENdiagram_detect_ea:n { #1 } + \bool_set_true:N \l__endiagram_ea_coordinates_bool + \__endiagram_detect_ea:n { #1 } } , label .code:n = { \tl_if_eq:nnTF { true } { #1 } - { \bool_set_true:N \l_ENdiagram_ea_label_bool } + { \bool_set_true:N \l__endiagram_ea_label_bool } { \tl_if_eq:nnF { false } { #1 } { - \bool_set_true:N \l_ENdiagram_ea_own_label_bool - \bool_set_true:N \l_ENdiagram_ea_label_bool - \tl_set:Nn \l_ENdiagram_ea_label_text_tl { #1 } + \bool_set_true:N \l__endiagram_ea_own_label_bool + \bool_set_true:N \l__endiagram_ea_label_bool + \tl_set:Nn \l__endiagram_ea_label_text_tl { #1 } } } } , label .default:n = true , label-side .choice: , label-side / right .code:n = - { \tl_set:Nn \l_ENdiagram_ea_label_side_tl { right } } , + { \tl_set:Nn \l__endiagram_ea_label_side_tl { right } } , label-side / left .code:n = - { \tl_set:Nn \l_ENdiagram_ea_label_side_tl { left } } , - label-pos .tl_set:N = \l_ENdiagram_ea_label_pos_tl , - label-tikz .tl_set:N = \l_ENdiagram_ea_label_tikz_tl + { \tl_set:Nn \l__endiagram_ea_label_side_tl { left } } , + label-pos .tl_set:N = \l__endiagram_ea_label_pos_tl , + label-tikz .tl_set:N = \l__endiagram_ea_label_tikz_tl } -\cs_new_nopar:Npn \ENdiagram_detect_ea:n #1 +\cs_new_protected:Npn \__endiagram_detect_ea:n #1 { % remember blanks - \tl_set:Nn \l_tmpa_tl { #1 } - \tl_replace_all:Nnn \l_tmpa_tl { ~ } { @@@ } - \exp_after:wN \ENdiagram_detect_ea_auxi:nn \l_tmpa_tl \q_nil + \tl_set:Nn \l__Endiagram_tmpa_tl { #1 } + \tl_replace_all:Nnn \l__Endiagram_tmpa_tl { ~ } { @@@ } + \exp_after:wN \__endiagram_detect_ea_auxi:nn \l__Endiagram_tmpa_tl \q_nil } -\cs_new_nopar:Npn \ENdiagram_detect_ea_auxi:nn (#1) #2 \q_nil +\cs_new_protected:Npn \__endiagram_detect_ea_auxi:nn (#1) #2 \q_nil { % recover blanks in node #1 - \tl_set:Nn \l_tmpa_tl { #1 } - \tl_replace_all:Nnn \l_tmpa_tl { @@@ } { ~ } - \tl_set_eq:NN \l_ENdiagram_ea_start_node_tl \l_tmpa_tl - \ENdiagram_detect_ea_auxii:nn #2 + \tl_set:Nn \l__Endiagram_tmpa_tl { #1 } + \tl_replace_all:Nnn \l__Endiagram_tmpa_tl { @@@ } { ~ } + \tl_set_eq:NN \l__endiagram_ea_start_node_tl \l__Endiagram_tmpa_tl + \__endiagram_detect_ea_auxii:nn #2 } -\cs_new_nopar:Npn \ENdiagram_detect_ea_auxii:nn #1 (#2) +\cs_new_protected:Npn \__endiagram_detect_ea_auxii:nn #1 (#2) { % recover blanks in node #2 - \tl_set:Nn \l_tmpa_tl { #2 } - \tl_set:Nn \l_tmpb_tl { #1 } - \tl_replace_all:Nnn \l_tmpa_tl { @@@ } { ~ } - \tl_set_eq:NN \l_ENdiagram_ea_end_node_tl \l_tmpa_tl + \tl_set:Nn \l__Endiagram_tmpa_tl { #2 } + \tl_set:Nn \l__Endiagram_tmpb_tl { #1 } + \tl_replace_all:Nnn \l__Endiagram_tmpa_tl { @@@ } { ~ } + \tl_set_eq:NN \l__endiagram_ea_end_node_tl \l__Endiagram_tmpa_tl % ignore blanks in between and test for right syntax - \tl_remove_all:Nn \l_tmpb_tl { @@@ } - \exp_args:No \tl_if_eq:nnF { \l_tmpb_tl } { to } + \tl_remove_all:Nn \l__Endiagram_tmpb_tl { @@@ } + \tl_if_eq:VnF \l__Endiagram_tmpb_tl { to } { \msg_error:nn { ENdiagram } { ShowEa } } - } +\cs_generate_variant:Nn \tl_if_eq:nnF { V } -\NewDocumentCommand \ENdiagram_show_ea:w { o } +\Endiagram_new_environment_command:Nnn \ShowEa { o } { - \int_gincr:N \g_ENdiagram_ea_int + \int_gincr:N \g__endiagram_ea_int \group_begin: \IfNoValueF { #1 } { \keys_set:nn { ENdiagram / ShowEa } { #1 } } - \bool_if:NTF \l_ENdiagram_ea_coordinates_bool + \bool_if:NTF \l__endiagram_ea_coordinates_bool { - \ENdiagram_draw:xn { \l_ENdiagram_ea_tikz_tl } + \endiagram_draw:xn + { \exp_not:V \l__endiagram_ea_tikz_tl } { - ( \l_ENdiagram_ea_end_node_tl |- \l_ENdiagram_ea_start_node_tl ) + ( \l__endiagram_ea_end_node_tl |- \l__endiagram_ea_start_node_tl ) -- - ( \l_ENdiagram_ea_end_node_tl ) + ( \l__endiagram_ea_end_node_tl ) } - \bool_if:NT \l_ENdiagram_ea_label_bool + \bool_if:NT \l__endiagram_ea_label_bool { \bool_if:nT { - \l_ENdiagram_energy_unit_bool && - \l_ENdiagram_calculate_bool && - !\l_ENdiagram_ea_own_label_bool + \l__endiagram_energy_unit_bool && + \l__endiagram_calculate_bool && + !\l__endiagram_ea_own_label_bool } { % determine length of Ea-line - \ENdiagram_draw:nn { } + \endiagram_draw:nn { } { - let \p1 = (\l_ENdiagram_ea_start_node_tl), - \p2 = (\l_ENdiagram_ea_end_node_tl) + let \p1 = (\l__endiagram_ea_start_node_tl), + \p2 = (\l__endiagram_ea_end_node_tl) in - node at (\p2) { \dim_gset:Nn \g_tmpa_dim { \y2 - \y1 } } + node at (\p2) { \dim_gset:Nn \g__Endiagram_tmpa_dim { \y2 - \y1 } } } % convert length of Ea-line into energy value - \fp_set:Nn \l_tmpb_fp { \dim_to_fp:Nn { 1cm } } - \fp_set:Nn \l_tmpa_fp - { \dim_to_fp:n { \g_tmpa_dim } / \l_tmpb_fp * \l_ENdiagram_energy_step_tl } - \bool_if:NTF \l_ENdiagram_energy_round_places_bool + \fp_set:Nn \l__Endiagram_tmpb_fp { \dim_to_fp:Nn { 1cm } } + \fp_set:Nn \l__Endiagram_tmpa_fp + { + \dim_to_fp:n { \g__Endiagram_tmpa_dim } / + \l__Endiagram_tmpb_fp * + \l__endiagram_energy_step_tl + } + \bool_if:NTF \l__endiagram_energy_round_places_bool { - \fp_round_places:Nn \l_tmpa_fp - { \l_ENdiagram_energy_round_tl } + \fp_round_places:Nn \l__Endiagram_tmpa_fp + { \l__endiagram_energy_round_tl } } { - \fp_round_figures:Nn \l_tmpa_fp - { \l_ENdiagram_energy_round_tl } + \fp_round_figures:Nn \l__Endiagram_tmpa_fp + { \l__endiagram_energy_round_tl } } - \tl_set:Nn \l_ENdiagram_ea_value_tl + \tl_set:Nn \l__endiagram_ea_value_tl { ~ = ~ \exp_args:Noo \SI - { \fp_to_tl:N \l_tmpa_fp } - { \l_ENdiagram_energy_unit_tl } + { \fp_to_tl:N \l__Endiagram_tmpa_fp } + { \l__endiagram_energy_unit_tl } } } - \ENdiagram_draw:xn - { \l_ENdiagram_ea_label_tikz_tl } + \endiagram_draw:xn + { \exp_not:V \l__endiagram_ea_label_tikz_tl } { - node[\l_ENdiagram_ea_label_side_tl] at + node[\l__endiagram_ea_label_side_tl] at ($ - (\l_ENdiagram_ea_end_node_tl) - !\l_ENdiagram_ea_label_pos_tl! - (\l_ENdiagram_ea_end_node_tl |- \l_ENdiagram_ea_start_node_tl) + (\l__endiagram_ea_end_node_tl) + !\l__endiagram_ea_label_pos_tl! + (\l__endiagram_ea_end_node_tl |- \l__endiagram_ea_start_node_tl) $) - { \l_ENdiagram_ea_label_text_tl \l_ENdiagram_ea_value_tl } + { \l__endiagram_ea_label_text_tl \l__endiagram_ea_value_tl } } } - \ENdiagram_draw:xn { \l_ENdiagram_ea_connect_tikz_tl } + \endiagram_draw:xn + { \exp_not:V \l__endiagram_ea_connect_tikz_tl } { - ( \l_ENdiagram_ea_start_node_tl ) + ( \l__endiagram_ea_start_node_tl ) -- - ( \l_ENdiagram_ea_end_node_tl |- \l_ENdiagram_ea_start_node_tl ) + ( \l__endiagram_ea_end_node_tl |- \l__endiagram_ea_start_node_tl ) node ( ea-end - \int_to_arabic:n { \g_ENdiagram_curve_int }- - \int_to_arabic:n { \g_ENdiagram_ea_int }- + \int_to_arabic:n { \g__endiagram_curve_int }- + \int_to_arabic:n { \g__endiagram_ea_int }- 0 ) {} } - \bool_if:NT \l_ENdiagram_debug_bool + \bool_if:NT \l__endiagram_debug_bool { - \ENdiagram_draw:nn { inner~sep=0,font=\tiny } + \endiagram_draw:nn { inner~sep=0,font=\tiny } { ( ea-end - \int_to_arabic:n { \g_ENdiagram_curve_int }- - \int_to_arabic:n { \g_ENdiagram_ea_int }- + \int_to_arabic:n { \g__endiagram_curve_int }- + \int_to_arabic:n { \g__endiagram_ea_int }- 0 ) node[below~right,fill=yellow!10] { ea-end - \int_to_arabic:n { \g_ENdiagram_curve_int }- - \int_to_arabic:n { \g_ENdiagram_ea_int }- + \int_to_arabic:n { \g__endiagram_curve_int }- + \int_to_arabic:n { \g__endiagram_ea_int }- 0 } } @@ -708,467 +757,530 @@ } { \int_do_until:nn - { \l_ENdiagram_ea_count_int >= \g_ENdiagram_points_max_int - 1 } + { \l__endiagram_ea_count_int >= \g__endiagram_points_max_int - 1 } { - \fp_set:Nn \l_tmpa_tl + \fp_set:Nn \l__Endiagram_tmpa_fp { - \clist_item:Nn \l_ENdiagram_points_clist - { \int_eval:n { \l_ENdiagram_ea_count_int + 1 } } + \clist_item:Nn \l__endiagram_points_clist + { \int_eval:n { \l__endiagram_ea_count_int + 1 } } } - \fp_set:Nn \l_tmpb_tl + \fp_set:Nn \l__Endiagram_tmpb_fp { - \clist_item:Nn \l_ENdiagram_points_clist - { \int_eval:n { \l_ENdiagram_ea_count_int + 2 } } + \clist_item:Nn \l__endiagram_points_clist + { \int_eval:n { \l__endiagram_ea_count_int + 2 } } } - \fp_compare:nNnT { \l_tmpa_tl } < { \l_tmpb_tl } + \fp_compare:nNnT { \l__Endiagram_tmpa_fp } < { \l__Endiagram_tmpb_fp } { - \exp_args:NNf \prop_get:NnN \l_ENdiagram_points_prop - { \int_eval:n { \l_ENdiagram_ea_count_int + 1 } } \l_tmpc_tl - \fp_set:Nn \l_ENdiagram_ea_connect_end_fp { \l_tmpc_tl } - \exp_args:NNf \prop_get:NnN \l_ENdiagram_points_prop - { \int_eval:n { \l_ENdiagram_ea_count_int } } \l_tmpc_tl - \fp_set:Nn \l_ENdiagram_ea_connect_start_fp { \l_tmpc_tl } - \ENdiagram_draw:xn { \l_ENdiagram_ea_tikz_tl } + \prop_get:NfN \l__endiagram_points_prop + { \int_eval:n { \l__endiagram_ea_count_int + 1 } } \l__Endiagram_tmpc_tl + \fp_set:Nn \l__endiagram_ea_connect_end_fp { \l__Endiagram_tmpc_tl } + \prop_get:NfN \l__endiagram_points_prop + { \int_eval:n { \l__endiagram_ea_count_int } } \l__Endiagram_tmpc_tl + \fp_set:Nn \l__endiagram_ea_connect_start_fp { \l__Endiagram_tmpc_tl } + \endiagram_draw:xn + { \exp_not:V \l__endiagram_ea_tikz_tl } { - ( \fp_to_tl:N \l_ENdiagram_ea_connect_end_fp , \fp_to_tl:N \l_tmpa_tl ) + ( \fp_to_tl:N \l__endiagram_ea_connect_end_fp , \fp_to_tl:N \l__Endiagram_tmpa_fp ) node ( ea-end - \int_to_arabic:n { \g_ENdiagram_curve_int }- - \int_to_arabic:n { \g_ENdiagram_ea_int }- - \int_to_arabic:n { \l_ENdiagram_ea_count_int } + \int_to_arabic:n { \g__endiagram_curve_int }- + \int_to_arabic:n { \g__endiagram_ea_int }- + \int_to_arabic:n { \l__endiagram_ea_count_int } ) { } -- - ( \fp_to_tl:N \l_ENdiagram_ea_connect_end_fp , \fp_to_tl:N \l_tmpb_tl ) + ( \fp_to_tl:N \l__endiagram_ea_connect_end_fp , \fp_to_tl:N \l__Endiagram_tmpb_fp ) } - \bool_if:NT \l_ENdiagram_ea_label_bool + \bool_if:NT \l__endiagram_ea_label_bool { \bool_if:nT { - \l_ENdiagram_energy_unit_bool && - \l_ENdiagram_calculate_bool && - !\l_ENdiagram_ea_own_label_bool + \l__endiagram_energy_unit_bool && + \l__endiagram_calculate_bool && + !\l__endiagram_ea_own_label_bool } { - \fp_set:Nn \l_tmpb_fp { \l_tmpb_tl } - \fp_sub:Nn \l_tmpb_fp { \l_tmpa_tl } - \fp_mul:Nn \l_tmpb_fp { \l_ENdiagram_energy_step_tl } - \tl_set:Nn \l_ENdiagram_ea_value_tl + \fp_set:Nn \l__Endiagram_tmpb_fp + { + ( \l__Endiagram_tmpb_fp - \l__Endiagram_tmpa_fp ) * + \l__endiagram_energy_step_tl + } + \tl_set:Nn \l__endiagram_ea_value_tl { ~ = ~ \exp_args:Noo \SI - { \fp_to_tl:N \l_tmpb_fp } - { \l_ENdiagram_energy_unit_tl } + { \fp_to_tl:N \l__Endiagram_tmpb_fp } + { \l__endiagram_energy_unit_tl } } } - \ENdiagram_draw:xn { \l_ENdiagram_ea_label_tikz_tl } + \endiagram_draw:xn + { \exp_not:V \l__endiagram_ea_label_tikz_tl } { - node[\l_ENdiagram_ea_label_side_tl] at + node[\l__endiagram_ea_label_side_tl] at ($ - ( \fp_to_tl:N \l_ENdiagram_ea_connect_end_fp , \fp_to_tl:N \l_tmpa_tl ) - !\l_ENdiagram_ea_label_pos_tl! - ( \fp_to_tl:N \l_ENdiagram_ea_connect_end_fp , \fp_to_tl:N \l_tmpb_tl ) + ( \fp_to_tl:N \l__endiagram_ea_connect_end_fp , \fp_to_tl:N \l__Endiagram_tmpa_fp ) + !\l__endiagram_ea_label_pos_tl! + ( \fp_to_tl:N \l__endiagram_ea_connect_end_fp , \fp_to_tl:N \l__Endiagram_tmpb_fp ) $) - { \l_ENdiagram_ea_label_text_tl \l_ENdiagram_ea_value_tl } + { \l__endiagram_ea_label_text_tl \l__endiagram_ea_value_tl } } } - \ENdiagram_draw:xn { \l_ENdiagram_ea_connect_tikz_tl } + \endiagram_draw:xn + { \exp_not:V \l__endiagram_ea_connect_tikz_tl } { - ( \fp_to_tl:N \l_ENdiagram_ea_connect_end_fp , \fp_to_tl:N \l_tmpa_tl ) + ( \fp_to_tl:N \l__endiagram_ea_connect_end_fp , \fp_to_tl:N \l__Endiagram_tmpa_fp ) -- ++ ( - \fp_to_tl:N \l_ENdiagram_ea_connect_start_fp + \fp_to_tl:N \l__endiagram_ea_connect_start_fp - - \fp_to_tl:N \l_ENdiagram_ea_connect_end_fp , 0 + \fp_to_tl:N \l__endiagram_ea_connect_end_fp , 0 ) } - \bool_if:NT \l_ENdiagram_debug_bool + \bool_if:NT \l__endiagram_debug_bool { - \ENdiagram_draw:nn { inner~sep=0,font=\tiny } + \endiagram_draw:nn + { inner~sep=0,font=\tiny } { ( ea-end - \int_to_arabic:n { \g_ENdiagram_curve_int }- - \int_to_arabic:n { \g_ENdiagram_ea_int }- - \int_to_arabic:n { \l_ENdiagram_ea_count_int } + \int_to_arabic:n { \g__endiagram_curve_int }- + \int_to_arabic:n { \g__endiagram_ea_int }- + \int_to_arabic:n { \l__endiagram_ea_count_int } ) node[below~right,fill=yellow!10] { ea-end - \int_to_arabic:n { \g_ENdiagram_curve_int }- - \int_to_arabic:n { \g_ENdiagram_ea_int }- - \int_to_arabic:n { \l_ENdiagram_ea_count_int } + \int_to_arabic:n { \g__endiagram_curve_int }- + \int_to_arabic:n { \g__endiagram_ea_int }- + \int_to_arabic:n { \l__endiagram_ea_count_int } } node[above~right,red] - { ( \fp_to_tl:N \l_ENdiagram_ea_connect_end_fp , \fp_to_tl:N \l_tmpa_tl ) } + { ( \fp_to_tl:N \l__endiagram_ea_connect_end_fp , \fp_to_tl:N \l__Endiagram_tmpa_fp ) } } } - \bool_if:NF \l_ENdiagram_ea_all_bool + \bool_if:NF \l__endiagram_ea_all_bool { % set count unreasonably high to ensure we're over - % \g_ENdiagram_points_max_int - \int_add:Nn \l_ENdiagram_ea_count_int { 1000 } + % \g__endiagram_points_max_int + \int_add:Nn \l__endiagram_ea_count_int { 1000 } } } - \int_incr:N \l_ENdiagram_ea_count_int + \int_incr:N \l__endiagram_ea_count_int } } \group_end: } +\cs_generate_variant:Nn \prop_get:NnN { Nf , Nx } % --------------------------------------------------------------------------- % % add axis labels -\bool_new:N \l_ENdiagram_add_axis_yl_bool -\bool_set_true:N \l_ENdiagram_add_axis_yl_bool -\bool_new:N \l_ENdiagram_add_axis_yr_bool -\bool_new:N \l_ENdiagram_add_axis_x_bool +\bool_new:N \l__endiagram_add_axis_yl_bool +\bool_set_true:N \l__endiagram_add_axis_yl_bool +\bool_new:N \l__endiagram_add_axis_yr_bool +\bool_new:N \l__endiagram_add_axis_x_bool -\tl_new:N \l_ENdiagram_add_axis_connect_tl -\tl_set:Nn \l_ENdiagram_add_axis_connect_tl { dashed,help~lines } -\tl_new:N \l_ENdiagram_add_axis_font_tl +\tl_new:N \l__endiagram_add_axis_connect_tl +\tl_set:Nn \l__endiagram_add_axis_connect_tl { dashed,help~lines } +\tl_new:N \l__endiagram_add_axis_font_tl \keys_define:nn { ENdiagram / AddAxisLabel } { axis .choice: , axis / y-l .code:n = { - \bool_set_true:N \l_ENdiagram_add_axis_yl_bool - \bool_set_false:N \l_ENdiagram_add_axis_yr_bool - \bool_set_false:N \l_ENdiagram_add_axis_x_bool + \bool_set_true:N \l__endiagram_add_axis_yl_bool + \bool_set_false:N \l__endiagram_add_axis_yr_bool + \bool_set_false:N \l__endiagram_add_axis_x_bool } , axis / y-r .code:n = { - \bool_set_false:N \l_ENdiagram_add_axis_yl_bool - \bool_set_true:N \l_ENdiagram_add_axis_yr_bool - \bool_set_false:N \l_ENdiagram_add_axis_x_bool + \bool_set_false:N \l__endiagram_add_axis_yl_bool + \bool_set_true:N \l__endiagram_add_axis_yr_bool + \bool_set_false:N \l__endiagram_add_axis_x_bool } , axis / x .code:n = { - \bool_set_false:N \l_ENdiagram_add_axis_yl_bool - \bool_set_false:N \l_ENdiagram_add_axis_yr_bool - \bool_set_true:N \l_ENdiagram_add_axis_x_bool + \bool_set_false:N \l__endiagram_add_axis_yl_bool + \bool_set_false:N \l__endiagram_add_axis_yr_bool + \bool_set_true:N \l__endiagram_add_axis_x_bool } , - connect .tl_set:N = \l_ENdiagram_add_axis_connect_tl , - font .tl_set:N = \l_ENdiagram_add_axis_font_tl + connect .tl_set:N = \l__endiagram_add_axis_connect_tl , + font .tl_set:N = \l__endiagram_add_axis_font_tl } -\NewDocumentCommand \ENdiagram_add_axis_label:w { so > { \SplitList { ; } } m } +\Endiagram_new_environment_command:Nnn \AddAxisLabel { so > { \SplitList { ; } } m } { - \ENdiagram_make_origin: + \MakeOrigin \group_begin: - \tl_clear:N \l_tmpa_tl - \tl_clear:N \l_tmpb_tl - \tl_clear:N \l_tmpc_tl + \tl_clear:N \l__Endiagram_tmpa_tl + \tl_clear:N \l__Endiagram_tmpb_tl + \tl_clear:N \l__Endiagram_tmpc_tl \IfNoValueF { #2 } { \keys_set:nn { ENdiagram / AddAxisLabel } { #2 } } \IfBooleanTF { #1 } { % list of "ticks" - \bool_if:NT \l_ENdiagram_add_axis_yl_bool - { \ENdiagram_add_axis_label_yl_ticks:n { #3 } } - \bool_if:NT \l_ENdiagram_add_axis_yr_bool - { \ENdiagram_add_axis_label_yr_ticks:n { #3 } } - \bool_if:NT \l_ENdiagram_add_axis_x_bool - { \ENdiagram_add_axis_label_x_ticks:n { #3 } } + \bool_if:NT \l__endiagram_add_axis_yl_bool + { \__endiagram_add_axis_label_yl_ticks:n { #3 } } + \bool_if:NT \l__endiagram_add_axis_yr_bool + { \__endiagram_add_axis_label_yr_ticks:n { #3 } } + \bool_if:NT \l__endiagram_add_axis_x_bool + { \__endiagram_add_axis_label_x_ticks:n { #3 } } } { % list of points - \bool_if:NT \l_ENdiagram_add_axis_yl_bool - { \ENdiagram_add_axis_label_yl_points:n { #3 } } - \bool_if:NT \l_ENdiagram_add_axis_yr_bool - { \ENdiagram_add_axis_label_yr_points:n { #3 } } - \bool_if:NT \l_ENdiagram_add_axis_x_bool - { \ENdiagram_add_axis_label_x_points:n { #3 } } + \bool_if:NT \l__endiagram_add_axis_yl_bool + { \__endiagram_add_axis_label_yl_points:n { #3 } } + \bool_if:NT \l__endiagram_add_axis_yr_bool + { \__endiagram_add_axis_label_yr_points:n { #3 } } + \bool_if:NT \l__endiagram_add_axis_x_bool + { \__endiagram_add_axis_label_x_points:n { #3 } } } \group_end: } -\cs_new_nopar:Npn \ENdiagram_add_axis_label_yl_ticks:n #1 +\cs_new_protected:Npn \__endiagram_add_axis_label_yl_ticks:n #1 { \tl_map_inline:nn { #1 } { \tl_if_in:nnTF { ##1 } { [ } { \group_begin: - \ENdiagram_get_tick_arg_and_label:w ##1 \q_stop - \fp_set:Nn \l_tmpb_fp { \l_tmpb_tl } - \bool_if:NT \l_ENdiagram_energy_bool + \__endiagram_get_tick_arg_and_label:w ##1 \q_stop + \fp_set:Nn \l__Endiagram_tmpb_fp { \l__Endiagram_label_tl } + \bool_if:NT \l__endiagram_energy_bool { - \fp_mul:Nn \l_tmpb_fp { \l_ENdiagram_energy_step_tl } - \fp_sub:Nn \l_tmpb_fp { \l_ENdiagram_energy_zero_tl } - \bool_if:NTF \l_ENdiagram_energy_round_places_bool + \fp_set:Nn \l__Endiagram_tmpb_fp { - \fp_round_places:Nn \l_tmpb_fp - { \l_ENdiagram_energy_round_tl } + \l__Endiagram_tmpb_fp * \l__endiagram_energy_step_tl + - \l__endiagram_energy_zero_tl } + \bool_if:NTF \l__endiagram_energy_round_places_bool { - \fp_round_figures:Nn \l_tmpb_fp - { \l_ENdiagram_energy_round_tl } + \fp_round_places:Nn \l__Endiagram_tmpb_fp + { \l__endiagram_energy_round_tl } } - \tl_set:Nn \l_tmpb_tl { \fp_to_tl:N \l_tmpb_fp } + { + \fp_round_figures:Nn \l__Endiagram_tmpb_fp + { \l__endiagram_energy_round_tl } + } + \tl_set:Nn \l__Endiagram_tmpb_tl { \fp_to_tl:N \l__Endiagram_tmpb_fp } } - \ENdiagram_draw:nx { } + \endiagram_draw:nx { } { let \exp_not:N \p1 = (origin-l) in - ( \exp_not:N \x1 , \fp_to_tl:N \l_tmpa_fp ) -- ++ (-3pt,0) - node[left,font=\exp_not:o \l_ENdiagram_add_axis_font_tl,\l_tmpc_tl] - { \l_tmpb_tl } + ( \exp_not:N \x1 , \fp_to_tl:N \l__Endiagram_tmpa_fp ) -- ++ (-3pt,0) + node + [ + left , + font = \exp_not:V \l__endiagram_add_axis_font_tl , + \exp_not:V \l__Endiagram_label_tikz_tl + ] + { \exp_not:V \l__Endiagram_label_tl } } \group_end: } { - \fp_set:Nn \l_tmpa_fp { ##1 } - \bool_if:NT \l_ENdiagram_energy_bool + \fp_set:Nn \l__Endiagram_tmpa_fp { ##1 } + \bool_if:NT \l__endiagram_energy_bool { - \fp_mul:Nn \l_tmpa_fp { \l_ENdiagram_energy_step_tl } - \fp_sub:Nn \l_tmpa_fp { \l_ENdiagram_energy_zero_tl } + \fp_set:Nn \l__Endiagram_tmpa_fp + { + \l__Endiagram_tmpa_fp * \l__endiagram_energy_step_tl + - \l__endiagram_energy_zero_tl + } } - \ENdiagram_draw:nn { } + \endiagram_draw:nn { } { let \p1 = (origin-l) in ( \x1 , ##1 ) -- ++ (-3pt,0) - node[left,font=\l_ENdiagram_add_axis_font_tl] - { \fp_to_tl:N \l_tmpa_fp } + node[left,font=\l__endiagram_add_axis_font_tl] + { \fp_to_tl:N \l__Endiagram_tmpa_fp } } } } } % TODO: sollte Energie-Skala und Rundung beachten! -\cs_new_nopar:Npn \ENdiagram_add_axis_label_yr_ticks:n #1 +\cs_new_protected:Npn \__endiagram_add_axis_label_yr_ticks:n #1 { \tl_map_inline:nn { #1 } { \tl_if_in:nnTF { ##1 } { [ } { \group_begin: - \ENdiagram_get_tick_arg_and_label:w ##1 \q_stop - \ENdiagram_draw:nx { } + \__endiagram_get_tick_arg_and_label:w ##1 \q_stop + \endiagram_draw:nx { } { - ( \fp_to_tl:N \g_ENdiagram_x_max_fp , \l_tmpa_tl ) -- ++ (3pt,0) - node[right,font=\exp_not:o \l_ENdiagram_add_axis_font_tl,\l_tmpc_tl] - { \l_tmpb_tl } + ( \fp_to_tl:N \g__endiagram_x_max_fp , \l__Endiagram_point_tl ) -- ++ (3pt,0) + node + [ + right , + font = \exp_not:V \l__endiagram_add_axis_font_tl , + \exp_not:V \l__Endiagram_label_tikz_tl + ] + { \exp_not:V \l__Endiagram_label_tl } } \group_end: } { - \ENdiagram_draw:nn { } + \endiagram_draw:nn { } { let \p1 = (origin-r) in ( \x1 , ##1 ) -- ++ (3pt,0) - node[right,font=\l_ENdiagram_add_axis_font_tl] { ##1 } + node[right,font=\l__endiagram_add_axis_font_tl] { ##1 } } } } } -\cs_new_nopar:Npn \ENdiagram_add_axis_label_x_ticks:n #1 +\cs_new_protected:Npn \__endiagram_add_axis_label_x_ticks:n #1 { \tl_map_inline:nn { #1 } { \tl_if_in:nnTF { ##1 } { [ } { \group_begin: - \ENdiagram_get_tick_arg_and_label:w ##1 \q_stop - \ENdiagram_draw:nx { } + \__endiagram_get_tick_arg_and_label:w ##1 \q_stop + \endiagram_draw:nx { } { let \exp_not:N \p1 = (origin-l) in - ( \l_tmpa_tl , \exp_not:N \y1 ) -- ++ (-3pt,0) - node[below,font=\exp_not:o \l_ENdiagram_add_axis_font_tl,\l_tmpc_tl] - { \l_tmpb_tl } + ( \l__Endiagram_point_tl , \exp_not:N \y1 ) -- ++ (-3pt,0) + node + [ + below , + font = \exp_not:V \l__endiagram_add_axis_font_tl , + \exp_not:V \l__Endiagram_label_tikz_tl + ] + { \exp_not:V \l__Endiagram_label_tl } } \group_end: } { - \ENdiagram_draw:nn { } + \endiagram_draw:nn { } { let \p1 = (origin-l) in ( ##1 , \y1 ) -- ++ (-3pt,0) - node[below,font=\l_ENdiagram_add_axis_font_tl] { ##1 } + node[below,font=\l__endiagram_add_axis_font_tl] { ##1 } } } } } -\cs_new_nopar:Npn \ENdiagram_add_axis_label_yl_points:n #1 +\cs_new_protected:Npn \__endiagram_add_axis_label_yl_points:n #1 { \tl_map_inline:nn { #1 } { \tl_if_in:nnTF { ##1 } { [ } { \group_begin: - \ENdiagram_get_tick_point_and_label:w ##1 \q_stop - \ENdiagram_draw:xn { \l_ENdiagram_add_axis_connect_tl } + \__endiagram_get_tick_point_and_label:w ##1 \q_stop + \endiagram_draw:xn + { \exp_not:V \l__endiagram_add_axis_connect_tl } { - (\l_tmpa_tl) -- (\l_tmpa_tl -| origin-l) + (\l__Endiagram_point_tl) + -- + (\l__Endiagram_point_tl -| origin-l) } - \ENdiagram_draw:nx { } + \endiagram_draw:nx { } { - (\l_tmpa_tl -| origin-l) -- ++ (-3pt,0) - node[left,font=\exp_not:o \l_ENdiagram_add_axis_font_tl,\l_tmpc_tl] - { \l_tmpb_tl } + (\l__Endiagram_point_tl -| origin-l) -- ++ (-3pt,0) + node + [ + left , + font = \exp_not:V \l__endiagram_add_axis_font_tl , + \exp_not:V \l__Endiagram_label_tikz_tl + ] + { \exp_not:V \l__Endiagram_label_tl } } \group_end: } { \group_begin: - \ENdiagram_get_tick_node:w ##1 \q_stop - \ENdiagram_draw:xn { \l_ENdiagram_add_axis_connect_tl } + \__endiagram_get_tick_node:w ##1 \q_stop + \endiagram_draw:xn + { \exp_not:V \l__endiagram_add_axis_connect_tl } { - (\l_tmpa_tl) -- (\l_tmpa_tl -| origin-l) + (\l__Endiagram_tick_node_tl) -- (\l__Endiagram_tick_node_tl -| origin-l) } - \ENdiagram_draw:nn { } + \endiagram_draw:nn { } { - (\l_tmpa_tl -| origin-l) -- ++ (-3pt,0) + (\l__Endiagram_tick_node_tl -| origin-l) -- ++ (-3pt,0) } \group_end: } } } -\cs_new_nopar:Npn \ENdiagram_add_axis_label_yr_points:n #1 +\cs_new_protected:Npn \__endiagram_add_axis_label_yr_points:n #1 { \tl_map_inline:nn { #1 } { \tl_if_in:nnTF { ##1 } { [ } { \group_begin: - \ENdiagram_get_tick_point_and_label:w ##1 \q_stop - \ENdiagram_draw:xn { \l_ENdiagram_add_axis_connect_tl } + \__endiagram_get_tick_point_and_label:w ##1 \q_stop + \endiagram_draw:xn + { \exp_not:V \l__endiagram_add_axis_connect_tl } { - (\l_tmpa_tl) -- (\l_tmpa_tl -| origin-r) + (\l__Endiagram_point_tl) + -- + (\l__Endiagram_point_tl -| origin-r) } - \ENdiagram_draw:nx { } + \endiagram_draw:nx { } { - (\l_tmpa_tl -| origin-r) -- ++ (3pt,0) - node[right,font=\exp_not:o \l_ENdiagram_add_axis_font_tl,\l_tmpc_tl] - { \l_tmpb_tl } + (\l__Endiagram_point_tl -| origin-r) -- ++ (3pt,0) + node + [ + right , + font = \exp_not:V \l__endiagram_add_axis_font_tl , + \exp_not:V \l__Endiagram_label_tikz_tl + ] + { \exp_not:V \l__Endiagram_label_tl } } \group_end: } { \group_begin: - \ENdiagram_get_tick_node:w ##1 \q_stop - \ENdiagram_draw:xn { \l_ENdiagram_add_axis_connect_tl } - { - (\l_tmpa_tl) -- (\l_tmpa_tl -| origin-r) - } - \ENdiagram_draw:nn { } + \__endiagram_get_tick_node:w ##1 \q_stop + \endiagram_draw:xn + { \exp_not:V \l__endiagram_add_axis_connect_tl } { - (\l_tmpa_tl -| origin-r) -- ++ (3pt,0) + (\l__Endiagram_tick_node_tl) + -- + (\l__Endiagram_tick_node_tl -| origin-r) } + \endiagram_draw:nn { } + { (\l__Endiagram_tick_node_tl -| origin-r) -- ++ (3pt,0) } \group_end: } } } -\cs_new_nopar:Npn \ENdiagram_add_axis_label_x_points:n #1 +\cs_new_protected:Npn \__endiagram_add_axis_label_x_points:n #1 { \tl_map_inline:nn { #1 } { \tl_if_in:nnTF { ##1 } { [ } { \group_begin: - \ENdiagram_get_tick_point_and_label:w ##1 \q_stop - \ENdiagram_draw:xn { \l_ENdiagram_add_axis_connect_tl } + \__endiagram_get_tick_point_and_label:w ##1 \q_stop + \endiagram_draw:xn + { \exp_not:V \l__endiagram_add_axis_connect_tl } { - (\l_tmpa_tl) -- (\l_tmpa_tl |- origin-l) + (\l__Endiagram_point_tl) + -- + (\l__Endiagram_point_tl |- origin-l) } - \ENdiagram_draw:nx { } + \endiagram_draw:nx { } { - (\l_tmpa_tl |- origin-l) -- ++ (-3pt,0) - node[below,font=\exp_not:o \l_ENdiagram_add_axis_font_tl,\l_tmpc_tl] - { \l_tmpb_tl } + (\l__Endiagram_point_tl |- origin-l) -- ++ (-3pt,0) + node + [ + below , + font = \exp_not:V \l__endiagram_add_axis_font_tl , + \exp_not:V \l__Endiagram_label_tikz_tl + ] + { \exp_not:V \l__Endiagram_label_tl } } \group_end: } { \group_begin: - \ENdiagram_get_tick_node:w ##1 \q_stop - \ENdiagram_draw:xn { \l_ENdiagram_add_axis_connect_tl } - { - (\l_tmpa_tl) -- (\l_tmpa_tl |- origin-l) - } - \ENdiagram_draw:nn { } + \__endiagram_get_tick_node:w ##1 \q_stop + \endiagram_draw:xn + { \exp_not:V \l__endiagram_add_axis_connect_tl } { - (\l_tmpa_tl |- origin-l) -- ++ (-3pt,0) + (\l__Endiagram_tick_node_tl) + -- + (\l__Endiagram_tick_node_tl |- origin-l) } + \endiagram_draw:nn { } + { (\l__Endiagram_tick_node_tl |- origin-l) -- ++ (-3pt,0) } \group_end: } } } -\cs_new_nopar:Npn \ENdiagram_get_tick_arg_and_label:w #1[#2] \q_stop +\cs_new_protected:Npn \__endiagram_get_tick_arg_and_label:w #1[#2] \q_stop { - \fp_set:Nn \l_tmpa_fp { #1 } - \ENdiagram_get_label_and_tikz:n { #2 } + \fp_set:Nn \l__Endiagram_tmpa_fp { #1 } + \endiagram_get_label_and_tikz:n { #2 } } -\cs_new_nopar:Npn \ENdiagram_get_tick_point_and_label:w (#1)[#2] \q_stop +\tl_new:N \l__Endiagram_point_tl +\tl_new:N \l__Endiagram_tick_node_tl +\tl_new:N \l__Endiagram_label_tl +\tl_new:N \l__Endiagram_label_tikz_tl + +\cs_new_protected:Npn \__endiagram_get_tick_point_and_label:w (#1)[#2] \q_stop { - \tl_set:Nn \l_tmpa_tl { #1 } - \ENdiagram_get_label_and_tikz:n { #2 } + \tl_set:Nn \l__Endiagram_point_tl { #1 } + \endiagram_get_label_and_tikz:n { #2 } } -\cs_new_nopar:Npn \ENdiagram_get_tick_node:w (#1) \q_stop - { \tl_set:Nn \l_tmpa_tl { #1 } } +\cs_new_protected:Npn \__endiagram_get_tick_node:w (#1) \q_stop + { \tl_set:Nn \l__Endiagram_tick_node_tl { #1 } } -\NewDocumentCommand \ENdiagram_get_label_and_tikz:n { > { \SplitArgument { 1 } { , } } m } - { \ENdiagram_get_label_and_tikz_aux:nn #1 } +\cs_new_protected:Npn \endiagram_get_label_and_tikz:n #1 + { + \tl_if_in:nnTF { #1 } { , } + { \__endiagram_get_label_and_tikz_aux:w #1 \q_stop } + { \tl_set:Nn \l__Endiagram_label_tl { #1 } } + } -\cs_new_nopar:Npn \ENdiagram_get_label_and_tikz_aux:nn #1#2 +\cs_new_protected:Npn \__endiagram_get_label_and_tikz_aux:w #1,#2 \q_stop { - \IfNoValueF { #1 } - { \tl_set:Nn \l_tmpb_tl { #1 } } - \IfNoValueF { #2 } { \tl_set:Nn \l_tmpc_tl { #2 } } + \tl_set:Nn \l__Endiagram_label_tl { #1 } + \tl_set:Nn \l__Endiagram_label_tikz_tl { #2 } } % --------------------------------------------------------------------------- % % make origin -\bool_new:N \l_ENdiagram_origin_made_bool +\bool_new:N \l__endiagram_origin_made_bool -\cs_new_nopar:Npn \ENdiagram_make_origin: +\Endiagram_new_environment_command:Nnn \MakeOrigin {} { - \bool_if:NF \l_ENdiagram_origin_made_bool + \bool_if:NF \l__endiagram_origin_made_bool { - \bool_set_true:N \l_ENdiagram_origin_made_bool - \fp_gsub:Nn \g_ENdiagram_y_min_fp { 1 } - \fp_gadd:Nn \g_ENdiagram_y_max_fp { 1 } - \fp_gsub:Nn \g_ENdiagram_x_min_fp { 1.5 } - \fp_gsub:Nn \g_ENdiagram_x_min_fp { \l_ENdiagram_diagram_l_offset_tl } - \fp_gadd:Nn \g_ENdiagram_x_max_fp { 1.5 } - \ENdiagram_draw:nn {} + \bool_set_true:N \l__endiagram_origin_made_bool + \fp_gsub:Nn \g__endiagram_y_min_fp { 1 } + \fp_gadd:Nn \g__endiagram_y_max_fp { 1 } + \fp_gsub:Nn \g__endiagram_x_min_fp { 1.5 } + \fp_gsub:Nn \g__endiagram_x_min_fp { \l__endiagram_diagram_l_offset_tl } + \fp_gadd:Nn \g__endiagram_x_max_fp { 1.5 } + \endiagram_draw:nn {} { coordinate (origin-l) at - (-1.5-\l_ENdiagram_diagram_l_offset_tl,\fp_to_tl:N \g_ENdiagram_y_min_fp ) + (-1.5-\l__endiagram_diagram_l_offset_tl,\fp_to_tl:N \g__endiagram_y_min_fp ) } - \bool_if:NT \l_ENdiagram_debug_bool + \bool_if:NT \l__endiagram_debug_bool { - \fp_set:Nn \l_tmpa_tl { -1.5 } - \fp_sub:Nn \l_tmpa_tl { \l_ENdiagram_diagram_l_offset_tl } - \ENdiagram_draw:nn { red } { (origin-l) circle (2pt) } - \ENdiagram_draw:nn { font=\tiny,inner~sep=0 } + \fp_set:Nn \l__Endiagram_tmpa_tl { -1.5 } + \fp_sub:Nn \l__Endiagram_tmpa_tl { \l__endiagram_diagram_l_offset_tl } + \endiagram_draw:nn { red } { (origin-l) circle (2pt) } + \endiagram_draw:nn { font=\tiny,inner~sep=0 } { node[above~right,red] at (origin-l) - { ( \fp_to_tl:N \l_tmpa_tl , \fp_to_tl:N \g_ENdiagram_y_min_fp ) } + { ( \fp_to_tl:N \l__Endiagram_tmpa_tl , \fp_to_tl:N \g__endiagram_y_min_fp ) } node[fill=yellow!10,below~right] at (origin-l) { origin-l } } } - \ENdiagram_draw:nn {} + \endiagram_draw:nn {} { coordinate (origin-r) at - (\fp_to_tl:N \g_ENdiagram_x_max_fp ,\fp_to_tl:N \g_ENdiagram_y_min_fp ) + (\fp_to_tl:N \g__endiagram_x_max_fp ,\fp_to_tl:N \g__endiagram_y_min_fp ) } - \bool_if:NT \l_ENdiagram_debug_bool + \bool_if:NT \l__endiagram_debug_bool { - \ENdiagram_draw:nn { red } { (origin-r) circle (2pt) } - \ENdiagram_draw:nn { font=\tiny,inner~sep=0 } + \endiagram_draw:nn { red } { (origin-r) circle (2pt) } + \endiagram_draw:nn { font=\tiny,inner~sep=0 } { node[above~right,red] at (origin-r) - { ( \fp_to_tl:N \g_ENdiagram_x_max_fp ,\fp_to_tl:N \g_ENdiagram_y_min_fp ) } + { ( \fp_to_tl:N \g__endiagram_x_max_fp ,\fp_to_tl:N \g__endiagram_y_min_fp ) } node[fill=yellow!10,below~right] at (origin-r) { origin-r } } @@ -1178,339 +1290,339 @@ % --------------------------------------------------------------------------- % % main environment -\bool_new:N \l_ENdiagram_y_axis_left_bool -\bool_set_true:N \l_ENdiagram_y_axis_left_bool -\bool_new:N \l_ENdiagram_y_axis_right_bool -\bool_new:N \l_ENdiagram_y_label_pos_bool -\bool_set_true:N \l_ENdiagram_y_label_pos_bool -\bool_new:N \l_ENdiagram_x_axis_bool -\bool_set_true:N \l_ENdiagram_x_axis_bool -\bool_new:N \l_ENdiagram_x_label_pos_bool -\bool_set_true:N \l_ENdiagram_x_label_pos_bool -\bool_new:N \l_ENdiagram_axes_all_bool -\bool_new:N \l_ENdiagram_axes_ticks_bool -\bool_new:N \l_ENdiagram_axes_ticks_yl_bool -\bool_new:N \l_ENdiagram_axes_ticks_yr_bool -\bool_new:N \l_ENdiagram_axes_add_ticks_bool -\bool_new:N \l_ENdiagram_energy_bool -\bool_new:N \l_ENdiagram_energy_unit_bool -\bool_new:N \l_ENdiagram_energy_round_places_bool -\bool_new:N \l_ENdiagram_calculate_bool -\bool_set_true:N \l_ENdiagram_calculate_bool - -\tl_new:N \l_ENdiagram_tikz_tl -\tl_new:N \l_ENdiagram_y_axis_tikz_tl -\tl_new:N \l_ENdiagram_x_axis_tikz_tl -\tl_new:N \l_ENdiagram_axes_ticks_step_tl -\tl_set:Nn \l_ENdiagram_axes_ticks_step_tl { 1 } -\tl_new:N \l_ENdiagram_y_label_pos_tl -\tl_set:Nn \l_ENdiagram_y_label_pos_tl { pos = .5 , } -\tl_new:N \l_ENdiagram_y_label_anchor_tl -\tl_set:Nn \l_ENdiagram_y_label_anchor_tl { sloped } -\tl_new:N \l_ENdiagram_y_label_text_tl -\tl_set:Nn \l_ENdiagram_y_label_text_tl { $E$ } -\tl_new:N \l_ENdiagram_y_label_angle_tl -\tl_set:Nn \l_ENdiagram_y_label_angle_tl { 0 } -\tl_new:N \l_ENdiagram_y_label_offset_tl -\tl_new:N \l_ENdiagram_x_label_pos_tl -\tl_set:Nn \l_ENdiagram_x_label_pos_tl { pos = .5 , } -\tl_new:N \l_ENdiagram_x_label_anchor_tl -\tl_set:Nn \l_ENdiagram_x_label_anchor_tl { below } -\tl_new:N \l_ENdiagram_x_label_text_tl -\tl_set:Nn \l_ENdiagram_x_label_text_tl { $\xi$ } -\tl_new:N \l_ENdiagram_x_label_angle_tl -\tl_set:Nn \l_ENdiagram_x_label_angle_tl { 0 } -\tl_new:N \l_ENdiagram_x_label_offset_tl -\tl_new:N \l_ENdiagram_diagram_l_offset_tl -\tl_set:Nn \l_ENdiagram_diagram_l_offset_tl { 0 } -\tl_new:N \l_ENdiagram_diagram_r_offset_tl -\tl_set:Nn \l_ENdiagram_diagram_r_offset_tl { 0 } -\tl_new:N \l_ENdiagram_diagram_scale_tl -\tl_set:Nn \l_ENdiagram_diagram_scale_tl { 1 } -\tl_new:N \l_ENdiagram_diagram_unit_factor_tl -\tl_set:Nn \l_ENdiagram_diagram_unit_factor_tl { .5 } -\tl_new:N \l_ENdiagram_energy_step_tl -\tl_set:Nn \l_ENdiagram_energy_step_tl { 1 } -\tl_new:N \l_ENdiagram_energy_unit_tl -\tl_new:N \l_ENdiagram_energy_unit_separator_tl -\tl_set:Nn \l_ENdiagram_energy_unit_separator_tl { / } -\tl_new:N \l_ENdiagram_energy_zero_tl -\tl_set:Nn \l_ENdiagram_energy_zero_tl { 0 } -\tl_new:N \l_ENdiagram_energy_round_tl -\tl_set:Nn \l_ENdiagram_energy_round_tl { 3 } - -\cs_new_nopar:Npn \ENdiagram_determine_unit:n #1 +\bool_new:N \l__endiagram_y_axis_left_bool +\bool_set_true:N \l__endiagram_y_axis_left_bool +\bool_new:N \l__endiagram_y_axis_right_bool +\bool_new:N \l__endiagram_y_label_pos_bool +\bool_set_true:N \l__endiagram_y_label_pos_bool +\bool_new:N \l__endiagram_x_axis_bool +\bool_set_true:N \l__endiagram_x_axis_bool +\bool_new:N \l__endiagram_x_label_pos_bool +\bool_set_true:N \l__endiagram_x_label_pos_bool +\bool_new:N \l__endiagram_axes_all_bool +\bool_new:N \l__endiagram_axes_ticks_bool +\bool_new:N \l__endiagram_axes_ticks_yl_bool +\bool_new:N \l__endiagram_axes_ticks_yr_bool +\bool_new:N \l__endiagram_axes_add_ticks_bool +\bool_new:N \l__endiagram_energy_bool +\bool_new:N \l__endiagram_energy_unit_bool +\bool_new:N \l__endiagram_energy_round_places_bool +\bool_new:N \l__endiagram_calculate_bool +\bool_set_true:N \l__endiagram_calculate_bool + +\tl_new:N \l__endiagram_tikz_tl +\tl_new:N \l__endiagram_y_axis_tikz_tl +\tl_new:N \l__endiagram_x_axis_tikz_tl +\tl_new:N \l__endiagram_axes_ticks_step_tl +\tl_set:Nn \l__endiagram_axes_ticks_step_tl { 1 } +\tl_new:N \l__endiagram_y_label_pos_tl +\tl_set:Nn \l__endiagram_y_label_pos_tl { pos = .5 , } +\tl_new:N \l__endiagram_y_label_anchor_tl +\tl_set:Nn \l__endiagram_y_label_anchor_tl { sloped } +\tl_new:N \l__endiagram_y_label_text_tl +\tl_set:Nn \l__endiagram_y_label_text_tl { $E$ } +\tl_new:N \l__endiagram_y_label_angle_tl +\tl_set:Nn \l__endiagram_y_label_angle_tl { 0 } +\tl_new:N \l__endiagram_y_label_offset_tl +\tl_new:N \l__endiagram_x_label_pos_tl +\tl_set:Nn \l__endiagram_x_label_pos_tl { pos = .5 , } +\tl_new:N \l__endiagram_x_label_anchor_tl +\tl_set:Nn \l__endiagram_x_label_anchor_tl { below } +\tl_new:N \l__endiagram_x_label_text_tl +\tl_set:Nn \l__endiagram_x_label_text_tl { $\xi$ } +\tl_new:N \l__endiagram_x_label_angle_tl +\tl_set:Nn \l__endiagram_x_label_angle_tl { 0 } +\tl_new:N \l__endiagram_x_label_offset_tl +\tl_new:N \l__endiagram_diagram_l_offset_tl +\tl_set:Nn \l__endiagram_diagram_l_offset_tl { 0 } +\tl_new:N \l__endiagram_diagram_r_offset_tl +\tl_set:Nn \l__endiagram_diagram_r_offset_tl { 0 } +\tl_new:N \l__endiagram_diagram_scale_tl +\tl_set:Nn \l__endiagram_diagram_scale_tl { 1 } +\tl_new:N \l__endiagram_diagram_unit_factor_tl +\tl_set:Nn \l__endiagram_diagram_unit_factor_tl { .5 } +\tl_new:N \l__endiagram_energy_step_tl +\tl_set:Nn \l__endiagram_energy_step_tl { 1 } +\tl_new:N \l__endiagram_energy_unit_tl +\tl_new:N \l__endiagram_energy_unit_separator_tl +\tl_set:Nn \l__endiagram_energy_unit_separator_tl { / } +\tl_new:N \l__endiagram_energy_zero_tl +\tl_set:Nn \l__endiagram_energy_zero_tl { 0 } +\tl_new:N \l__endiagram_energy_round_tl +\tl_set:Nn \l__endiagram_energy_round_tl { 3 } + +\cs_new_protected:Npn \__endiagram_determine_unit:n #1 { - \dim_set:Nn \l_tmpa_dim { 1pt * \dim_ratio:nn { #1 } { 1cm } } - \tl_set:Nn \l_ENdiagram_diagram_unit_factor_tl { \dim_use:N \l_tmpa_dim } - \tl_remove_once:Nn \l_ENdiagram_diagram_unit_factor_tl { pt } + \dim_set:Nn \l__endiagram_tmpa_dim { 1pt * \dim_ratio:nn { #1 } { 1cm } } + \tl_set:Nn \l__endiagram_diagram_unit_factor_tl { \dim_use:N \l__endiagram_tmpa_dim } + \tl_remove_once:Nn \l__endiagram_diagram_unit_factor_tl { pt } } \keys_define:nn { ENdiagram } { - debug .bool_set:N = \l_ENdiagram_debug_bool , + debug .bool_set:N = \l__endiagram_debug_bool , debug .default:n = true , - draft .bool_set:N = \l_ENdiagram_debug_bool , + draft .bool_set:N = \l__endiagram_debug_bool , draft .default:n = true , final .choice: , final / true .code:n = - { \bool_set_false:N \l_ENdiagram_debug_bool } , + { \bool_set_false:N \l__endiagram_debug_bool } , final / false .code:n = - { \bool_set_true:N \l_ENdiagram_debug_bool } , + { \bool_set_true:N \l__endiagram_debug_bool } , final .default:n = true , axes .choice: , axes / y .code:n = { - \bool_set_true:N \l_ENdiagram_y_axis_left_bool - \bool_set_false:N \l_ENdiagram_y_axis_right_bool - \bool_set_false:N \l_ENdiagram_x_axis_bool + \bool_set_true:N \l__endiagram_y_axis_left_bool + \bool_set_false:N \l__endiagram_y_axis_right_bool + \bool_set_false:N \l__endiagram_x_axis_bool } , axes / y-l .code:n = { - \bool_set_true:N \l_ENdiagram_y_axis_left_bool - \bool_set_false:N \l_ENdiagram_y_axis_right_bool - \bool_set_false:N \l_ENdiagram_x_axis_bool + \bool_set_true:N \l__endiagram_y_axis_left_bool + \bool_set_false:N \l__endiagram_y_axis_right_bool + \bool_set_false:N \l__endiagram_x_axis_bool } , axes / y-r .code:n = { - \bool_set_false:N \l_ENdiagram_y_axis_left_bool - \bool_set_true:N \l_ENdiagram_y_axis_right_bool - \bool_set_false:N \l_ENdiagram_x_axis_bool + \bool_set_false:N \l__endiagram_y_axis_left_bool + \bool_set_true:N \l__endiagram_y_axis_right_bool + \bool_set_false:N \l__endiagram_x_axis_bool } , axes / x .code:n = { - \bool_set_false:N \l_ENdiagram_y_axis_left_bool - \bool_set_false:N \l_ENdiagram_y_axis_right_bool - \bool_set_true:N \l_ENdiagram_x_axis_bool + \bool_set_false:N \l__endiagram_y_axis_left_bool + \bool_set_false:N \l__endiagram_y_axis_right_bool + \bool_set_true:N \l__endiagram_x_axis_bool } , axes / xy .code:n = { - \bool_set_true:N \l_ENdiagram_y_axis_left_bool - \bool_set_false:N \l_ENdiagram_y_axis_right_bool - \bool_set_true:N \l_ENdiagram_x_axis_bool + \bool_set_true:N \l__endiagram_y_axis_left_bool + \bool_set_false:N \l__endiagram_y_axis_right_bool + \bool_set_true:N \l__endiagram_x_axis_bool } , axes / all .code:n = - { \bool_set_true:N \l_ENdiagram_axes_all_bool } , + { \bool_set_true:N \l__endiagram_axes_all_bool } , axes / false .code:n = { - \bool_set_false:N \l_ENdiagram_y_axis_left_bool - \bool_set_false:N \l_ENdiagram_y_axis_right_bool - \bool_set_false:N \l_ENdiagram_x_axis_bool + \bool_set_false:N \l__endiagram_y_axis_left_bool + \bool_set_false:N \l__endiagram_y_axis_right_bool + \bool_set_false:N \l__endiagram_x_axis_bool } , - y-axis .tl_set:N = \l_ENdiagram_y_axis_tikz_tl , - x-axis .tl_set:N = \l_ENdiagram_x_axis_tikz_tl , + y-axis .tl_set:N = \l__endiagram_y_axis_tikz_tl , + x-axis .tl_set:N = \l__endiagram_x_axis_tikz_tl , y-label .choice: , y-label / above .code:n = { - \bool_set_false:N \l_ENdiagram_y_label_pos_bool - \tl_clear:N \l_ENdiagram_y_label_anchor_tl + \bool_set_false:N \l__endiagram_y_label_pos_bool + \tl_clear:N \l__endiagram_y_label_anchor_tl } , y-label / left .code:n = { - \bool_set_true:N \l_ENdiagram_y_label_pos_bool - \tl_set:Nn \l_ENdiagram_y_label_anchor_tl { sloped } + \bool_set_true:N \l__endiagram_y_label_pos_bool + \tl_set:Nn \l__endiagram_y_label_anchor_tl { sloped } } , % y-label-axis .code:n = , % TODO: left/right/both % darauf achten, dass das mit "axes" korreliert. y-label-pos .code:n = - { \tl_set:Nn \l_ENdiagram_y_label_pos_tl { pos = #1 , } } , + { \tl_set:Nn \l__endiagram_y_label_pos_tl { pos = #1 , } } , y-label-offset .code:n = - { \tl_set:Nn \l_ENdiagram_y_label_offset_tl { = #1 } } , - y-label-text .tl_set:N = \l_ENdiagram_y_label_text_tl , - y-label-angle .tl_set:N = \l_ENdiagram_y_label_angle_tl , + { \tl_set:Nn \l__endiagram_y_label_offset_tl { = #1 } } , + y-label-text .tl_set:N = \l__endiagram_y_label_text_tl , + y-label-angle .tl_set:N = \l__endiagram_y_label_angle_tl , x-label .choice: , x-label / right .code:n = { - \bool_set_false:N \l_ENdiagram_x_label_pos_bool - \tl_set:Nn \l_ENdiagram_x_label_anchor_tl { right } + \bool_set_false:N \l__endiagram_x_label_pos_bool + \tl_set:Nn \l__endiagram_x_label_anchor_tl { right } } , x-label / below .code:n = { - \bool_set_true:N \l_ENdiagram_x_label_pos_bool - \tl_set:Nn \l_ENdiagram_x_label_anchor_tl { below } + \bool_set_true:N \l__endiagram_x_label_pos_bool + \tl_set:Nn \l__endiagram_x_label_anchor_tl { below } } , x-label-pos .code:n = - { \tl_set:Nn \l_ENdiagram_x_label_pos_tl { pos = #1 , } } , + { \tl_set:Nn \l__endiagram_x_label_pos_tl { pos = #1 , } } , x-label-offset .code:n = - { \tl_set:Nn \l_ENdiagram_x_label_offset_tl { = #1 } } , - x-label-text .tl_set:N = \l_ENdiagram_x_label_text_tl , - x-label-angle .tl_set:N = \l_ENdiagram_x_label_angle_tl , + { \tl_set:Nn \l__endiagram_x_label_offset_tl { = #1 } } , + x-label-text .tl_set:N = \l__endiagram_x_label_text_tl , + x-label-angle .tl_set:N = \l__endiagram_x_label_angle_tl , offset .code:n = { - \tl_set:Nn \l_ENdiagram_diagram_l_offset_tl { #1 } - \tl_set:Nn \l_ENdiagram_diagram_r_offset_tl { #1 } + \tl_set:Nn \l__endiagram_diagram_l_offset_tl { #1 } + \tl_set:Nn \l__endiagram_diagram_r_offset_tl { #1 } } , - l-offset .tl_set:N = \l_ENdiagram_diagram_l_offset_tl , - r-offset .tl_set:N = \l_ENdiagram_diagram_r_offset_tl , - scale .tl_set:N = \l_ENdiagram_diagram_scale_tl , - unit .code:n = \ENdiagram_determine_unit:n { #1 } , - tikz .tl_set:N = \l_ENdiagram_tikz_tl , + l-offset .tl_set:N = \l__endiagram_diagram_l_offset_tl , + r-offset .tl_set:N = \l__endiagram_diagram_r_offset_tl , + scale .tl_set:N = \l__endiagram_diagram_scale_tl , + unit .code:n = \__endiagram_determine_unit:n { #1 } , + tikz .tl_set:N = \l__endiagram_tikz_tl , energy-step .code:n = - \tl_set:Nn \l_ENdiagram_energy_step_tl { #1 } - \bool_set_true:N \l_ENdiagram_energy_bool , - energy-zero .tl_set:N = \l_ENdiagram_energy_zero_tl , + \tl_set:Nn \l__endiagram_energy_step_tl { #1 } + \bool_set_true:N \l__endiagram_energy_bool , + energy-zero .tl_set:N = \l__endiagram_energy_zero_tl , energy-unit .code:n = - \tl_set:Nn \l_ENdiagram_energy_unit_tl { #1 } - \bool_set_true:N \l_ENdiagram_energy_unit_bool , - energy-unit-separator .tl_set:N = \l_ENdiagram_energy_unit_separator_tl , - energy-round-places .bool_set:N = \l_ENdiagram_energy_round_places_bool , + \tl_set:Nn \l__endiagram_energy_unit_tl { #1 } + \bool_set_true:N \l__endiagram_energy_unit_bool , + energy-unit-separator .tl_set:N = \l__endiagram_energy_unit_separator_tl , + energy-round-places .bool_set:N = \l__endiagram_energy_round_places_bool , energy-round-places .default:n = true , - energy-round .tl_set:N = \l_ENdiagram_energy_round_tl , - calculate .bool_set:N = \l_ENdiagram_calculate_bool , + energy-round .tl_set:N = \l__endiagram_energy_round_tl , + calculate .bool_set:N = \l__endiagram_calculate_bool , calculate .default:n = true , % TODO darauf achten, dass das mit "axes" korreliert ticks .choice: , ticks / y .code:n = - \bool_set_true:N \l_ENdiagram_axes_ticks_bool , + \bool_set_true:N \l__endiagram_axes_ticks_bool , ticks / y-l .code:n = - \bool_set_true:N \l_ENdiagram_axes_ticks_yl_bool , + \bool_set_true:N \l__endiagram_axes_ticks_yl_bool , ticks / y-r .code:n = - \bool_set_true:N \l_ENdiagram_axes_ticks_yr_bool , + \bool_set_true:N \l__endiagram_axes_ticks_yr_bool , ticks / none .code:n = - \bool_set_false:N \l_ENdiagram_axes_ticks_bool - \bool_set_false:N \l_ENdiagram_axes_ticks_yl_bool - \bool_set_false:N \l_ENdiagram_axes_ticks_yr_bool , + \bool_set_false:N \l__endiagram_axes_ticks_bool + \bool_set_false:N \l__endiagram_axes_ticks_yl_bool + \bool_set_false:N \l__endiagram_axes_ticks_yr_bool , ticks .default:n = y , - ticks-step .tl_set:N = \l_ENdiagram_axes_ticks_step_tl + ticks-step .tl_set:N = \l__endiagram_axes_ticks_step_tl } \NewDocumentEnvironment { endiagram } { o } { \IfNoValueF { #1 } { \keys_set:nn { ENdiagram } { #1 } } - \int_gzero:N \g_ENdiagram_curve_int - \cs_set_eq:NN \ENcurve \ENdiagram_curve:w - \cs_set_eq:NN \ShowNiveaus \ENdiagram_show_niveaus:w - \cs_set_eq:NN \ShowGain \ENdiagram_show_gain:w - \cs_set_eq:NN \ShowEa \ENdiagram_show_ea:w - \cs_set_eq:NN \AddAxisLabel \ENdiagram_add_axis_label:w - \cs_set_eq:NN \MakeOrigin \ENdiagram_make_origin: - \ENdiagram_start_tikzpicture:x + \bool_set_true:N \l__Endiagram_inside_env_bool + \int_gzero:N \g__endiagram_curve_int + \endiagram_start_tikzpicture:x { - scale=\l_ENdiagram_diagram_scale_tl*\l_ENdiagram_diagram_unit_factor_tl , - \l_ENdiagram_tikz_tl + scale=\l__endiagram_diagram_scale_tl*\l__endiagram_diagram_unit_factor_tl , + \l__endiagram_tikz_tl } } { - \ENdiagram_make_origin: + \MakeOrigin % linke y-Achse - \bool_if:NT \l_ENdiagram_energy_unit_bool + \bool_if:NT \l__endiagram_energy_unit_bool { - \tl_put_right:Nn \l_ENdiagram_y_label_text_tl + \tl_put_right:Nn \l__endiagram_y_label_text_tl { - \tl_use:N \l_ENdiagram_energy_unit_separator_tl - \exp_args:No \si { \l_ENdiagram_energy_unit_tl } + \tl_use:N \l__endiagram_energy_unit_separator_tl + \exp_args:No \si { \l__endiagram_energy_unit_tl } } } - \bool_if:nT { \l_ENdiagram_y_axis_left_bool || \l_ENdiagram_axes_all_bool } + \bool_if:nT { \l__endiagram_y_axis_left_bool || \l__endiagram_axes_all_bool } { - \bool_if:NF \l_ENdiagram_y_label_pos_bool { \tl_clear:N \l_ENdiagram_y_label_pos_tl } - \ENdiagram_draw:xx { -> , \l_ENdiagram_y_axis_tikz_tl } + \bool_if:NF \l__endiagram_y_label_pos_bool { \tl_clear:N \l__endiagram_y_label_pos_tl } + \endiagram_draw:xx + { -> , \exp_not:V \l__endiagram_y_axis_tikz_tl } { - (-1.5-\l_ENdiagram_diagram_l_offset_tl,\fp_to_tl:N \g_ENdiagram_y_min_fp ) + (-1.5-\l__endiagram_diagram_l_offset_tl,\fp_to_tl:N \g__endiagram_y_min_fp ) -- - (-1.5-\l_ENdiagram_diagram_l_offset_tl,\fp_to_tl:N \g_ENdiagram_y_max_fp ) + (-1.5-\l__endiagram_diagram_l_offset_tl,\fp_to_tl:N \g__endiagram_y_max_fp ) node [ - \l_ENdiagram_y_label_pos_tl - above \l_ENdiagram_y_label_offset_tl , - rotate = \l_ENdiagram_y_label_angle_tl , - \l_ENdiagram_y_label_anchor_tl + \l__endiagram_y_label_pos_tl + above \l__endiagram_y_label_offset_tl , + rotate = \l__endiagram_y_label_angle_tl , + \l__endiagram_y_label_anchor_tl ] - { \l_ENdiagram_y_label_text_tl } + { \exp_not:V \l__endiagram_y_label_text_tl } } % TODO: "energy-zero" beachten: ticks auch am Nullpunkt starten, egal ob dort auch ein niveau sitzt - \bool_if:nT { \l_ENdiagram_axes_ticks_bool || \l_ENdiagram_axes_ticks_yl_bool } + \bool_if:nT { \l__endiagram_axes_ticks_bool || \l__endiagram_axes_ticks_yl_bool } { - \bool_set_true:N \l_ENdiagram_axes_add_ticks_bool - \fp_set:Nn \l_tmpa_fp { \g_ENdiagram_y_min_fp + \l_ENdiagram_axes_ticks_step_tl } - \bool_while_do:Nn \l_ENdiagram_axes_add_ticks_bool + \bool_set_true:N \l__endiagram_axes_add_ticks_bool + \fp_set:Nn \l__Endiagram_tmpa_fp + { \g__endiagram_y_min_fp + \l__endiagram_axes_ticks_step_tl } + \bool_while_do:Nn \l__endiagram_axes_add_ticks_bool { - \fp_set_eq:NN \l_tmpb_fp \l_tmpa_fp - \tl_clear:N \l_tmpc_tl - \ENdiagram_add_axis_label_yl_ticks:n { { \l_tmpa_fp [ \fp_to_tl:N \l_tmpb_fp ] } } - \fp_add:Nn \l_tmpa_fp { \l_ENdiagram_axes_ticks_step_tl } - \fp_compare:nNnF { \l_tmpa_fp } < { \g_ENdiagram_y_max_fp } - { \bool_set_false:N \l_ENdiagram_axes_add_ticks_bool } + \fp_set_eq:NN \l__Endiagram_tmpb_fp \l__Endiagram_tmpa_fp + \tl_clear:N \l__Endiagram_tmpc_tl + \__endiagram_add_axis_label_yl_ticks:n + { { \l__Endiagram_tmpa_fp [ \fp_to_tl:N \l__Endiagram_tmpb_fp ] } } + \fp_add:Nn \l__Endiagram_tmpa_fp { \l__endiagram_axes_ticks_step_tl } + \fp_compare:nNnF { \l__Endiagram_tmpa_fp } < { \g__endiagram_y_max_fp } + { \bool_set_false:N \l__endiagram_axes_add_ticks_bool } } } } % x-Achse - \bool_if:NT \l_ENdiagram_show_gain_right_bool + \bool_if:NT \l__endiagram_show_gain_right_bool { - \fp_gadd:Nn \g_ENdiagram_x_max_fp { \g_ENdiagram_gain_offset_tl } - \fp_gadd:Nn \g_ENdiagram_x_max_fp { 1 } + \fp_gadd:Nn \g__endiagram_x_max_fp { \g__endiagram_gain_offset_tl } + \fp_gadd:Nn \g__endiagram_x_max_fp { 1 } } - \fp_gadd:Nn \g_ENdiagram_x_max_fp { \l_ENdiagram_diagram_r_offset_tl } - \bool_if:nT { \l_ENdiagram_x_axis_bool || \l_ENdiagram_axes_all_bool } + \fp_gadd:Nn \g__endiagram_x_max_fp { \l__endiagram_diagram_r_offset_tl } + \bool_if:nT { \l__endiagram_x_axis_bool || \l__endiagram_axes_all_bool } { - \bool_if:NF \l_ENdiagram_x_label_pos_bool { \tl_clear:N \l_ENdiagram_x_label_pos_tl } - \ENdiagram_draw:xx + \bool_if:NF \l__endiagram_x_label_pos_bool { \tl_clear:N \l__endiagram_x_label_pos_tl } + \endiagram_draw:xx { \bool_if:nT - { \l_ENdiagram_x_axis_bool && !\l_ENdiagram_y_axis_right_bool && !\l_ENdiagram_axes_all_bool } + { \l__endiagram_x_axis_bool && !\l__endiagram_y_axis_right_bool && !\l__endiagram_axes_all_bool } { -> , } - \l_ENdiagram_x_axis_tikz_tl + \exp_not:V \l__endiagram_x_axis_tikz_tl } { - (-1.5-\l_ENdiagram_diagram_l_offset_tl,\fp_to_tl:N \g_ENdiagram_y_min_fp ) + (-1.5-\l__endiagram_diagram_l_offset_tl,\fp_to_tl:N \g__endiagram_y_min_fp ) -- - (\fp_to_tl:N \g_ENdiagram_x_max_fp ,\fp_to_tl:N \g_ENdiagram_y_min_fp ) + (\fp_to_tl:N \g__endiagram_x_max_fp ,\fp_to_tl:N \g__endiagram_y_min_fp ) node [ - \l_ENdiagram_x_label_pos_tl - rotate = \l_ENdiagram_x_label_angle_tl , + \l__endiagram_x_label_pos_tl + rotate = \l__endiagram_x_label_angle_tl , sloped , - \l_ENdiagram_x_label_anchor_tl \l_ENdiagram_x_label_offset_tl , + \l__endiagram_x_label_anchor_tl \l__endiagram_x_label_offset_tl , ] - { \exp_not:N \l_ENdiagram_x_label_text_tl } + { \exp_not:V \l__endiagram_x_label_text_tl } } } % rechte y-Achse - \bool_if:nT { \l_ENdiagram_y_axis_right_bool || \l_ENdiagram_axes_all_bool } + \bool_if:nT { \l__endiagram_y_axis_right_bool || \l__endiagram_axes_all_bool } { - \ENdiagram_draw:xf { -> , \l_ENdiagram_y_axis_tikz_tl } + \endiagram_draw:xf + { -> , \exp_not:V \l__endiagram_y_axis_tikz_tl } { - (\fp_to_tl:N \g_ENdiagram_x_max_fp,\fp_to_tl:N \g_ENdiagram_y_min_fp) + (\fp_to_tl:N \g__endiagram_x_max_fp,\fp_to_tl:N \g__endiagram_y_min_fp) -- - (\fp_to_tl:N \g_ENdiagram_x_max_fp,\fp_to_tl:N \g_ENdiagram_y_max_fp ) + (\fp_to_tl:N \g__endiagram_x_max_fp,\fp_to_tl:N \g__endiagram_y_max_fp ) } % TODO "energy-zero" beachten! Ticks werden nicht gezeichnet, wenn nicht extra spezifiziert - \bool_if:nT { \l_ENdiagram_axes_ticks_bool || \l_ENdiagram_axes_ticks_yr_bool } + \bool_if:nT { \l__endiagram_axes_ticks_bool || \l__endiagram_axes_ticks_yr_bool } { - \bool_set_true:N \l_ENdiagram_axes_add_ticks_bool - \fp_set_eq:NN \l_tmpa_fp \g_ENdiagram_y_min_fp - \fp_add:Nn \l_tmpa_fp { \l_ENdiagram_axes_ticks_step_tl } - \bool_while_do:Nn \l_ENdiagram_axes_add_ticks_bool + \bool_set_true:N \l__endiagram_axes_add_ticks_bool + \fp_set:Nn \l__Endiagram_tmpa_fp + { \g__endiagram_y_min_fp + \l__endiagram_axes_ticks_step_tl } + \bool_while_do:Nn \l__endiagram_axes_add_ticks_bool { - \fp_set_eq:NN \l_tmpb_fp \l_tmpa_fp - \fp_mul:Nn \l_tmpb_fp { \l_ENdiagram_energy_step_tl } - \tl_clear:N \l_tmpc_tl - \ENdiagram_add_axis_label_yr_ticks:n { { \l_tmpa_fp [ \fp_to_tl:N \l_tmpb_fp ] } } - \fp_add:Nn \l_tmpa_fp { \l_ENdiagram_axes_ticks_step_tl } - \fp_compare:nNnF { \l_tmpa_fp } < { \g_ENdiagram_y_max_fp } - { \bool_set_false:N \l_ENdiagram_axes_add_ticks_bool } + \fp_set:Nn \l__Endiagram_tmpb_fp + { \l__Endiagram_tmpa_fp * \l__endiagram_energy_step_tl } + \tl_clear:N \l__Endiagram_tmpc_tl + \__endiagram_add_axis_label_yr_ticks:n + { { \l__Endiagram_tmpa_fp [ \fp_to_tl:N \l__Endiagram_tmpb_fp ] } } + \fp_add:Nn \l__Endiagram_tmpa_fp { \l__endiagram_axes_ticks_step_tl } + \fp_compare:nNnF { \l__Endiagram_tmpa_fp } < { \g__endiagram_y_max_fp } + { \bool_set_false:N \l__endiagram_axes_add_ticks_bool } } } } - \bool_if:NT \l_ENdiagram_debug_bool + \bool_if:NT \l__endiagram_debug_bool { - \fp_add:Nn \g_ENdiagram_x_max_fp { 1 } - \fp_add:Nn \g_ENdiagram_y_max_fp { 1 } - \fp_sub:Nn \g_ENdiagram_x_min_fp { 1 } - \fp_sub:Nn \g_ENdiagram_y_min_fp { 1 } + \fp_add:Nn \g__endiagram_x_max_fp { 1 } + \fp_add:Nn \g__endiagram_y_max_fp { 1 } + \fp_sub:Nn \g__endiagram_x_min_fp { 1 } + \fp_sub:Nn \g__endiagram_y_min_fp { 1 } \draw[help~lines,densely~dotted,opacity=.7] - (\fp_to_tl:N \g_ENdiagram_x_min_fp,\fp_to_tl:N \g_ENdiagram_y_min_fp) + (\fp_to_tl:N \g__endiagram_x_min_fp,\fp_to_tl:N \g__endiagram_y_min_fp) grid - (\fp_to_tl:N \g_ENdiagram_x_max_fp,\fp_to_tl:N \g_ENdiagram_y_max_fp) ; + (\fp_to_tl:N \g__endiagram_x_max_fp,\fp_to_tl:N \g__endiagram_y_max_fp) ; \draw[red] (0,0) circle (3pt) node[right,font=\tiny] at (0,0) {(0,0)} ; } - \ENdiagram_end_tikzpicture: - \fp_gzero:N \g_ENdiagram_y_min_fp - \fp_gzero:N \g_ENdiagram_y_max_fp - \fp_gzero:N \g_ENdiagram_x_max_fp - \fp_gzero:N \g_ENdiagram_x_min_fp - \tl_gset:Nn \g_ENdiagram_gain_offset_tl { 0 } - \int_gzero:N \g_ENdiagram_ea_int + \endiagram_end_tikzpicture: + \fp_gzero:N \g__endiagram_y_min_fp + \fp_gzero:N \g__endiagram_y_max_fp + \fp_gzero:N \g__endiagram_x_max_fp + \fp_gzero:N \g__endiagram_x_min_fp + \tl_gset:Nn \g__endiagram_gain_offset_tl { 0 } + \int_gzero:N \g__endiagram_ea_int } % --------------------------------------------------------------------------- % @@ -1534,8 +1646,13 @@ Version history 2012/08/20 v0.1a - most basic necessary changes due to new l3fp module => more revisions on various places still needed! 2013/04/04 v0.1b - changed deprecated \clist_length:N into \clist_count:N +2013/04/18 v0.1c - bug fix: the y- and x-labels should not be expanded, made + internal commands protected where appropriate + - various internal changes, most importantly care of not + expanding user input that is not supposed to %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % TODO +- the whole code should be cleaned up... an embarrising mess! - \ENcurve und \AddAxisLabel so anpassen, dass Eingaben der Energieskala folgen?! - revise the whole code especially with respect to fp calculations
\ No newline at end of file |