summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/statistics
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-30 03:00:43 +0000
committerNorbert Preining <norbert@preining.info>2019-09-30 03:00:43 +0000
commitbbbe8128e7ae9d816a221377dbf5ff3969bb203b (patch)
tree0283a521760b879b30e61872f14f235645745675 /macros/latex/contrib/statistics
parent14ce8b68fe7df49e8a8891bb94c63b9a846da232 (diff)
CTAN sync 201909300300
Diffstat (limited to 'macros/latex/contrib/statistics')
-rw-r--r--macros/latex/contrib/statistics/LICENSE4
-rw-r--r--macros/latex/contrib/statistics/README.md2
-rw-r--r--macros/latex/contrib/statistics/statistics.dtx144
-rw-r--r--macros/latex/contrib/statistics/statistics.ins2
-rw-r--r--macros/latex/contrib/statistics/statistics.pdfbin427734 -> 436624 bytes
5 files changed, 119 insertions, 33 deletions
diff --git a/macros/latex/contrib/statistics/LICENSE b/macros/latex/contrib/statistics/LICENSE
index 41d500f5e7..0e88c31492 100644
--- a/macros/latex/contrib/statistics/LICENSE
+++ b/macros/latex/contrib/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/macros/latex/contrib/statistics/README.md b/macros/latex/contrib/statistics/README.md
index 4a98c88a4a..9d18961311 100644
--- a/macros/latex/contrib/statistics/README.md
+++ b/macros/latex/contrib/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/macros/latex/contrib/statistics/statistics.dtx b/macros/latex/contrib/statistics/statistics.dtx
index bdb85dbff9..4dd8313381 100644
--- a/macros/latex/contrib/statistics/statistics.dtx
+++ b/macros/latex/contrib/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/macros/latex/contrib/statistics/statistics.ins b/macros/latex/contrib/statistics/statistics.ins
index fb958db323..743475ec40 100644
--- a/macros/latex/contrib/statistics/statistics.ins
+++ b/macros/latex/contrib/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/macros/latex/contrib/statistics/statistics.pdf b/macros/latex/contrib/statistics/statistics.pdf
index 13ba2fb5b1..625901633b 100644
--- a/macros/latex/contrib/statistics/statistics.pdf
+++ b/macros/latex/contrib/statistics/statistics.pdf
Binary files differ