summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/endiagram/endiagram.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/endiagram/endiagram.sty')
-rw-r--r--Master/texmf-dist/tex/latex/endiagram/endiagram.sty1661
1 files changed, 889 insertions, 772 deletions
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