diff options
author | Karl Berry <karl@freefriends.org> | 2019-09-29 21:14:48 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-09-29 21:14:48 +0000 |
commit | 93a11227b03ad98457bca1529daa7f5a435fab86 (patch) | |
tree | caa48f43de1e0bfd1692df5799f1bb7da6012e16 /Master/texmf-dist | |
parent | 33a8690dfc5c6d1c918a294a7fa070048d85dbe1 (diff) |
statistics (29sep19)
git-svn-id: svn://tug.org/texlive/trunk@52212 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/statistics/LICENSE | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/statistics/README.md | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/statistics/statistics.pdf | bin | 427734 -> 436624 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/statistics/statistics.dtx | 144 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/statistics/statistics.ins | 2 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/statistics/statistics.sty | 59 |
6 files changed, 163 insertions, 48 deletions
diff --git a/Master/texmf-dist/doc/latex/statistics/LICENSE b/Master/texmf-dist/doc/latex/statistics/LICENSE index 41d500f5e7c..0e88c31492d 100644 --- a/Master/texmf-dist/doc/latex/statistics/LICENSE +++ b/Master/texmf-dist/doc/latex/statistics/LICENSE @@ -632,7 +632,7 @@ state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. statistics - Copyright (C) 2014-2018 Julien RIVAUD + Copyright (C) 2014-2019 Julien RIVAUD This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - statistics Copyright (C) 2014-2018 Julien RIVAUD + statistics Copyright (C) 2014-2019 Julien RIVAUD This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. diff --git a/Master/texmf-dist/doc/latex/statistics/README.md b/Master/texmf-dist/doc/latex/statistics/README.md index 4a98c88a4af..9d189613114 100644 --- a/Master/texmf-dist/doc/latex/statistics/README.md +++ b/Master/texmf-dist/doc/latex/statistics/README.md @@ -14,7 +14,7 @@ of them. Similarly `statistics` can draw only some parts of the graphs. Every part of the generated tables or graphics is customizable. -(C) Copyright 2014-2018 RIVAUD Julien +(C) Copyright 2014-2019 RIVAUD Julien This package may be distributed and/or modified under the conditions of the General Public License (GPL), either version 3 of this license or (at your diff --git a/Master/texmf-dist/doc/latex/statistics/statistics.pdf b/Master/texmf-dist/doc/latex/statistics/statistics.pdf Binary files differindex 13ba2fb5b16..625901633bf 100644 --- a/Master/texmf-dist/doc/latex/statistics/statistics.pdf +++ b/Master/texmf-dist/doc/latex/statistics/statistics.pdf diff --git a/Master/texmf-dist/source/latex/statistics/statistics.dtx b/Master/texmf-dist/source/latex/statistics/statistics.dtx index bdb85dbff95..4dd83133815 100644 --- a/Master/texmf-dist/source/latex/statistics/statistics.dtx +++ b/Master/texmf-dist/source/latex/statistics/statistics.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % vim: tw=80 spl=en % -%% File: statistics.dtx (C) Copyright 2014-2018 RIVAUD Julien +%% File: statistics.dtx (C) Copyright 2014-2019 RIVAUD Julien %% %% It may be distributed and/or modified under the conditions of the %% General Public License (GPL), either version 3 of this @@ -11,7 +11,7 @@ % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\RequirePackage{expl3}[2016/01/19] +\RequirePackage{expl3}[2018/06/19] %</driver|package> %<*driver> \documentclass[full]{l3doc} @@ -20,6 +20,7 @@ \usepackage{xparse} \usepackage{xcolor} \usepackage{geometry} +\usetikzlibrary{patterns} \geometry{ a4paper, vmargin=2.5cm, right=1.5cm, textwidth=385pt, @@ -30,8 +31,8 @@ %<*driver|package> \def\ExplFileName{statistics} \def\ExplFileDescription{Compute and typeset statistics table and graphics} -\def\ExplFileDate{2018/07/21} -\def\ExplFileVersion{2.0} +\def\ExplFileDate{2019/09/29} +\def\ExplFileVersion{2.2} %</driver|package> %<*driver> \ExplSyntaxOn @@ -108,11 +109,11 @@ \str_set:Nn \l_tmpa_str {#1} \tl_trim_spaces:N \l_tmpa_str \str_set:Nx \l_tmpb_str {\char_generate:nn{`\^^M}{12}} - \str_if_eq_x:nnT \l_tmpb_str { \str_head:N \l_tmpa_str } { + \str_if_eq:eeT \l_tmpb_str { \str_head:N \l_tmpa_str } { \str_set:Nx \l_tmpa_str { \str_tail:N \l_tmpa_str } } \tl_reverse:N \l_tmpa_str - \str_if_eq_x:nnT \l_tmpb_str { \str_head:N \l_tmpa_str } { + \str_if_eq:eeT \l_tmpb_str { \str_head:N \l_tmpa_str } { \str_set:Nx \l_tmpa_str { \str_tail:N \l_tmpa_str } } \tl_reverse:N \l_tmpa_str @@ -579,14 +580,22 @@ % % \begin{key}{maxcols} % \begin{syntax} -% maxcols = \meta{integer} +% maxcols = \meta{comma-separated list of integers} % \end{syntax} % Setting this key to a positive integer~$n$ makes \cs{StatsTable} wrap after % having added $n$~columns to the current table. The table is closed, and a new % one is created with the row headers typeset anew. Setting this key to a -% negative number or zero disables wrapping. The initial value is~$0$. +% negative number or zero disables wrapping. If you set the key to a list of +% integers, each one is used as the value for the corresponding subtable, with +% the last number staying in effect for all remaining subtables. The initial +% value is~$0$. % \end{key} % +% \begin{texnote} +% If there is a non-positive integer in the list, all subsequent integers are +% ignored since there will be no further wrapping thus no other subtable. +% \end{texnote} +% % \begin{key}{tablesep} % \begin{syntax} % tablesep = \meta{\TeX\ content} @@ -881,6 +890,43 @@ % ] % \end{demo} % +% \subsubsection{Styling the graph} +% +% \begin{key}{style, style/reset, +% comb/style, comb/style/reset, +% histogram/style, histogram/style/reset, +% cumulative/style, cumulative/style/reset,} +% \begin{syntax} +% style = \meta{TikZ path options} +% \meta{graph type}/style = \meta{TikZ path options} +% style/reset, \meta{graph type}/style/reset +% \end{syntax} +% The \texttt{\meta{graph type}/style} keys append options to the TikZ path +% created by the datavisualization when the corresponding graph type is used. +% You can clear these options with \texttt{\meta{graph type}/style/reset}. +% If you omit the graph type, this sets the label for all graph types +% simultaneously. +% +% The initial values are: +% \begin{verbatim} +% comb/style = ultra-thick, +% cumulative/style = %empty +% histogram/style = { +% every~path/.prefix~style=fill, +% semithick, black, fill=black, fill~opacity=0.1 +% }, +% \end{verbatim} +% \end{key} +% +% \begin{demo} +% \statisticssetup[graph]{width=0.45\linewidth, +% style=blue, cumulative/style=densely dashed } +% \StatsGraph \facebook [ cumulative ] +% \hfill \StatsGraph \facebook[style={ +% fill opacity=0, pattern=north west lines, +% }] +% \end{demo} +% % \subsubsection{Selecting which parts of the graph are shown} % % By default, the complete graph is shown; you can ask \cs{StatsGraph} to only @@ -1051,7 +1097,7 @@ % Initial values are as follows: % \begin{itemize} % \item |comb/counts/axis| and |cumulative/counts/axis| are equal to\\ -% |ticks and grid={many, int about strategy, integer minor steps},|\\ +% |ticks and grid={many, int about strategy, integer minor steps*},|\\ % |label=|\meta{initial value of the label key} % \item |cumulative/counts/axis| and |cumulative/frequencies/axis| are % equal to\\ @@ -1092,11 +1138,13 @@ % \hfill \StatsGraph \facebook % \end{demo} % -% \begin{key}{/tikz/datavisualization/integer minor steps} +% \begin{key}{/tikz/datavisualization/integer minor steps, +% /tikz/datavisualization/integer minor steps*} % \begin{syntax} % integer minor steps $[$ = \meta{integer expression} $]$ +% integer minor steps* $[$ = \meta{integer expression} $]$ % \end{syntax} -% This is not a key in the |graph| module, but a TikZ key. It adds code to +% These are not keys in the |graph| module, but TikZ keys. They add code to % automatically compute |minor steps between steps| after the axis step has been % computed with the choosen strategy, so that the following constraints are % respected: @@ -1105,16 +1153,19 @@ % \item at most \meta{integer expression} ticks are present on the axis (minor % and major included, subminor not counted). % \end{itemize} +% In addition, the starred version ensures that the major step is never below +% one, which makes sense for counts where sub-unit graduations are confusing at +% best. % \end{key} % % If ommited, the \meta{integer expression} defaults to~$50$. % -% This TikZ key should not explode if the computed step is not an integer, but +% These TikZ keys should not explode if the computed step is not an integer, but % will probably not give a useful result, and in particular whether the minor % step will be integer is not defined in that case. % % \begin{texnote} -% The key is independent of \pkg{statistics} and could be reused elsewhere. +% The keys are independent of \pkg{statistics} and could be reused elsewhere. % \end{texnote} % % \begin{key}{counts/format, frequencies/format, y/format, @@ -1280,11 +1331,11 @@ % \meta{graph type}/x/axis = \meta{TikZ datavisualization axis options} % \meta{graph type}/values/axis/reset, \meta{graph type}/x/axis/reset % \end{syntax} -% The \texttt{\meta{graph type}/values/axis} key append options to the TikZ +% The \texttt{\meta{graph type}/values/axis} keys append options to the TikZ % $x$~axis when the corresponding graph type is used. You can clear these -% options with \texttt{\meta{graph type}/values/axis}. The keys with |x| are -% aliases for the similar keys with |values|. If you omit the graph type, this -% sets the label for all graph types simultaneously. +% options with \texttt{\meta{graph type}/values/axis/reset}. The keys with |x| +% are aliases for the similar keys with |values|. If you omit the graph type, +% this sets the label for all graph types simultaneously. % % The initial value is: % \begin{verbatim} @@ -1760,6 +1811,9 @@ } } +\int_new:N \l_@@_table_maxcols_int +\int_set:Nn \l_@@_table_maxcols_int {0} + \@@_keys_define:nn { table } { showonly .value_required:n = true, showonly .code:n = \@@_setshow:n{#1}, @@ -1780,9 +1834,9 @@ }, showonly/shown .initial:n = #1, - maxcols .int_set:N = \l_@@_table_maxcols_int, + maxcols .clist_set:N = \l_@@_table_maxcols_clist, maxcols .value_required:n = true, - maxcols .initial:n = 0, + maxcols .initial:n = , tablesep .tl_set:N = \l_@@_table_sep_tl, tablesep .value_required:n = true, @@ -1933,6 +1987,8 @@ \bool_new:N \l_@@_table_firstrow_bool +\seq_new:N \l_@@_store_values_seq +\seq_new:N \l_@@_store_counts_seq \cs_generate_variant:Nn \keyval_parse:NNn { NNV } \NewDocumentCommand \StatsTable { +O{} +m +O{} } { @@ -1975,6 +2031,18 @@ } % \end{macrocode} % +% Define getters for some items of the table, to be used for instance to +% programmatically choose the formatting. +% +% \begin{macrocode} + \cs_set_nopar:Npn \getvalue { + \seq_item:Nn \l_@@_store_values_seq + } + \cs_set_nopar:Npn \getcount { + \seq_item:Nn \l_@@_store_count_seq + } +% \end{macrocode} +% % Compute the total population count/frequency % % \begin{macrocode} @@ -2010,10 +2078,14 @@ \cs_new_protected_nopar:Nn \@@_table_start: { % \end{macrocode} % -% Init column count +% Init column count and fetch the next maxcols value (or keep the current one if +% we reached the end of the list). % % \begin{macrocode} \int_zero:N \l_@@_nbvals_int + \clist_pop:NNT \l_@@_table_maxcols_clist \l_tmpa_tl { + \int_set:Nn \l_@@_table_maxcols_int { \l_tmpa_tl } + } % \end{macrocode} % % Start rows with headers @@ -2120,6 +2192,7 @@ % Values % % \begin{macrocode} + \seq_put_right:Nn \l_@@_store_values_seq { #1 } \bool_if:NT \l_@@_table_values_bool { \tl_put_right:Nx \l_@@_table_values_tl { \exp_not:V \l_tmpa_tl { @@ -2134,6 +2207,7 @@ % Counts % % \begin{macrocode} + \seq_put_right:Nx \l_@@_store_counts_seq { \fp_eval:n {#2} } \bool_if:NT \l_@@_table_counts_bool { \tl_put_right:Nx \l_@@_table_counts_tl { \exp_not:V \l_tmpa_tl { @@ -2531,7 +2605,7 @@ counts/format = { \num{#1} }, counts/axis = { ticks~and~grid={ - many, int~about~strategy, integer~minor~steps, + many, int~about~strategy, integer~minor~steps*, } }, comb/counts/label = \countname, cumulative/counts/label = \ccountname, @@ -2545,7 +2619,10 @@ histogram/y/axis = {ticks = none}, histogram/y/autostep = 1, histogram/legend = { x=, y=0, w=\xstep }, - histogram/style = { semithick, black, fill=black, fill~opacity=0.1 }, + histogram/style = { + every~path/.prefix~style=fill, + semithick, black, fill=black, fill~opacity=0.1 + }, histogram/areas, histogram/areas/style = { auto, font=\small }, @@ -2668,6 +2745,18 @@ integer~minor~steps/.style={ } }, integer~minor~steps/.default=50, +integer~minor~steps*/.style={ + compute~step/.append = { + \tl_set_eq:NN \l_tmpa_tl \tikz@lib@dv@step + \tl_if_eq:NNF \l_tmpa_tl \relax { + \fp_compare:nT { \l_tmpa_tl < 1 } { + \tl_set:Nx \tikz@lib@dv@step {1} + } + } + }, + integer~minor~steps=#1, +}, +integer~minor~steps*/.default=50, } % \end{macrocode} % @@ -2718,7 +2807,7 @@ integer~minor~steps/.default=50, \fp_gset:Nn \g_@@_graph_xstep_fp { \tl_use:c {\l_tmpa_tl} } }{ - \fp_gset:Nn \g_@@_graph_xstep_fp { \c_one } + \fp_gset:Nn \g_@@_graph_xstep_fp { \c_one_int } } % \end{macrocode} % @@ -3030,9 +3119,8 @@ integer~minor~steps/.default=50, \exp_not:n { , visualize~as~line = histogram, histogram = } { \exp_not:n { polygon, style = } { - \exp_not:n { every~path/.append~style = } { \exp_not:V \l_@@_graph_options_histogram_tl - } } } + } } \exp_not:n { ] data [set = histogram, format = TeX~code] } { \exp_not:V \l_@@_graph_tikzdata_tl } @@ -3190,9 +3278,8 @@ integer~minor~steps/.default=50, \exp_not:n { , visualize~as~line = bar~graph, bar~graph = } { \exp_not:n { style = } { - \exp_not:n { every~path/.append~style = } { \exp_not:V \l_@@_graph_options_comb_tl - } } } + } } \exp_not:n { ] data [set = bar~graph, format = TeX~code] } { \exp_not:V \l_@@_graph_tikzdata_tl } @@ -3365,9 +3452,8 @@ integer~minor~steps/.default=50, \exp_not:n { , visualize~as~line = cumulative, cumulative = } { \exp_not:n { style = } { - \exp_not:n { every~path/.append~style = } { \exp_not:V \l_@@_graph_options_cumulative_tl - } } } + } } \exp_not:n { ] data [set = cumulative, format = TeX~code] } { \exp_not:V \l_@@_graph_tikzdata_tl } diff --git a/Master/texmf-dist/source/latex/statistics/statistics.ins b/Master/texmf-dist/source/latex/statistics/statistics.ins index fb958db3231..743475ec405 100644 --- a/Master/texmf-dist/source/latex/statistics/statistics.ins +++ b/Master/texmf-dist/source/latex/statistics/statistics.ins @@ -1,6 +1,6 @@ \iffalse meta-comment -File statistics.ins (C) Copyright 2014-2018 RIVAUD Julien +File statistics.ins (C) Copyright 2014-2019 RIVAUD Julien It may be distributed and/or modified under the conditions of the General Public License (GPL), either version 3 of this diff --git a/Master/texmf-dist/tex/latex/statistics/statistics.sty b/Master/texmf-dist/tex/latex/statistics/statistics.sty index 758157ed6f2..c9c83834ce3 100644 --- a/Master/texmf-dist/tex/latex/statistics/statistics.sty +++ b/Master/texmf-dist/tex/latex/statistics/statistics.sty @@ -6,17 +6,17 @@ %% %% statistics.dtx (with options: `package') %% -%% File: statistics.dtx (C) Copyright 2014-2018 RIVAUD Julien +%% File: statistics.dtx (C) Copyright 2014-2019 RIVAUD Julien %% %% It may be distributed and/or modified under the conditions of the %% General Public License (GPL), either version 3 of this %% license or (at your option) any later version. \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\RequirePackage{expl3}[2016/01/19] +\RequirePackage{expl3}[2018/06/19] \def\ExplFileName{statistics} \def\ExplFileDescription{Compute and typeset statistics table and graphics} -\def\ExplFileDate{2018/07/21} -\def\ExplFileVersion{2.0} +\def\ExplFileDate{2019/09/29} +\def\ExplFileVersion{2.2} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \RequirePackage{xparse} @@ -155,6 +155,9 @@ } } +\int_new:N \l__statistics_table_maxcols_int +\int_set:Nn \l__statistics_table_maxcols_int {0} + \__statistics_keys_define:nn { table } { showonly .value_required:n = true, showonly .code:n = \__statistics_setshow:n{#1}, @@ -175,9 +178,9 @@ }, showonly/shown .initial:n = #1, - maxcols .int_set:N = \l__statistics_table_maxcols_int, + maxcols .clist_set:N = \l__statistics_table_maxcols_clist, maxcols .value_required:n = true, - maxcols .initial:n = 0, + maxcols .initial:n = , tablesep .tl_set:N = \l__statistics_table_sep_tl, tablesep .value_required:n = true, @@ -319,6 +322,9 @@ \bool_new:N \l__statistics_table_firstrow_bool +\seq_new:N \l__statistics_store_values_seq +\seq_new:N \l__statistics_store_counts_seq + \cs_generate_variant:Nn \keyval_parse:NNn { NNV } \NewDocumentCommand \StatsTable { +O{} +m +O{} } { \group_begin: @@ -338,6 +344,12 @@ }{ \tl_set:Nn \l__statistics_data_tl { #2 } } + \cs_set_nopar:Npn \getvalue { + \seq_item:Nn \l__statistics_store_values_seq + } + \cs_set_nopar:Npn \getcount { + \seq_item:Nn \l__statistics_store_count_seq + } \fp_zero:N \l__statistics_total_fp \keyval_parse:NNV \__statistics_table_count:n @@ -354,6 +366,9 @@ } \cs_new_protected_nopar:Nn \__statistics_table_start: { \int_zero:N \l__statistics_nbvals_int + \clist_pop:NNT \l__statistics_table_maxcols_clist \l_tmpa_tl { + \int_set:Nn \l__statistics_table_maxcols_int { \l_tmpa_tl } + } \clist_map_inline:nn { values, counts, frequencies, icc, icf, dcc, dcf } { \tl_set:cx { l__statistics_table_##1_tl } { \exp_not:N \ensuremath { \exp_not:N \hbox { @@ -420,6 +435,7 @@ \tl_put_right:Nn \l_tmpa_tl {\__statistics_table_hidden_format:n} } + \seq_put_right:Nn \l__statistics_store_values_seq { #1 } \bool_if:NT \l__statistics_table_values_bool { \tl_put_right:Nx \l__statistics_table_values_tl { \exp_not:V \l_tmpa_tl { @@ -429,6 +445,7 @@ } } } + \seq_put_right:Nx \l__statistics_store_counts_seq { \fp_eval:n {#2} } \bool_if:NT \l__statistics_table_counts_bool { \tl_put_right:Nx \l__statistics_table_counts_tl { \exp_not:V \l_tmpa_tl { @@ -757,7 +774,7 @@ counts/format = { \num{#1} }, counts/axis = { ticks~and~grid={ - many, int~about~strategy, integer~minor~steps, + many, int~about~strategy, integer~minor~steps*, } }, comb/counts/label = \countname, cumulative/counts/label = \ccountname, @@ -771,7 +788,10 @@ histogram/y/axis = {ticks = none}, histogram/y/autostep = 1, histogram/legend = { x=, y=0, w=\xstep }, - histogram/style = { semithick, black, fill=black, fill~opacity=0.1 }, + histogram/style = { + every~path/.prefix~style=fill, + semithick, black, fill=black, fill~opacity=0.1 + }, histogram/areas, histogram/areas/style = { auto, font=\small }, @@ -886,6 +906,18 @@ integer~minor~steps/.style={ } }, integer~minor~steps/.default=50, +integer~minor~steps*/.style={ + compute~step/.append = { + \tl_set_eq:NN \l_tmpa_tl \tikz@lib@dv@step + \tl_if_eq:NNF \l_tmpa_tl \relax { + \fp_compare:nT { \l_tmpa_tl < 1 } { + \tl_set:Nx \tikz@lib@dv@step {1} + } + } + }, + integer~minor~steps=#1, +}, +integer~minor~steps*/.default=50, } \bool_new:N \l__statistics_graph_allranges_bool @@ -920,7 +952,7 @@ integer~minor~steps/.default=50, \fp_gset:Nn \g__statistics_graph_xstep_fp { \tl_use:c {\l_tmpa_tl} } }{ - \fp_gset:Nn \g__statistics_graph_xstep_fp { \c_one } + \fp_gset:Nn \g__statistics_graph_xstep_fp { \c_one_int } } \__statistics_setup:nn { graph } { #1, #3 } \tl_if_single:nTF { #2 } { @@ -1148,9 +1180,8 @@ integer~minor~steps/.default=50, \exp_not:n { , visualize~as~line = histogram, histogram = } { \exp_not:n { polygon, style = } { - \exp_not:n { every~path/.append~style = } { \exp_not:V \l__statistics_graph_options_histogram_tl - } } } + } } \exp_not:n { ] data [set = histogram, format = TeX~code] } { \exp_not:V \l__statistics_graph_tikzdata_tl } @@ -1258,9 +1289,8 @@ integer~minor~steps/.default=50, \exp_not:n { , visualize~as~line = bar~graph, bar~graph = } { \exp_not:n { style = } { - \exp_not:n { every~path/.append~style = } { \exp_not:V \l__statistics_graph_options_comb_tl - } } } + } } \exp_not:n { ] data [set = bar~graph, format = TeX~code] } { \exp_not:V \l__statistics_graph_tikzdata_tl } @@ -1368,9 +1398,8 @@ integer~minor~steps/.default=50, \exp_not:n { , visualize~as~line = cumulative, cumulative = } { \exp_not:n { style = } { - \exp_not:n { every~path/.append~style = } { \exp_not:V \l__statistics_graph_options_cumulative_tl - } } } + } } \exp_not:n { ] data [set = cumulative, format = TeX~code] } { \exp_not:V \l__statistics_graph_tikzdata_tl } |