diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/wheelchart/wheelchart.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/wheelchart/wheelchart.sty | 330 |
1 files changed, 175 insertions, 155 deletions
diff --git a/Master/texmf-dist/tex/latex/wheelchart/wheelchart.sty b/Master/texmf-dist/tex/latex/wheelchart/wheelchart.sty index e2c85439761..21e232b099b 100644 --- a/Master/texmf-dist/tex/latex/wheelchart/wheelchart.sty +++ b/Master/texmf-dist/tex/latex/wheelchart/wheelchart.sty @@ -18,7 +18,7 @@ \NeedsTeXFormat{LaTeX2e} \RequirePackage{tikz} \usetikzlibrary{calc} -\ProvidesExplPackage{wheelchart}{2024/03/08}{3.0}{Diagrams with circular or other shapes using TikZ and LaTeX3} +\ProvidesExplPackage{wheelchart}{2024/07/28}{4.0}{Diagrams with circular or other shapes using TikZ and LaTeX3} %%> \subsection{Variables} @@ -59,6 +59,8 @@ \fp_const:Nn \c__wheelchart_arc_data_end_factor_left_fp { 1 } \fp_const:Nn \c__wheelchart_arc_data_end_factor_right_fp { 0 } \fp_new:N \l__wheelchart_arc_data_line_sep_factor_fp +\fp_new:N \l__wheelchart_arc_data_lines_pos_fp +\fp_new:N \l__wheelchart_arc_data_lines_shift_fp \fp_new:N \l__wheelchart_arc_data_pos_fp \fp_new:N \l__wheelchart_arc_data_radius_plot_false_fp \fp_new:N \l__wheelchart_arc_data_sep_fp @@ -168,6 +170,9 @@ \int_new:N \l__wheelchart_lines_ext_top_dir_int \int_new:N \l__wheelchart_max_list_items_int +\regex_const:Nn \c__wheelchart_braces_regex { \{(.+)\} } +\regex_const:Nn \c__wheelchart_key_braces_regex { [\w\s]+\{(.+)\} } + \seq_new:N \l__wheelchart_arc_data_seq \seq_new:N \l__wheelchart_discrete_coefficients_first_seq \seq_new:N \l__wheelchart_discrete_coefficients_second_seq @@ -180,8 +185,8 @@ { sign ( \l__wheelchart_arc_data_dir_fp ) * ( - \cs:w c__wheelchart_arc_data_start_factor_\l__wheelchart_arc_data_align_tl _fp\cs_end: - + \cs:w c__wheelchart_arc_data_end_factor_\l__wheelchart_arc_data_align_tl _fp\cs_end: + \cs:w c__wheelchart_arc_data_start_factor_\l__wheelchart_arc_data_align_tl _fp \cs_end: + + \cs:w c__wheelchart_arc_data_end_factor_\l__wheelchart_arc_data_align_tl _fp \cs_end: ) } \tl_new:N \l__wheelchart_arc_data_align_tl @@ -262,7 +267,7 @@ \cs_new_protected:Npn \__wheelchart_caption_and_title:nnnnn #1#2#3#4#5 { - \__wheelchart_if_text:nn {#1} + \__wheelchart_if_text:nnn {#1} { o } { \node [ anchor = #2 , align = #3 , / wheelchart / #1_style ] at ( $ (#4) + ( 0 , { #5 * ( \pgfkeysvalueof { / wheelchart / #1~sep } ) } ) $ ) @@ -282,12 +287,12 @@ { \fp_eval:n { - ( 1 - (#1) ) * \cs:w g__wheelchart_slice_inner_start_angle_\WCcount _fp\cs_end: - + (#1) * \cs:w g__wheelchart_slice_inner_end_angle_\WCcount _fp\cs_end: + ( 1 - (#1) ) * \cs:w g__wheelchart_slice_inner_start_angle_\WCcount _fp \cs_end: + + (#1) * \cs:w g__wheelchart_slice_inner_end_angle_\WCcount _fp \cs_end: + \l__wheelchart_counter_or_clockwise_fp * (#2) } } - { \fp_eval:n { \cs:w g__wheelchart_inner_radius_\WCcount _fp\cs_end: - (#4) } } + { \fp_eval:n { \cs:w g__wheelchart_inner_radius_\WCcount _fp \cs_end: - (#4) } } ) ! { \fp_eval:n {#3} } ! ( @@ -295,12 +300,12 @@ { \fp_eval:n { - ( 1 - (#1) ) * \cs:w g__wheelchart_slice_outer_start_angle_\WCcount _fp\cs_end: - + (#1) * \cs:w g__wheelchart_slice_outer_end_angle_\WCcount _fp\cs_end: + ( 1 - (#1) ) * \cs:w g__wheelchart_slice_outer_start_angle_\WCcount _fp \cs_end: + + (#1) * \cs:w g__wheelchart_slice_outer_end_angle_\WCcount _fp \cs_end: + \l__wheelchart_counter_or_clockwise_fp * (#2) } } - { \fp_eval:n { \cs:w g__wheelchart_outer_radius_\WCcount _fp\cs_end: + (#4) } } + { \fp_eval:n { \cs:w g__wheelchart_outer_radius_\WCcount _fp \cs_end: + (#4) } } ) $%note the () around the #i's to keep these contents together } @@ -374,10 +379,10 @@ \path let \p { l__wheelchart_def_angle_1 } = \__wheelchart_point_plot_true:nnnnn { \WCcount } {#1} {#2} { 0 } - { \fp_eval:n { (#4) + 1 / \cs:w g__wheelchart_samples_\WCcount _fp\cs_end: } } , + { \fp_eval:n { (#4) + 1 / \cs:w g__wheelchart_samples_\WCcount _fp \cs_end: } } , \p { l__wheelchart_def_angle_2 } = \__wheelchart_point_plot_true:nnnnn { \WCcount } {#1} {#2} { 1 } - { \fp_eval:n { (#4) + 1 / \cs:w g__wheelchart_samples_\WCcount _fp\cs_end: } } + { \fp_eval:n { (#4) + 1 / \cs:w g__wheelchart_samples_\WCcount _fp \cs_end: } } in [ / utils / exec = { \__wheelchart_def_angle_aux: } ] ; } @@ -392,10 +397,10 @@ { ( 1 - (#2) ) * ( - \cs:w g__wheelchart_slice_outer_start_angle_#1_fp\cs_end: - - \cs:w g__wheelchart_slice_inner_start_angle_#1_fp\cs_end: + \cs:w g__wheelchart_slice_outer_start_angle_#1_fp \cs_end: + - \cs:w g__wheelchart_slice_inner_start_angle_#1_fp \cs_end: ) - + (#2) * ( \cs:w g__wheelchart_slice_outer_end_angle_#1_fp\cs_end: - \cs:w g__wheelchart_slice_inner_end_angle_#1_fp\cs_end: ) + + (#2) * ( \cs:w g__wheelchart_slice_outer_end_angle_#1_fp \cs_end: - \cs:w g__wheelchart_slice_inner_end_angle_#1_fp \cs_end: ) } \cs_new:Npn \__wheelchart_def_angle_plot_false:nnnnn #1#2#3#4#5 @@ -410,11 +415,11 @@ ( sqrt ( - ( \cs:w g__wheelchart_outer_radius_#1_fp\cs_end: + \cs:w g__wheelchart_inner_radius_#1_fp\cs_end: ) ^ 2 - - \cs:w g__wheelchart_outer_radius_#1_fp\cs_end: * \cs:w g__wheelchart_inner_radius_#1_fp\cs_end: * + ( \cs:w g__wheelchart_outer_radius_#1_fp \cs_end: + \cs:w g__wheelchart_inner_radius_#1_fp \cs_end: ) ^ 2 + - \cs:w g__wheelchart_outer_radius_#1_fp \cs_end: * \cs:w g__wheelchart_inner_radius_#1_fp \cs_end: * ( 2 + 2 * cosd ( \__wheelchart_def_angle_plot_false_aux_angle:nn {#1} {#2} ) - + \cs:w g__wheelchart_outer_radius_#1_fp\cs_end: * \cs:w g__wheelchart_inner_radius_#1_fp\cs_end: + + \cs:w g__wheelchart_outer_radius_#1_fp \cs_end: * \cs:w g__wheelchart_inner_radius_#1_fp \cs_end: * ( ( @@ -425,25 +430,25 @@ ) ) ) - + \cs:w g__wheelchart_inner_radius_#1_fp\cs_end: * + + \cs:w g__wheelchart_inner_radius_#1_fp \cs_end: * ( - \cs:w g__wheelchart_inner_radius_#1_fp\cs_end: - - \cs:w g__wheelchart_outer_radius_#1_fp\cs_end: + \cs:w g__wheelchart_inner_radius_#1_fp \cs_end: + - \cs:w g__wheelchart_outer_radius_#1_fp \cs_end: * cosd ( \__wheelchart_def_angle_plot_false_aux_angle:nn {#1} {#2} ) ) / \__wheelchart_def_radius:nnn {#1} {#4} {#5} ) - * \cs:w g__wheelchart_outer_radius_#1_fp\cs_end: * sind ( \__wheelchart_def_angle_plot_false_aux_angle:nn {#1} {#2} ) + * \cs:w g__wheelchart_outer_radius_#1_fp \cs_end: * sind ( \__wheelchart_def_angle_plot_false_aux_angle:nn {#1} {#2} ) / ( - ( \cs:w g__wheelchart_outer_radius_#1_fp\cs_end: + \cs:w g__wheelchart_inner_radius_#1_fp\cs_end: ) ^ 2 - - 2 * \cs:w g__wheelchart_outer_radius_#1_fp\cs_end: * \cs:w g__wheelchart_inner_radius_#1_fp\cs_end: + ( \cs:w g__wheelchart_outer_radius_#1_fp \cs_end: + \cs:w g__wheelchart_inner_radius_#1_fp \cs_end: ) ^ 2 + - 2 * \cs:w g__wheelchart_outer_radius_#1_fp \cs_end: * \cs:w g__wheelchart_inner_radius_#1_fp \cs_end: * ( 1 + cosd ( \__wheelchart_def_angle_plot_false_aux_angle:nn {#1} {#2} ) ) ) ) } - + ( 1 - (#2) ) * ( \cs:w g__wheelchart_slice_inner_start_angle_#1_fp\cs_end: ) - + (#2) * ( \cs:w g__wheelchart_slice_inner_end_angle_#1_fp\cs_end: ) + + ( 1 - (#2) ) * ( \cs:w g__wheelchart_slice_inner_start_angle_#1_fp \cs_end: ) + + (#2) * ( \cs:w g__wheelchart_slice_inner_end_angle_#1_fp \cs_end: ) + \l__wheelchart_counter_or_clockwise_fp * (#3) } } @@ -451,7 +456,7 @@ \cs_new_protected:Npn \__wheelchart_def_coord:nnnn #1#2#3#4 { \path let \p { l__wheelchart_coord } = - ( \cs:w __wheelchart_#2_plot:nn\cs_end: {#4} { \fp_use:c { g__wheelchart_#2_radius_\WCcount _fp } } ) + ( \cs:w __wheelchart_#2_plot:nn \cs_end: {#4} { \fp_use:c { g__wheelchart_#2_radius_\WCcount _fp } } ) in [ / utils / exec = @@ -484,11 +489,11 @@ < \l__wheelchart_gap_fp ? - min ( \cs:w g__wheelchart_abs_half_angle_minus_new_angle_\WCcount _fp\cs_end: , \l__wheelchart_gap_max_angle_def_fp ) + min ( \cs:w g__wheelchart_abs_half_angle_minus_new_angle_\WCcount _fp \cs_end: , \l__wheelchart_gap_max_angle_def_fp ) : asind ( min ( \l__wheelchart_gap_fp / ( (#2) + 1 - sign (#2) ) , 1 ) ) + \l__wheelchart_gap_polar_fp - %note the min ( ... , 1 ) such that the asind is always defined - %also note the + 1 - sign (#2) such that the denominator is also nonzero if #2 = 0 + %note the min ( ... , 1 ) so that the asind is always defined + %also note the + 1 - sign (#2) so that the denominator is also nonzero if #2 = 0 } } @@ -516,7 +521,7 @@ : \g__wheelchart_new_angle_fp - \g__wheelchart_angle_fp ) - / \cs:w g__wheelchart_samples_1_fp\cs_end: + / \cs:w g__wheelchart_samples_1_fp \cs_end: } \path let \p { l__wheelchart_slices_orientation_1 } = @@ -579,8 +584,8 @@ { \fp_eval:n { - ( 1 - (#2) ) * ( \cs:w g__wheelchart_inner_radius_#1_fp\cs_end: - (#3) ) - + (#2) * ( \cs:w g__wheelchart_outer_radius_#1_fp\cs_end: + (#3) ) + ( 1 - (#2) ) * ( \cs:w g__wheelchart_inner_radius_#1_fp \cs_end: - (#3) ) + + (#2) * ( \cs:w g__wheelchart_outer_radius_#1_fp \cs_end: + (#3) ) } } @@ -591,26 +596,26 @@ { \fp_gset:cn { g__wheelchart_slice_#1_#2_angle_\WCcount _fp } { - \cs:w g__wheelchart_#3angle_fp\cs_end: + + \cs:w g__wheelchart_#3angle_fp \cs_end: + ( \l__wheelchart_counter_or_clockwise_fp * - ( (#4) * \cs:w g__wheelchart_#1_gap_\WCcount _fp\cs_end: + \cs:w l__wheelchart_slices_#1_#2_angle_shift_fp\cs_end: ) + ( (#4) * \cs:w g__wheelchart_#1_gap_\WCcount _fp \cs_end: + \cs:w l__wheelchart_slices_#1_#2_angle_shift_fp \cs_end: ) ) } } { \fp_gset:cn { g__wheelchart_slice_#1_#2_angle_\WCcount _fp } { - \cs:w g__wheelchart_#3angle_fp\cs_end: + + \cs:w g__wheelchart_#3angle_fp \cs_end: + ( \l__wheelchart_counter_or_clockwise_fp * ( - (#4) * \cs:w g__wheelchart_#1_gap_\WCcount _fp\cs_end: + \cs:w l__wheelchart_slices_#1_#2_angle_shift_fp\cs_end: + (#4) * \cs:w g__wheelchart_#1_gap_\WCcount _fp \cs_end: + \cs:w l__wheelchart_slices_#1_#2_angle_shift_fp \cs_end: - asind ( - \cs:w g__wheelchart_inner_radius_\WCcount _fp\cs_end: - * sind ( \cs:w l__wheelchart_slices_#1_#2_angle_shift_fp\cs_end: ) - / \cs:w g__wheelchart_outer_radius_\WCcount _fp\cs_end: + \cs:w g__wheelchart_inner_radius_\WCcount _fp \cs_end: + * sind ( \cs:w l__wheelchart_slices_#1_#2_angle_shift_fp \cs_end: ) + / \cs:w g__wheelchart_outer_radius_\WCcount _fp \cs_end: ) ) ) @@ -620,8 +625,8 @@ \cs_new_protected:Npn \__wheelchart_def_slice_keys:n #1 { - {%note the double {{...}} such that the contents is in a group - %such that pgfkeys which are specific to the current slice are local for this slice + {%note the double braces {{...}} so that the contents is in a group + %and in particular, pgfkeys which are specific to the current slice are local for this slice \clist_if_in:NVT \l__wheelchart_slice_range_local_clist \WCcount { \pgfkeys { / wheelchart , slice_final /. expanded = { \exp_not:v { l__wheelchart_slice_\WCcount _keys_clist } } } @@ -663,24 +668,24 @@ %g__wheelchart_WCcount_counter to be larger than \WCtotalcount \tl_build_end:N \WClegend \cs_set:Npn \WCcount { \theg__wheelchart_WCcount_counter } - \cs_set:Npn \WCpercentage { \cs:w l__wheelchart_WCpercentage_\theg__wheelchart_WCcount_counter\cs_end: } - \cs_set:Npn \WCpercentagerounded { \cs:w l__wheelchart_WCpercentagerounded_\theg__wheelchart_WCcount_counter\cs_end: } + \cs_set:Npn \WCpercentage { \cs:w l__wheelchart_WCpercentage_\theg__wheelchart_WCcount_counter \cs_end: } + \cs_set:Npn \WCpercentagerounded { \cs:w l__wheelchart_WCpercentagerounded_\theg__wheelchart_WCcount_counter \cs_end: } \str_if_eq:eeTF { \l__wheelchart_type_tl } { etoc } { \cs_set:Npn \WCetocthelinkedname - { \cs:w g__wheelchart_etoc_item_\l__wheelchart_etoc_name_tl _the_linked_name_\theg__wheelchart_WCcount_counter\cs_end: } + { \cs:w g__wheelchart_etoc_item_\l__wheelchart_etoc_name_tl _the_linked_name_\theg__wheelchart_WCcount_counter \cs_end: } \cs_set:Npn \WCetocthelinkednumber - { \cs:w g__wheelchart_etoc_item_\l__wheelchart_etoc_name_tl _the_linked_number_\theg__wheelchart_WCcount_counter\cs_end: } + { \cs:w g__wheelchart_etoc_item_\l__wheelchart_etoc_name_tl _the_linked_number_\theg__wheelchart_WCcount_counter \cs_end: } \cs_set:Npn \WCetocthelinkedpage - { \cs:w g__wheelchart_etoc_item_\l__wheelchart_etoc_name_tl _the_linked_page_\theg__wheelchart_WCcount_counter\cs_end: } + { \cs:w g__wheelchart_etoc_item_\l__wheelchart_etoc_name_tl _the_linked_page_\theg__wheelchart_WCcount_counter \cs_end: } \cs_set:Npn \WCetocthename - { \cs:w g__wheelchart_etoc_item_\l__wheelchart_etoc_name_tl _the_name_\theg__wheelchart_WCcount_counter\cs_end: } + { \cs:w g__wheelchart_etoc_item_\l__wheelchart_etoc_name_tl _the_name_\theg__wheelchart_WCcount_counter \cs_end: } \cs_set:Npn \WCetocthenumber - { \cs:w g__wheelchart_etoc_item_\l__wheelchart_etoc_name_tl _the_number_\theg__wheelchart_WCcount_counter\cs_end: } + { \cs:w g__wheelchart_etoc_item_\l__wheelchart_etoc_name_tl _the_number_\theg__wheelchart_WCcount_counter \cs_end: } \cs_set:Npn \WCetocthepage - { \cs:w g__wheelchart_etoc_item_\l__wheelchart_etoc_name_tl _the_page_\theg__wheelchart_WCcount_counter\cs_end: } + { \cs:w g__wheelchart_etoc_item_\l__wheelchart_etoc_name_tl _the_page_\theg__wheelchart_WCcount_counter \cs_end: } \cs_set:Npn \WCetocthenumberofpages - { \cs:w g__wheelchart_etoc_item_\l__wheelchart_etoc_name_tl _the_number_of_pages_\theg__wheelchart_WCcount_counter\cs_end: } + { \cs:w g__wheelchart_etoc_item_\l__wheelchart_etoc_name_tl _the_number_of_pages_\theg__wheelchart_WCcount_counter \cs_end: } } { \clist_if_empty:NTF \l__wheelchart_header_clist @@ -688,7 +693,7 @@ \int_step_inline:nn { \l__wheelchart_max_list_items_int } { \cs_set:cpn { WCvar\int_to_Alph:n {##1} } - { \cs:w l__wheelchart_item_WCvar\int_to_Alph:n {##1}_\theg__wheelchart_WCcount_counter\cs_end: } + { \cs:w l__wheelchart_item_WCvar\int_to_Alph:n {##1}_\theg__wheelchart_WCcount_counter \cs_end: } } } { @@ -717,13 +722,13 @@ ( atand ( - \cs:w g__wheelchart_#3_y_fp\cs_end: - \cs:w g__wheelchart_#4_y_fp\cs_end: , - \cs:w g__wheelchart_#3_x_fp\cs_end: - \cs:w g__wheelchart_#4_x_fp\cs_end: + \cs:w g__wheelchart_#3_y_fp \cs_end: - \cs:w g__wheelchart_#4_y_fp \cs_end: , + \cs:w g__wheelchart_#3_x_fp \cs_end: - \cs:w g__wheelchart_#4_x_fp \cs_end: ) - atand ( - \cs:w g__wheelchart_#1_y_fp\cs_end: - \cs:w g__wheelchart_#2_y_fp\cs_end: , - \cs:w g__wheelchart_#1_x_fp\cs_end: - \cs:w g__wheelchart_#2_x_fp\cs_end: + \cs:w g__wheelchart_#1_y_fp \cs_end: - \cs:w g__wheelchart_#2_y_fp \cs_end: , + \cs:w g__wheelchart_#1_x_fp \cs_end: - \cs:w g__wheelchart_#2_x_fp \cs_end: ) ) } @@ -969,9 +974,9 @@ \__wheelchart_for_loop:n { \pgfkeysvalueof { / wheelchart / before~slices } - \int_step_inline:nn { \fp_eval:n { round ( \cs:w g__wheelchart_value_\WCcount _fp\cs_end: ) } } - %note that \fp_eval:n { round ( ... ) } is necessary even when the value is an integer because if parse=pgfmath - %then .0 is added and then \int_step_inline:nn { \cs:w g__wheelchart_value_\WCcount _fp\cs_end: } would give the messages + \int_step_inline:nn { \fp_eval:n { round ( \cs:w g__wheelchart_value_\WCcount _fp \cs_end: ) } } + %note that \fp_eval:n { round ( ... ) } is necessary even when the value is an integer because pgfmath + %could have added .0 and then \int_step_inline:nn { \cs:w g__wheelchart_value_\WCcount _fp \cs_end: } would give the messages %Missing character: There is no . in font nullfont! Missing character: There is no 0 in font nullfont! { \int_gincr:N \g__wheelchart_discrete_count_int @@ -1082,7 +1087,7 @@ \cs_set:Npe \WCmidangle { \fp_use:c { g__wheelchart_WCmidangle_\WCcount _fp } } \pgfkeysvalueof { / wheelchart / for~loop~start }%this must be placed after the definition of macros such as \WCpercentage - %such that these macros can be used in the key for loop start + %so that these macros can be used in the key for loop start \begin { scope } [ shift = { ( \WCmidangle \c_colon_str \fp_use:c { g__wheelchart_explode_\WCcount _fp } ) } , @@ -1161,16 +1166,21 @@ \fp_gset:cn { g__wheelchart_#1_\WCcount _fp } { \pgfmathresult } } -\cs_new_protected:Npn \__wheelchart_if_text:nn #1#2 +\cs_new_protected:Npn \__wheelchart_if_text:nnn #1#2#3 { %https://tex.stackexchange.com/questions/42280/expand-away-empty-macros-within-ifthenelse %https://tex.stackexchange.com/questions/44919/proper-way-to-detect-empty-blank-text \begin { pgfinterruptpicture } + \DeclareDocumentCommand \\ {#2} {} + %for arc data, \\ is used with seq_set_split so has no optional argument thus then #2 is empty + %otherwise, #2 is o + %no s because an optional star does not apply in a node + %no ! because a space between \\ and its optional argument is allowed in a node %https://tex.stackexchange.com/questions/459853/savebox-within-tikzpicture-results-in-an-empty-savebox \hbox_gset:Nn \g__wheelchart_if_text_box { \pgfkeysvalueof { / wheelchart / #1 } } \end { pgfinterruptpicture } \dim_compare:nNnT { \box_wd:N \g__wheelchart_if_text_box } > { 0 pt } - { {#2} } + { {#3} } } \cs_new_protected:Npn \__wheelchart_initial:n #1 @@ -1182,7 +1192,7 @@ \tl_if_empty:nTF {#1} { \cs_set:Npn \WCtotalcount { 0 } } { - \cs:w seq_set_split:Ne\l__wheelchart_expand_list_tl\cs_end: + \cs:w seq_set_split:Ne\l__wheelchart_expand_list_tl \cs_end: \l__wheelchart_list_seq { \pgfkeysvalueof { / wheelchart / separator~rows } } {#1} @@ -1190,7 +1200,7 @@ \int_zero:N \l__wheelchart_max_list_items_int \seq_map_indexed_inline:Nn \l__wheelchart_list_seq { - \cs:w seq_set_split:Ne\l__wheelchart_expand_list_items_tl\cs_end: + \cs:w seq_set_split:Ne\l__wheelchart_expand_list_items_tl \cs_end: \l__wheelchart_list_items_seq { \pgfkeysvalueof { / wheelchart / separator~columns } } {##2} @@ -1245,7 +1255,7 @@ \etocsetnexttocdepth { -1 }%only for the next toc \etocsetstyle { \l__wheelchart_etoc_level_tl } {} {} { - \int_compare:nNnT { \cs:w g__wheelchart_etoc_item_\l__wheelchart_etoc_name_tl _count_int\cs_end: } > { 0 } + \int_compare:nNnT { \cs:w g__wheelchart_etoc_item_\l__wheelchart_etoc_name_tl _count_int \cs_end: } > { 0 } { \cs_gset:cpe { @@ -1304,7 +1314,7 @@ {} \int_gzero_new:c { g__wheelchart_etoc_item_\l__wheelchart_etoc_name_tl _count_int } \pgfkeysvalueof { / wheelchart / etoc~code } - \int_compare:nNnT { \cs:w g__wheelchart_etoc_item_\l__wheelchart_etoc_name_tl _count_int\cs_end: } > { 0 } + \int_compare:nNnT { \cs:w g__wheelchart_etoc_item_\l__wheelchart_etoc_name_tl _count_int \cs_end: } > { 0 } { \cs_gset:cpe { @@ -1331,32 +1341,32 @@ { \__wheelchart_def_slice_keys:n { \__wheelchart_gdef_count_fp:nn { value } { value } } - \cs_set:Npe \WCtotalnum { \fp_eval:n { \WCtotalnum + \cs:w g__wheelchart_value_\WCcount _fp\cs_end: } } + \cs_set:Npe \WCtotalnum { \fp_eval:n { \WCtotalnum + \cs:w g__wheelchart_value_\WCcount _fp \cs_end: } } } \int_step_inline:nn { \WCtotalcount } { \cs_set:cpe { l__wheelchart_WCpercentage_##1 } - { \fp_eval:n { \cs:w g__wheelchart_value_##1_fp\cs_end: / ( \WCtotalnum / 100 ) } } + { \fp_eval:n { \cs:w g__wheelchart_value_##1_fp \cs_end: / ( \WCtotalnum / 100 ) } } \cs_set:cpe { l__wheelchart_WCpercentagerounded_##1 } - { \fp_eval:n { round ( \cs:w l__wheelchart_WCpercentage_##1\cs_end: , \pgfkeysvalueof { / wheelchart / perc~precision } ) } } + { \fp_eval:n { round ( \cs:w l__wheelchart_WCpercentage_##1 \cs_end: , \pgfkeysvalueof { / wheelchart / perc~precision } ) } } } } \cs_new_protected:Npn \__wheelchart_inner_and_wheel_data:n #1 { - \__wheelchart_if_text:nn { #1~data } + \__wheelchart_if_text:nnn { #1~data } { o } { \__wheelchart_def_fp:nn { #1_data_angle_pos } { #1~data~angle~pos } \__wheelchart_def_fp:nn { #1_data_angle_shift } { #1~data~angle~shift } \__wheelchart_def_fp:nn { #1_data_pos } { #1~data~pos } \__wheelchart_def_fp:nn { #1_data_sep } { #1~data~sep } \node [ align = left , / wheelchart / #1_data_style ] at - \cs:w __wheelchart_point_plot_\bool_to_str:N \l__wheelchart_plot_bool :nnnnn\cs_end: + \cs:w __wheelchart_point_plot_\bool_to_str:N \l__wheelchart_plot_bool :nnnnn \cs_end: { \WCcount } - { \cs:w l__wheelchart_#1_data_angle_pos_fp\cs_end: } - { \cs:w l__wheelchart_#1_data_angle_shift_fp\cs_end: } - { \cs:w l__wheelchart_#1_data_pos_fp\cs_end: } - { \cs:w l__wheelchart_#1_data_sep_fp\cs_end: } + { \cs:w l__wheelchart_#1_data_angle_pos_fp \cs_end: } + { \cs:w l__wheelchart_#1_data_angle_shift_fp \cs_end: } + { \cs:w l__wheelchart_#1_data_pos_fp \cs_end: } + { \cs:w l__wheelchart_#1_data_sep_fp \cs_end: } { \pgfkeysvalueof { / wheelchart / #1~data } } ; } } @@ -1366,13 +1376,13 @@ \cs_new_protected:Npn \__wheelchart_legend_append:nn #1#2 { - \tl_build_put_right:NV \WClegend \l__wheelchart_legend_row_tl%note the V specifier such that \WClegend can also be combined - %with an S column of the package siunitx and such that \WClegend can be used in a tblr environment of the package tabularray + \tl_build_put_right:NV \WClegend \l__wheelchart_legend_row_tl%note the V specifier so that \WClegend can also be combined + %with an S column of the package siunitx and so that \WClegend can be used in a tblr environment of the package tabularray %and then the option expand=\WClegend needs to be given to the tblr environment \tl_build_put_right:Nn \WClegend { \protect \setcounter { g__wheelchart_WCcount_counter } }%note the \protect for in case that %\WClegend would be parsed in a particular way %note that the counter g__wheelchart_WCcount_counter is defined globally and at the end of the previous \l__wheelchart_legend_row_tl - %such that this value is defined and has the right value at the start of the next \l__wheelchart_legend_row_tl + %so that this value is defined and has the right value at the start of the next \l__wheelchart_legend_row_tl %if \WClegend is used in a tblr environment of the package tabularray then \UseTblrLibrary{counter} is required \tl_build_put_right:Ne \WClegend { { \int_eval:n {#1} } } \tl_build_put_right:Nn \WClegend {#2} @@ -1414,8 +1424,8 @@ { atand ( - \cs:w g__wheelchart_#3_y_fp\cs_end: - \cs:w g__wheelchart_#4_y_fp\cs_end: , - \cs:w g__wheelchart_#3_x_fp\cs_end: - \cs:w g__wheelchart_#4_x_fp\cs_end: + \cs:w g__wheelchart_#3_y_fp \cs_end: - \cs:w g__wheelchart_#4_y_fp \cs_end: , + \cs:w g__wheelchart_#3_x_fp \cs_end: - \cs:w g__wheelchart_#4_x_fp \cs_end: ) } \fp_set:Nn \l__wheelchart_slices_arc_coord_fp @@ -1440,7 +1450,7 @@ ) : atand ( ( \l__wheelchart_slices_arc_A_fp - ( 1 / \l__wheelchart_slices_arc_A_fp ) ) / 2 ) - }%note the min ( \l__wheelchart_slices_arc_B_fp , 0 ) such that the acosd is always defined + }%note the min ( \l__wheelchart_slices_arc_B_fp , 0 ) so that the acosd is always defined } } ] @@ -1486,8 +1496,8 @@ * abs ( ( 1 / \l__wheelchart_slices_arc_A_fp ) + \l__wheelchart_slices_arc_A_fp ) * sqrt ( - ( \cs:w g__wheelchart_#3_x_fp\cs_end: - \cs:w g__wheelchart_#4_x_fp\cs_end: ) ^ 2 - + ( \cs:w g__wheelchart_#3_y_fp\cs_end: - \cs:w g__wheelchart_#4_y_fp\cs_end: ) ^ 2 + ( \cs:w g__wheelchart_#3_x_fp \cs_end: - \cs:w g__wheelchart_#4_x_fp \cs_end: ) ^ 2 + + ( \cs:w g__wheelchart_#3_y_fp \cs_end: - \cs:w g__wheelchart_#4_y_fp \cs_end: ) ^ 2 ) } } @@ -1539,11 +1549,11 @@ \fp_eval:n { ( - \cs:w g__wheelchart_#3_x_fp\cs_end: + \cs:w g__wheelchart_#4_x_fp\cs_end: + + \cs:w g__wheelchart_#3_x_fp \cs_end: + \cs:w g__wheelchart_#4_x_fp \cs_end: + ( \g__wheelchart_slices_orientation_fp * ( \l__wheelchart_slices_arrow_coord_fp - 1 ) * \l__wheelchart_slices_arrow_A_fp - * ( \cs:w g__wheelchart_#3_y_fp\cs_end: - \cs:w g__wheelchart_#4_y_fp\cs_end: ) + * ( \cs:w g__wheelchart_#3_y_fp \cs_end: - \cs:w g__wheelchart_#4_y_fp \cs_end: ) ) ) / 2 @@ -1552,11 +1562,11 @@ \fp_eval:n { ( - \cs:w g__wheelchart_#3_y_fp\cs_end: + \cs:w g__wheelchart_#4_y_fp\cs_end: + + \cs:w g__wheelchart_#3_y_fp \cs_end: + \cs:w g__wheelchart_#4_y_fp \cs_end: + ( \g__wheelchart_slices_orientation_fp * ( \l__wheelchart_slices_arrow_coord_fp - 1 ) * \l__wheelchart_slices_arrow_A_fp - * ( \cs:w g__wheelchart_#4_x_fp\cs_end: - \cs:w g__wheelchart_#3_x_fp\cs_end: ) + * ( \cs:w g__wheelchart_#4_x_fp \cs_end: - \cs:w g__wheelchart_#3_x_fp \cs_end: ) ) ) / 2 @@ -1593,10 +1603,10 @@ { \fp_eval:n { - ( 1 - (#1) / max ( round ( \cs:w g__wheelchart_value_\WCcount _fp\cs_end: ) , 1 ) ) - * \cs:w g__wheelchart_slice_#2_start_angle_\WCcount _fp\cs_end: - + (#1) * \cs:w g__wheelchart_slice_#2_end_angle_\WCcount _fp\cs_end: - / max ( round ( \cs:w g__wheelchart_value_\WCcount _fp\cs_end: ) , 1 ) + ( 1 - (#1) / max ( round ( \cs:w g__wheelchart_value_\WCcount _fp \cs_end: ) , 1 ) ) + * \cs:w g__wheelchart_slice_#2_start_angle_\WCcount _fp \cs_end: + + (#1) * \cs:w g__wheelchart_slice_#2_end_angle_\WCcount _fp \cs_end: + / max ( round ( \cs:w g__wheelchart_value_\WCcount _fp \cs_end: ) , 1 ) } } @@ -1617,17 +1627,19 @@ arc_style /. style = {} , arc~around~line /. initial = 1 , arc~around~text /. default = true ,%this key is not set up with /.is choice or \bool_set:Nn - %such that for example \WCvarA can be used as value for this key + %so that for example \WCvarA can be used as value for this key arc~around~text /. initial = false , arc~data /. initial = {} , arc~data~align /. code = { \tl_set:Nn \l__wheelchart_arc_data_align_tl {#1} } ,%this key is not set up with /.is choice - %such that for example \WCvarA can be used as value for this key + %so that for example \WCvarA can be used as value for this key arc~data~align = center , arc~data~angle~pos /. initial = 0.5 , arc~data~angle~shift /. initial = 0 , arc~data~dir /. initial = 1 , arc~data~expand /. initial = n , arc~data~line~sep~factor /. initial = 1 , + arc~data~lines~pos /. initial = 0.5 , + arc~data~lines~shift /. initial = 0 , arc~data~pos /. initial = 1 , arc~data~sep /. initial = 1 ex / 1 cm , arc~data~style /. style = { arc_data_style /. style = {#1} } , @@ -1640,7 +1652,7 @@ arc~sep /. initial = 1 ex / 1 cm , at /. initial = { ( 0 , 0 ) } , before~slices /. initial = {} , - bool_set_true /. code = { \bool_set_true:N #1 } , + bool_set_true /. code = \bool_set_true:N #1 , caption /. initial = {} , caption~left /. initial = {} , caption~left~sep /. initial = 0.5 , @@ -1670,9 +1682,9 @@ data~style /. style = { data_style /. style = {#1} } , data_style /. style = {} , discrete /. is~choice , - discrete / false /. code = { \bool_set_false:N \l__wheelchart_discrete_bool } , + discrete / false /. code = \bool_set_false:N \l__wheelchart_discrete_bool , discrete / false /. value~forbidden , - discrete / true /. code = { \bool_set_true:N \l__wheelchart_discrete_bool } , + discrete / true /. code = \bool_set_true:N \l__wheelchart_discrete_bool , discrete / true /. value~forbidden , discrete /. default = true , discrete = false , @@ -1777,7 +1789,7 @@ legend /. initial = {} , legend~columns /. initial = 1 , legend~entry /. initial = {} , - legend~only /. code = { \bool_set:Nn \l__wheelchart_legend_only_bool { \cs:w c_#1_bool\cs_end: } } , + legend~only /. code = \bool_set:Nn \l__wheelchart_legend_only_bool { \cs:w c_#1_bool \cs_end: } , legend~only /. default = true , legend~only = false , legend~row /. code = @@ -1800,7 +1812,7 @@ } , lines~ext~dirsep /. initial = 0 , lines~ext~fixed /. default = true ,%this key is not set up with /.is choice or \bool_set:Nn - %such that for example \WCvarA can be used as value for this key + %so that for example \WCvarA can be used as value for this key lines~ext~fixed /. initial = false , lines~ext~fixed~left /. initial = { @@ -1808,7 +1820,7 @@ { \l__wheelchart_lines_ext_dir_int * ( - \cs:w g__wheelchart_outer_radius_\WCcount _fp\cs_end: + \l__wheelchart_lines_sep_fp + \cs:w g__wheelchart_outer_radius_\WCcount _fp \cs_end: + \l__wheelchart_lines_sep_fp + \l__wheelchart_lines_fp + \l__wheelchart_lines_ext_fp ) } @@ -1819,7 +1831,7 @@ { \l__wheelchart_lines_ext_dir_int * ( - \cs:w g__wheelchart_outer_radius_\WCcount _fp\cs_end: + \l__wheelchart_lines_sep_fp + \cs:w g__wheelchart_outer_radius_\WCcount _fp \cs_end: + \l__wheelchart_lines_sep_fp + \l__wheelchart_lines_fp + \l__wheelchart_lines_ext_fp ) } @@ -1870,7 +1882,7 @@ outer_plot_style /. style = {} , outer~radius /. initial = 3 , perc~precision /. initial = 0 , - pie /. code = { \bool_set:Nn \l__wheelchart_pie_bool { \cs:w c_#1_bool\cs_end: } } , + pie /. code = \bool_set:Nn \l__wheelchart_pie_bool { \cs:w c_#1_bool \cs_end: } , pie /. default = true , pie = false , plot /. style = @@ -2029,12 +2041,12 @@ } , slices~inner /. initial = { - \fp_compare:nNnT { \cs:w g__wheelchart_inner_radius_\WCcount _fp\cs_end: } > { 0 } + \fp_compare:nNnT { \cs:w g__wheelchart_inner_radius_\WCcount _fp \cs_end: } > { 0 } { \fp_compare:nNnT - { \cs:w g__wheelchart_inner_gap_\WCcount _fp\cs_end: } + { \cs:w g__wheelchart_inner_gap_\WCcount _fp \cs_end: } < - { \cs:w g__wheelchart_abs_half_angle_minus_new_angle_\WCcount _fp\cs_end: } + { \cs:w g__wheelchart_abs_half_angle_minus_new_angle_\WCcount _fp \cs_end: } { arc [ @@ -2212,7 +2224,7 @@ {} } } , - slices~start~arrow/.style~2~args = + slices~start~arrow /. style~2~args = { slices~start = { @@ -2241,13 +2253,13 @@ (#1) - \fp_eval:n { - \l__wheelchart_counter_or_clockwise_fp * \cs:w g__wheelchart_value_1_fp\cs_end: * 0.5 + \l__wheelchart_counter_or_clockwise_fp * \cs:w g__wheelchart_value_1_fp \cs_end: * 0.5 * ( \l__wheelchart_total_angle_fp / \WCtotalnum ) } } } , start~half /. default = 90 , - title /. initial= {} , + title /. initial = {} , title~left /. initial = {} , title~left~sep /. initial = 0.5 , title~left~style /. style = { title~left_style /. style = {#1} } , @@ -2283,13 +2295,13 @@ { \cs_set:cpn {#1} { \use:e { \clist_item:nn {#2} { \int_mod:nn { \WCcount - 1 } { \clist_count:n {#2} } + 1 } } } - %note the \use:e such that \WClist<name> also works when given as an argument to pgfmath + %note the \use:e so that \WClist<name> also works when given as an argument to pgfmath %if the list contains a macro, for example %\begin{tikzpicture} %\def\n{1} %\wheelchart[ - % value=\WClistA, - % WClistA={\n} + % value=\WClistA, + % WClistA=\n %]{\exampleforthismanual} %\end{tikzpicture} %https://tex.stackexchange.com/questions/671298/clist-item-and-pgfmathsetmacro-causing-an-error @@ -2331,18 +2343,18 @@ { \tl_set:Ne \l__wheelchart_key_name_tl { \pgfkeyscurrentname }%it is necessary to define \l__wheelchart_key_name_tl %because \pgfkeyscurrentname will be overwritten by / errors / unknown~key /. expanded - \regex_match:nVTF { \{(.+)\} } \l__wheelchart_key_name_tl + \regex_match:NVTF \c__wheelchart_braces_regex \l__wheelchart_key_name_tl { \tl_set:Ne \l__wheelchart_key_range_tl { \pgfkeyscurrentname } - \regex_replace_all:nnN { \{(.+)\} } {} \l__wheelchart_key_name_tl - \regex_replace_all:nnN { [\w\s]+\{(.+)\} } { \1 } \l__wheelchart_key_range_tl + \regex_replace_all:NnN \c__wheelchart_braces_regex {} \l__wheelchart_key_name_tl + \regex_replace_all:NnN \c__wheelchart_key_braces_regex { \1 } \l__wheelchart_key_range_tl \str_if_eq:eeTF { \l__wheelchart_key_range_tl } { list } { \pgfkeys { / wheelchart , WC_list = { l__wheelchart_list_\l__wheelchart_key_name_tl } {#1} } \pgfkeys { / wheelchart , - \l__wheelchart_key_name_tl /. expand~once = { \cs:w l__wheelchart_list_\l__wheelchart_key_name_tl\cs_end: } + \l__wheelchart_key_name_tl /. expand~once = { \cs:w l__wheelchart_list_\l__wheelchart_key_name_tl \cs_end: } } } { @@ -2393,12 +2405,12 @@ \NewDocumentCommand \wheelchart { O {} m } { - {%note the double braces {{...}} such that the contents is in a group and such that & can be used in pgfmath in a tabular + {%note the double braces {{...}} so that the contents is in a group and so that & can be used in pgfmath in a tabular \pgfkeys { / wheelchart , #1 } \IfPackageLoadedTF { siunitx } { \cs_set:Npn \WCperc { \qty { \WCpercentagerounded } { \percent } } } { \cs_set:Npn \WCperc { \WCpercentagerounded \, \% } }%the definition of \WCperc is placed inside the command \wheelchart - %such that \WCperc is not defined outside this command + %so that \WCperc is not defined outside this command \bool_if:NTF \l__wheelchart_legend_only_bool { \__wheelchart_initial:n {#2} @@ -2430,7 +2442,7 @@ { \g__wheelchart_angle_fp + ( - \l__wheelchart_counter_or_clockwise_fp * \cs:w g__wheelchart_value_\WCcount _fp\cs_end: + \l__wheelchart_counter_or_clockwise_fp * \cs:w g__wheelchart_value_\WCcount _fp \cs_end: * ( \l__wheelchart_total_angle_fp / \WCtotalnum ) ) } @@ -2455,7 +2467,7 @@ \fp_gset:cn { g__wheelchart_abs_half_angle_minus_new_angle_\WCcount _fp } { abs ( \g__wheelchart_angle_fp - \g__wheelchart_new_angle_fp ) / 2 } \fp_set:Nn \l__wheelchart_abs_half_angle_minus_new_angle_minus_gap_polar_fp - { \cs:w g__wheelchart_abs_half_angle_minus_new_angle_\WCcount _fp\cs_end: - \l__wheelchart_gap_polar_fp } + { \cs:w g__wheelchart_abs_half_angle_minus_new_angle_\WCcount _fp \cs_end: - \l__wheelchart_gap_polar_fp } \fp_gzero_new:c { g__wheelchart_outer_gap_\WCcount _fp } \fp_gzero_new:c { g__wheelchart_inner_gap_\WCcount _fp } \bool_if:NTF \l__wheelchart_plot_bool @@ -2466,7 +2478,7 @@ { \fp_set:Nn \l__wheelchart_gap_max_angle_def_fp { - \cs:w g__wheelchart_inner_radius_\WCcount _fp\cs_end: > 0 + \cs:w g__wheelchart_inner_radius_\WCcount _fp \cs_end: > 0 ? 90 : @@ -2490,8 +2502,8 @@ ) ) } - \__wheelchart_def_gap:nn { outer } { \cs:w g__wheelchart_outer_radius_\WCcount _fp\cs_end: } - \__wheelchart_def_gap:nn { inner } { \cs:w g__wheelchart_inner_radius_\WCcount _fp\cs_end: } + \__wheelchart_def_gap:nn { outer } { \cs:w g__wheelchart_outer_radius_\WCcount _fp \cs_end: } + \__wheelchart_def_gap:nn { inner } { \cs:w g__wheelchart_inner_radius_\WCcount _fp \cs_end: } \fp_compare:nNnT { \l__wheelchart_abs_half_angle_minus_new_angle_minus_gap_polar_fp } > { 0.01 } { \fp_gset:cn { g__wheelchart_inner_radius_\WCcount _fp } @@ -2508,7 +2520,7 @@ ) ) , - \cs:w g__wheelchart_inner_radius_\WCcount _fp\cs_end: + \cs:w g__wheelchart_inner_radius_\WCcount _fp \cs_end: ) } } @@ -2523,14 +2535,14 @@ \__wheelchart_gdef_count_fp:nn { data_pos } { data~pos } \__wheelchart_gdef_count_fp:nn { data_sep } { data~sep } \__wheelchart_def_angle:nnnn - { \cs:w g__wheelchart_data_angle_pos_\WCcount _fp\cs_end: } - { \cs:w g__wheelchart_data_angle_shift_\WCcount _fp\cs_end: } - { \cs:w g__wheelchart_data_pos_\WCcount _fp\cs_end: } - { \cs:w g__wheelchart_data_sep_\WCcount _fp\cs_end: } + { \cs:w g__wheelchart_data_angle_pos_\WCcount _fp \cs_end: } + { \cs:w g__wheelchart_data_angle_shift_\WCcount _fp \cs_end: } + { \cs:w g__wheelchart_data_pos_\WCcount _fp \cs_end: } + { \cs:w g__wheelchart_data_sep_\WCcount _fp \cs_end: } \cs_set:Npe \WCdataangle { \pgfmathresult } \__wheelchart_gdef_count_fp:nn { explode } { explode } \pgfkeysvalueof { / wheelchart / for~loop~start }%this must be placed after the definition of macros such as - %\WCpercentage such that these macros can be used in the key for loop start + %\WCpercentage so that these macros can be used in the key for loop start \int_compare:nNnT { \WCcount } = { 1 } { \begin { scope } @@ -2601,7 +2613,7 @@ [ shift /. expanded = { - \cs:w __wheelchart_point_plot_\bool_to_str:N \l__wheelchart_plot_bool :nnnnn\cs_end: + \cs:w __wheelchart_point_plot_\bool_to_str:N \l__wheelchart_plot_bool :nnnnn \cs_end: { \WCcount } { \l__wheelchart_slices_angle_pos_fp } { \l__wheelchart_slices_angle_shift_fp } @@ -2639,9 +2651,9 @@ \__wheelchart_for_loop:n { \bool_if:NT \l__wheelchart_wheel_lines_bool - %this is placed inside \__wheelchart_for_loop:n such that wheel lines can be applied for specific slices + %this is placed inside \__wheelchart_for_loop:n so that wheel lines can be applied for specific slices { - \int_step_inline:nnn { 0 } { \fp_eval:n { round ( \cs:w g__wheelchart_value_\WCcount _fp\cs_end: ) } } + \int_step_inline:nnn { 0 } { \fp_eval:n { round ( \cs:w g__wheelchart_value_\WCcount _fp \cs_end: ) } } %note the \fp_eval:n { round ( ... ) } to avoid the messages Missing character: There is no ... in font nullfont! { \bool_if:NTF \l__wheelchart_plot_bool @@ -2783,14 +2795,14 @@ \fp_compare:nF { \l__wheelchart_lines_fp == 0 && \l__wheelchart_lines_ext_fp == 0 } { \draw [ / wheelchart / lines_style ] let \p { l__wheelchart_lines_1 } = - \cs:w __wheelchart_point_plot_\bool_to_str:N \l__wheelchart_plot_bool :nnnnn\cs_end: + \cs:w __wheelchart_point_plot_\bool_to_str:N \l__wheelchart_plot_bool :nnnnn \cs_end: { \WCcount } - { \cs:w g__wheelchart_data_angle_pos_\WCcount _fp\cs_end: } - { \cs:w g__wheelchart_data_angle_shift_\WCcount _fp\cs_end: } - { \cs:w g__wheelchart_data_pos_\WCcount _fp\cs_end: } + { \cs:w g__wheelchart_data_angle_pos_\WCcount _fp \cs_end: } + { \cs:w g__wheelchart_data_angle_shift_\WCcount _fp \cs_end: } + { \cs:w g__wheelchart_data_pos_\WCcount _fp \cs_end: } { \l__wheelchart_lines_sep_fp + \l__wheelchart_lines_fp } in - \cs:w __wheelchart_point_plot_\bool_to_str:N \l__wheelchart_plot_bool :nnnnn\cs_end: + \cs:w __wheelchart_point_plot_\bool_to_str:N \l__wheelchart_plot_bool :nnnnn \cs_end: { \WCcount } { \l__wheelchart_lines_angle_pos_fp } { \l__wheelchart_lines_angle_shift_fp } @@ -2838,7 +2850,7 @@ { \fp_eval:n { - \l__wheelchart_lines_ext_dir_int * \cs:w g__wheelchart_data_sep_\WCcount _fp\cs_end: + \l__wheelchart_lines_ext_dir_int * \cs:w g__wheelchart_data_sep_\WCcount _fp \cs_end: } } , 0 @@ -2849,7 +2861,7 @@ } ; } - \__wheelchart_if_text:nn { data } + \__wheelchart_if_text:nnn { data } { o } { \fp_compare:nNnTF { \l__wheelchart_lines_ext_fp } = { 0 } { @@ -2876,13 +2888,13 @@ \coordinate [ at = - \cs:w __wheelchart_point_plot_\bool_to_str:N \l__wheelchart_plot_bool :nnnnn\cs_end: + \cs:w __wheelchart_point_plot_\bool_to_str:N \l__wheelchart_plot_bool :nnnnn \cs_end: { \WCcount } - { \cs:w g__wheelchart_data_angle_pos_\WCcount _fp\cs_end: } - { \cs:w g__wheelchart_data_angle_shift_\WCcount _fp\cs_end: } - { \cs:w g__wheelchart_data_pos_\WCcount _fp\cs_end: } + { \cs:w g__wheelchart_data_angle_pos_\WCcount _fp \cs_end: } + { \cs:w g__wheelchart_data_angle_shift_\WCcount _fp \cs_end: } + { \cs:w g__wheelchart_data_pos_\WCcount _fp \cs_end: } { - \cs:w g__wheelchart_data_sep_\WCcount _fp\cs_end: + + \cs:w g__wheelchart_data_sep_\WCcount _fp \cs_end: + ( \l__wheelchart_lines_fp == 0 ? @@ -2902,7 +2914,7 @@ \node [ anchor = \l__wheelchart_data_anchor_tl , align = left , / wheelchart / data_style ] at ( g__wheelchart_data_coordinate ) { \pgfkeysvalueof { / wheelchart / data } } ;%a separate \node and not at the end of the \draw with lines_style - %such that the key lines style is not passed to this \node + %so that the key lines style is not passed to this \node } \__wheelchart_def_fp:nn { arc_around_line } { arc~around~line } \__wheelchart_def_fp:nn { arc_data_angle_pos } { arc~data~angle~pos } @@ -2913,14 +2925,16 @@ \fp_gset:Nn \g__wheelchart_half_ex_over_one_cm_fp { 0.5 ex / 1 cm }% \endpgfinterruptpicture% \fp_gset:Nn \g__wheelchart_arc_data_aux_ii_fp { 0 } - \__wheelchart_if_text:nn { arc~data } + \__wheelchart_if_text:nnn { arc~data } {} { - \cs_set:Npn \WCperc { \WCpercentagerounded { \, } { \% } }%such that \WCperc follows the arc if used in arc data + \cs_set:Npn \WCperc { \WCpercentagerounded { \, } { \% } }%so that \WCperc follows the arc if used in arc data %this redefinition of \WCperc is local to the group of arc data \__wheelchart_def_fp:nn { arc_data_pos } { arc~data~pos } \__wheelchart_def_fp:nn { arc_data_sep } { arc~data~sep } \__wheelchart_def_fp:nn { arc_data_line_sep_factor } { arc~data~line~sep~factor } - \cs:w seq_set_split:Nn\pgfkeysvalueof { / wheelchart / arc~data~expand }\cs_end: + \__wheelchart_def_fp:nn { arc_data_lines_pos } { arc~data~lines~pos } + \__wheelchart_def_fp:nn { arc_data_lines_shift } { arc~data~lines~shift } + \cs:w seq_set_split:Nn\pgfkeysvalueof { / wheelchart / arc~data~expand } \cs_end: \l__wheelchart_arc_data_seq { \\ } { \pgfkeysvalueof { / wheelchart / arc~data } } @@ -2928,13 +2942,17 @@ { \fp_set:Nn \l__wheelchart_arc_data_text_pos_fp { - \l__wheelchart_arc_data_pos_fp + 2 * \g__wheelchart_slices_orientation_fp - * ( 2 * ####1 - \seq_count:N \l__wheelchart_arc_data_seq - 1 ) * sign ( \l__wheelchart_arc_data_dir_fp ) + \l__wheelchart_arc_data_pos_fp + 4 * \g__wheelchart_slices_orientation_fp * + ( + ####1 - 1 - \l__wheelchart_arc_data_lines_pos_fp * ( \seq_count:N \l__wheelchart_arc_data_seq - 1 ) + + \l__wheelchart_arc_data_lines_shift_fp + ) + * sign ( \l__wheelchart_arc_data_dir_fp ) * \l__wheelchart_arc_data_line_sep_factor_fp * \g__wheelchart_half_ex_over_one_cm_fp / ( - \cs:w g__wheelchart_outer_radius_\WCcount _fp\cs_end: - - \cs:w g__wheelchart_inner_radius_\WCcount _fp\cs_end: + \cs:w g__wheelchart_outer_radius_\WCcount _fp \cs_end: + - \cs:w g__wheelchart_inner_radius_\WCcount _fp \cs_end: + 2 * \l__wheelchart_arc_data_sep_fp ) }%the sign is needed because \l__wheelchart_arc_data_dir_fp is not necessarily 1 or -1 @@ -2957,9 +2975,9 @@ / wheelchart / arc_data_style } }%get the length of the path - %note the option overlay such that this does not increase the bounding box + %note the option overlay so that this does not increase the bounding box %note the {} at the start of text and the braces around \fp_gset:Nn ... - %such that the compilation does not stall + %so that the compilation does not stall { 0 } { 1 } { \l__wheelchart_plot_variable_tl } @@ -3033,7 +3051,7 @@ { \l__wheelchart_arc_data_text_pos_fp } { \l__wheelchart_arc_data_sep_fp + \g__wheelchart_half_ex_over_one_cm_fp } + \l__wheelchart_counter_or_clockwise_fp * \l__wheelchart_arc_data_dir_fp - * \cs:w c__wheelchart_arc_data_start_factor_\l__wheelchart_arc_data_align_tl _fp\cs_end: + * \cs:w c__wheelchart_arc_data_start_factor_\l__wheelchart_arc_data_align_tl _fp \cs_end: * \l__wheelchart_arc_data_total_angle_plot_false_fp } \path @@ -3188,7 +3206,7 @@ } \bool_if:NT \l__wheelchart_legend_row_bool { \__wheelchart_def_WClegend: } - \__wheelchart_if_text:nn { middle } + \__wheelchart_if_text:nnn { middle } { o } { \node [ align = center , / wheelchart / middle_style ] at ( 0 , 0 ) { \pgfkeysvalueof { / wheelchart / middle } } ; } \pgfkeysvalueof { / wheelchart / legend } \end { scope } @@ -3203,4 +3221,6 @@ \end { scope } } } - }
\ No newline at end of file + } + +\endinput
\ No newline at end of file |