summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/csvsimple
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-07-07 03:03:32 +0000
committerNorbert Preining <norbert@preining.info>2021-07-07 03:03:32 +0000
commit4747884efc69f5b8ad51cc818467f7bbf428b815 (patch)
treed05568e0369ce16288bc105806553f717c194a1c /macros/latex/contrib/csvsimple
parent109a435244c29109322bcd46386301f6c62d4061 (diff)
CTAN sync 202107070303
Diffstat (limited to 'macros/latex/contrib/csvsimple')
-rw-r--r--macros/latex/contrib/csvsimple/CHANGES.md31
-rw-r--r--macros/latex/contrib/csvsimple/README.md12
-rw-r--r--macros/latex/contrib/csvsimple/csvsimple-doc.sty12
-rw-r--r--macros/latex/contrib/csvsimple/csvsimple-example.pdfbin75627 -> 75627 bytes
-rw-r--r--macros/latex/contrib/csvsimple/csvsimple-example.tex2
-rw-r--r--macros/latex/contrib/csvsimple/csvsimple-l3.pdfbin988201 -> 1040357 bytes
-rw-r--r--macros/latex/contrib/csvsimple/csvsimple-l3.sty170
-rw-r--r--macros/latex/contrib/csvsimple/csvsimple-l3.tex286
-rw-r--r--macros/latex/contrib/csvsimple/csvsimple-legacy.pdfbin810666 -> 810809 bytes
-rw-r--r--macros/latex/contrib/csvsimple/csvsimple-legacy.sty4
-rw-r--r--macros/latex/contrib/csvsimple/csvsimple-legacy.tex2
-rw-r--r--macros/latex/contrib/csvsimple/csvsimple.pdfbin309385 -> 309329 bytes
-rw-r--r--macros/latex/contrib/csvsimple/csvsimple.sty4
-rw-r--r--macros/latex/contrib/csvsimple/csvsimple.tex6
14 files changed, 472 insertions, 57 deletions
diff --git a/macros/latex/contrib/csvsimple/CHANGES.md b/macros/latex/contrib/csvsimple/CHANGES.md
index 1899dbf1f8..391db06d65 100644
--- a/macros/latex/contrib/csvsimple/CHANGES.md
+++ b/macros/latex/contrib/csvsimple/CHANGES.md
@@ -8,6 +8,36 @@ and this project adheres to
## [Unreleased]
+### Added
+### Changed
+### Deprecated
+### Removed
+### Fixed
+### Security
+
+
+## [2.1.0] - 2021-07-06
+
+### Added
+- Support for (limited) data collection (issue #15)
+- Support for package `tabularray` (part of issue #12)
+- Option `after filter`
+- Option `collect data`
+- Option `data collection`
+- Option `tabularray`
+- Option `centered tabularray`
+- `\csvdatacollection`
+- `\csvexpval`
+- `\csvexpnot`
+- `\csvcollectn`
+- `\csvcollectx`
+- `\csvcollectV`
+
+### Fixed
+- Line Range was not resetted
+- Wrong link and word inside documentation `csvsimple.pdf` (issue #13, issue #15)
+- Several inconsistent local/global assignment errors
+
## [2.0.0] - 2021-06-29
@@ -77,7 +107,6 @@ and this project adheres to
-
## [1.22] - 2021-06-07
### Added
diff --git a/macros/latex/contrib/csvsimple/README.md b/macros/latex/contrib/csvsimple/README.md
index d0f920dd8c..37316ec36e 100644
--- a/macros/latex/contrib/csvsimple/README.md
+++ b/macros/latex/contrib/csvsimple/README.md
@@ -1,8 +1,8 @@
-# The LaTeX package csvsimple - version 2.0.0 (2021/06/29)
+# The LaTeX package csvsimple - version 2.1.0 (2021/07/06)
+
->
> Copyright (c) 2008-2021 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de>
->
+
> This work may be distributed and/or modified under the
> conditions of the LaTeX Project Public License, either version 1.3
> of this license or (at your option) any later version.
@@ -10,11 +10,11 @@
> http://www.latex-project.org/lppl.txt
> and version 1.3 or later is part of all distributions of LaTeX
> version 2005/12/01 or later.
->
+
> This work has the LPPL maintenance status `author-maintained`.
->
+
> This work consists of all files listed in README.md
->
+
`csvsimple` provides a simple *LaTeX* interface for the processing of files
with comma separated values (CSV). `csvsimple` relies heavily on a key value
diff --git a/macros/latex/contrib/csvsimple/csvsimple-doc.sty b/macros/latex/contrib/csvsimple/csvsimple-doc.sty
index 6fd611a12c..c4b2c0bb40 100644
--- a/macros/latex/contrib/csvsimple/csvsimple-doc.sty
+++ b/macros/latex/contrib/csvsimple/csvsimple-doc.sty
@@ -1,5 +1,5 @@
% !TeX encoding=UTF-8
-%% The LaTeX package csvsimple - version 2.0.0 (2021/06/29)
+%% The LaTeX package csvsimple - version 2.1.0 (2021/07/06)
%% csvsimple-doc.sty: style file for the documentation
%%
%% -------------------------------------------------------------------------------------------
@@ -18,8 +18,8 @@
%%
%% This work consists of all files listed in README.md
%%
-\def\version{2.0.0}%
-\def\datum{2021/06/29}%
+\def\version{2.1.0}%
+\def\datum{2021/07/06}%
\IfFileExists{csvsimple-doc.cfg}{\input{csvsimple-doc.cfg}}{}\providecommand\csvpkgprefix{}
@@ -29,7 +29,7 @@
\RequirePackage{lmodern,parskip,array,ifthen,calc,makeidx}
\RequirePackage{amsmath,amssymb}
\RequirePackage[svgnames,table,hyperref]{xcolor}
-\RequirePackage{tikz,siunitx,xfp}
+\RequirePackage{tikz,siunitx,xfp,tabularray}
\RequirePackage{varioref}
\RequirePackage[pdftex,bookmarks,raiselinks,pageanchor,hyperindex,colorlinks]{hyperref}
\urlstyle{sf}
@@ -100,6 +100,10 @@
\NewTotalTCBox{\verbbox}{m}{enhanced,on line,size=fbox,frame empty,colback=red!5!white,
colupper=red!85!black,fontupper=\bfseries\ttfamily}{\detokenize{"}#1\detokenize{"}}
+\NewDocumentCommand{\ctanpkg}{m}
+ {%
+ \href{https://ctan.org/pkg/#1}{\texttt{#1}}%
+ }
\makeindex
diff --git a/macros/latex/contrib/csvsimple/csvsimple-example.pdf b/macros/latex/contrib/csvsimple/csvsimple-example.pdf
index 79a66bb9a2..62a47111b6 100644
--- a/macros/latex/contrib/csvsimple/csvsimple-example.pdf
+++ b/macros/latex/contrib/csvsimple/csvsimple-example.pdf
Binary files differ
diff --git a/macros/latex/contrib/csvsimple/csvsimple-example.tex b/macros/latex/contrib/csvsimple/csvsimple-example.tex
index 4f8a80dcfd..e6466807a3 100644
--- a/macros/latex/contrib/csvsimple/csvsimple-example.tex
+++ b/macros/latex/contrib/csvsimple/csvsimple-example.tex
@@ -1,4 +1,4 @@
-%% The LaTeX package csvsimple - version 2.0.0 (2021/06/29)
+%% The LaTeX package csvsimple - version 2.1.0 (2021/07/06)
%% csvsimple-example.tex: an example for csvsimple
%%
%% -------------------------------------------------------------------------------------------
diff --git a/macros/latex/contrib/csvsimple/csvsimple-l3.pdf b/macros/latex/contrib/csvsimple/csvsimple-l3.pdf
index a25286a842..eec13b49b4 100644
--- a/macros/latex/contrib/csvsimple/csvsimple-l3.pdf
+++ b/macros/latex/contrib/csvsimple/csvsimple-l3.pdf
Binary files differ
diff --git a/macros/latex/contrib/csvsimple/csvsimple-l3.sty b/macros/latex/contrib/csvsimple/csvsimple-l3.sty
index da7e62f47d..cfaf0b9819 100644
--- a/macros/latex/contrib/csvsimple/csvsimple-l3.sty
+++ b/macros/latex/contrib/csvsimple/csvsimple-l3.sty
@@ -1,4 +1,4 @@
-%% The LaTeX package csvsimple - version 2.0.0 (2021/06/29)
+%% The LaTeX package csvsimple - version 2.1.0 (2021/07/06)
%% csvsimple-l3.sty: Simple LaTeX CSV file processing (LaTeX3)
%%
%% -------------------------------------------------------------------------------------------
@@ -17,7 +17,7 @@
%%
%% This work consists of all files listed in README.md
%%
-\ProvidesExplPackage{csvsimple-l3}{2021/06/29}{2.0.0}
+\ProvidesExplPackage{csvsimple-l3}{2021/07/06}{2.1.0}
{LaTeX3 CSV file processing}
@@ -40,10 +40,12 @@
%---- declarations and expl3 variants
\bool_new:N \g__csvsim_check_column_count_bool
+\bool_new:N \g__csvsim_collect_data_bool
\bool_new:N \g__csvsim_firstline_bool
\bool_new:N \g__csvsim_head_bool
\bool_new:N \g__csvsim_head_to_colnames_bool
\bool_new:N \g__csvsim_line_accepted_bool
+\bool_new:N \g__csvsim_line_firstline_bool
\bool_new:N \l__csvsim_respect_and_bool
\bool_new:N \l__csvsim_respect_backslash_bool
\bool_new:N \l__csvsim_respect_circumflex_bool
@@ -82,9 +84,12 @@
\tl_new:N \g__csvsim_body_tl
\tl_new:N \g__csvsim_catcode_tl
+\tl_new:N \g__csvsim_collect_tl
\tl_new:N \g__csvsim_columnnames_tl
+\tl_new:N \g__csvsim_data_collection_tl
\tl_new:N \g__csvsim_filter_tl
\tl_new:N \g__csvsim_headname_prefix_tl
+\tl_new:N \g__csvsim_hook_after_filter_tl
\tl_new:N \g__csvsim_hook_after_first_line_tl
\tl_new:N \g__csvsim_hook_after_head_tl
\tl_new:N \g__csvsim_hook_after_line_tl
@@ -105,6 +110,7 @@
\tl_new:N \g__csvsim_table_foot_tl
\tl_new:N \g__csvsim_table_head_tl
+
\group_begin:
\char_set_catcode_other:n { 9 }
\str_const:Nn \c__csvsim_tab_str { ^^I }
@@ -204,7 +210,7 @@
\msg_error:nnx { csvsimple }{ empty-head }{ \g__csvsim_filename_str }
}
{
- \int_zero:N \g_csvsim_columncount_int
+ \int_gzero:N \g_csvsim_columncount_int
\__csvsim_scan_line:
\int_step_function:nN \g_csvsim_columncount_int \__csvsim_process_head_name:n
}
@@ -265,6 +271,10 @@
\int_gzero:N \g_csvsim_inputline_int
\int_gzero:N \g_csvsim_row_int
\int_gset_eq:NN \g__csvsim_colmax_int \c_one_int
+ \bool_if:NT \g__csvsim_collect_data_bool
+ {
+ \__csvsim_collect_data:
+ }
% open file
\g__csvsim_hook_before_reading_tl
@@ -317,6 +327,7 @@
{
\g__csvsim_hook_late_after_head_tl
}
+ \g__csvsim_hook_after_filter_tl
\g__csvsim_hook_before_first_line_tl
\g__csvsim_body_tl
\g__csvsim_hook_after_first_line_tl
@@ -324,6 +335,7 @@
}
{
\g__csvsim_hook_late_after_line_tl
+ \g__csvsim_hook_after_filter_tl
\g__csvsim_hook_before_line_tl
\g__csvsim_body_tl
\g__csvsim_hook_after_line_tl
@@ -354,6 +366,11 @@
}
\g__csvsim_hook_table_end_tl
\g__csvsim_hook_after_reading_tl
+ \bool_if:NT \g__csvsim_collect_data_bool
+ {
+ \exp_args:NV \tl_gset_eq:NN \g__csvsim_data_collection_tl \g__csvsim_collect_tl
+ \tl_gclear:N \g__csvsim_collect_tl
+ }
}
@@ -561,10 +578,10 @@
\tl_gput_right:Nn \g__csvsim_columnnames_tl {,#1}
}
},
- command .tl_gset:N = \g__csvsim_body_tl,
- check~column~count .bool_gset:N = \g__csvsim_check_column_count_bool,
- on~column~count~error .tl_gset:N = \g__csvsim_hook_columncounterror_tl,
- head .bool_gset:N = \g__csvsim_head_bool,
+ command .tl_gset:N = \g__csvsim_body_tl,
+ check~column~count .bool_gset:N = \g__csvsim_check_column_count_bool,
+ on~column~count~error .tl_gset:N = \g__csvsim_hook_columncounterror_tl,
+ head .bool_gset:N = \g__csvsim_head_bool,
head~to~column~names~prefix .tl_gset:N = \g__csvsim_headname_prefix_tl,
head~to~column~names .bool_gset:N = \g__csvsim_head_to_colnames_bool,
column~count .int_gset:N = \g_csvsim_columncount_int,
@@ -607,6 +624,7 @@
before~reading .tl_gset:N = \g__csvsim_hook_before_reading_tl,
after~head .tl_gset:N = \g__csvsim_hook_after_head_tl,
before~filter .tl_gset:N = \g__csvsim_hook_before_filter_tl,
+ after~filter .tl_gset:N = \g__csvsim_hook_after_filter_tl,
late~after~head .tl_gset:N = \g__csvsim_hook_late_after_head_tl,
late~after~first~line .tl_gset:N = \g__csvsim_hook_late_after_first_line_tl,
late~after~last~line .tl_gset:N = \g__csvsim_hook_late_after_last_line_tl,
@@ -852,6 +870,81 @@
+%---- data collection
+
+\cs_new_protected_nopar:Npn \__csvsim_gset_tl_to_collect:N #1
+ {
+ \tl_gset:Nx #1
+ {
+ \exp_not:N \tl_gput_right:Nn
+ \exp_not:N \g__csvsim_collect_tl
+ {\exp_not:V #1}
+ }
+ }
+
+
+\cs_new_protected_nopar:Npn \__csvsim_gset_tl_to_collect_expanded:N #1
+ {
+ \tl_gset:Nx #1
+ {
+ \exp_not:N \tl_gput_right:Nx
+ \exp_not:N \g__csvsim_collect_tl
+ {\exp_not:V #1}
+ }
+ }
+
+
+\cs_new_protected_nopar:Npn \__csvsim_collect_data:
+ {
+ \__csvsim_gset_tl_to_collect:N \g__csvsim_hook_after_head_tl
+ \__csvsim_gset_tl_to_collect:N \g__csvsim_hook_after_line_tl
+ \__csvsim_gset_tl_to_collect:N \g__csvsim_hook_before_first_line_tl
+ \__csvsim_gset_tl_to_collect:N \g__csvsim_hook_before_line_tl
+ \__csvsim_gset_tl_to_collect:N \g__csvsim_hook_late_after_first_line_tl
+ \__csvsim_gset_tl_to_collect:N \g__csvsim_hook_late_after_head_tl
+ \__csvsim_gset_tl_to_collect:N \g__csvsim_hook_late_after_last_line_tl
+ \__csvsim_gset_tl_to_collect:N \g__csvsim_hook_late_after_line_tl
+ \__csvsim_gset_tl_to_collect_expanded:N \g__csvsim_body_tl
+ \tl_gclear:N \g__csvsim_collect_tl
+ }
+
+
+\cs_set_eq:NN \csvexpval \exp_not:V
+\cs_set_eq:NN \csvexpnot \exp_not:N
+
+
+\NewDocumentCommand{ \csvcollectn }{ +m }
+ {
+ \tl_gput_right:Nn \g__csvsim_collect_tl {#1}
+ }
+
+
+\NewDocumentCommand{ \csvcollectx }{ +m }
+ {
+ \tl_gput_right:Nx \g__csvsim_collect_tl {#1}
+ }
+
+
+\NewDocumentCommand{ \csvcollectV }{ m }
+ {
+ \tl_gput_right:NV \g__csvsim_collect_tl #1
+ }
+
+
+\keys_define:nn { csvsim }
+ {
+ collect~data .bool_gset:N = \g__csvsim_collect_data_bool,
+ data~collection .tl_gset:N = \g__csvsim_data_collection_tl,
+ }
+
+
+\keys_set:nn { csvsim }
+ {
+ data~collection = \csvdatacollection,
+ }
+
+
+
%---- catcodes
\cs_new_protected_nopar:Npn \__csvsim_setup_catcode_list:
@@ -983,6 +1076,48 @@
late~after~line = \\,
late~after~last~line =
},
+ tabularray .meta:n =
+ {
+ collect~data,
+ _table_ =
+ {
+ \tl_gput_right:NV \g__csvsim_collect_tl \g__csvsim_before_table_tl
+ \tl_gput_right:Nn \g__csvsim_collect_tl { \begin{tblr}{#1} }
+ \tl_gput_right:NV \g__csvsim_collect_tl \g__csvsim_table_head_tl
+ }
+ {
+ \tl_gput_right:NV \g__csvsim_collect_tl \g__csvsim_table_foot_tl
+ \tl_gput_right:Nn \g__csvsim_collect_tl { \end{tblr} }
+ \tl_gput_right:NV \g__csvsim_collect_tl \g__csvsim_after_table_tl
+ },
+ late~after~line = \\,
+ after~reading =
+ {
+ \tl_use:N \g__csvsim_collect_tl
+ },
+ },
+ centered~tabularray .meta:n =
+ {
+ collect~data,
+ _table_ =
+ {
+ \tl_gput_right:Nn \g__csvsim_collect_tl { \begin{center} }
+ \tl_gput_right:NV \g__csvsim_collect_tl \g__csvsim_before_table_tl
+ \tl_gput_right:Nn \g__csvsim_collect_tl { \begin{tblr}{#1} }
+ \tl_gput_right:NV \g__csvsim_collect_tl \g__csvsim_table_head_tl
+ }
+ {
+ \tl_gput_right:NV \g__csvsim_collect_tl \g__csvsim_table_foot_tl
+ \tl_gput_right:Nn \g__csvsim_collect_tl { \end{tblr} }
+ \tl_gput_right:NV \g__csvsim_collect_tl \g__csvsim_after_table_tl
+ \tl_gput_right:Nn \g__csvsim_collect_tl { \end{center} }
+ },
+ late~after~line = \\,
+ after~reading =
+ {
+ \tl_use:N \g__csvsim_collect_tl
+ },
+ },
_autotab_ .meta:n =
{
file = #1,
@@ -1001,7 +1136,7 @@
_autotabular_ = #1,
head,
after~head = \g__csvsim_before_table_tl
- \begin{tabular}{|*{\int_use:N\g__csvsim_col_int}{l|}}
+ \begin{tabular}{|*{\int_use:N\g_csvsim_columncount_int}{l|}}
\g__csvsim_table_head_tl,
table~head = \hline\csvlinetotablerow\\\hline,
table~foot = \\\hline,
@@ -1011,7 +1146,7 @@
_autotabular_ = #1,
no~head,
before~first~line = \g__csvsim_before_table_tl
- \begin{tabular}{|*{\int_use:N\g__csvsim_col_int}{l|}}
+ \begin{tabular}{|*{\int_use:N\g_csvsim_columncount_int}{l|}}
\g__csvsim_table_head_tl,
table~head = \hline,
table~foot = \\\hline,
@@ -1021,7 +1156,7 @@
_autotabular_ = #1,
head,
after~head = \g__csvsim_before_table_tl
- \begin{tabular}{*{\int_use:N\g__csvsim_col_int}{l}}
+ \begin{tabular}{*{\int_use:N\g_csvsim_columncount_int}{l}}
\g__csvsim_table_head_tl,
table~head = \toprule\csvlinetotablerow\\\midrule,
table~foot = \\\bottomrule,
@@ -1031,7 +1166,7 @@
_autotabular_ = #1,
no~head,
before~first~line = \g__csvsim_before_table_tl
- \begin{tabular}{*{\int_use:N\g__csvsim_col_int}{l}}
+ \begin{tabular}{*{\int_use:N\g_csvsim_columncount_int}{l}}
\g__csvsim_table_head_tl,
table~head = \toprule,
table~foot = \\\bottomrule,
@@ -1047,7 +1182,7 @@
_autolongtable_ = #1,
head,
after~head = \g__csvsim_before_table_tl
- \begin{longtable}{|*{\int_use:N\g__csvsim_col_int}{l|}}
+ \begin{longtable}{|*{\int_use:N\g_csvsim_columncount_int}{l|}}
\g__csvsim_table_head_tl,
table~head = \hline\csvlinetotablerow\\\hline\endhead
\hline\endfoot,
@@ -1057,7 +1192,7 @@
_autolongtable_ = #1,
no~head,
before~first~line = \g__csvsim_before_table_tl
- \begin{longtable}{|*{\int_use:N\g__csvsim_col_int}{l|}}
+ \begin{longtable}{|*{\int_use:N\g_csvsim_columncount_int}{l|}}
\g__csvsim_table_head_tl,
table~head = \hline\endhead
\hline\endfoot,
@@ -1067,7 +1202,7 @@
_autolongtable_ = #1,
head,
after~head = \g__csvsim_before_table_tl
- \begin{longtable}{*{\int_use:N\g__csvsim_col_int}{l}}
+ \begin{longtable}{*{\int_use:N\g_csvsim_columncount_int}{l}}
\g__csvsim_table_head_tl,
table~head = \toprule\csvlinetotablerow\\\midrule\endhead
\bottomrule\endfoot,
@@ -1077,7 +1212,7 @@
_autolongtable_ = #1,
no~head,
before~first~line = \g__csvsim_before_table_tl
- \begin{longtable}{*{\int_use:N\g__csvsim_col_int}{l}}
+ \begin{longtable}{*{\int_use:N\g_csvsim_columncount_int}{l}}
\g__csvsim_table_head_tl,
table~head = \toprule\endhead
\bottomrule\endfoot,
@@ -1157,7 +1292,7 @@
\keys_define:nn { csvsim }
{
- preprocessor .tl_gset:N = \l__csvsim_preprocessor_tl,
+ preprocessor .tl_set:N = \l__csvsim_preprocessor_tl,
preprocessed~file .code:n = \__csvsim_set_filename:Nn \l__csvsim_ppfilename_str {#1},
csvsorter~command .code:n = \__csvsim_set_filename:Nn \l__csvsim_csvsorter_command_str {#1},
csvsorter~configpath .code:n = \__csvsim_set_filename:Nn\l__csvsim_csvsorter_configpath_str {#1},
@@ -1233,10 +1368,13 @@
check~column~count,
head~to~column~names~prefix = ,
head~to~column~names = false,
+ collect~data = false,
column~count = 0,
on~column~count~error =,
+ range =,
no~filter,
before~filter =,
+ after~filter =,
before~line =,
after~line =,
late~after~line =,
diff --git a/macros/latex/contrib/csvsimple/csvsimple-l3.tex b/macros/latex/contrib/csvsimple/csvsimple-l3.tex
index a3e61e241f..fc8d82b903 100644
--- a/macros/latex/contrib/csvsimple/csvsimple-l3.tex
+++ b/macros/latex/contrib/csvsimple/csvsimple-l3.tex
@@ -1,6 +1,6 @@
% \LaTeX-Main\
% !TeX encoding=UTF-8
-%% The LaTeX package csvsimple - version 2.0.0 (2021/06/29)
+%% The LaTeX package csvsimple - version 2.1.0 (2021/07/06)
%% csvsimple.tex: Manual
%%
%% -------------------------------------------------------------------------------------------
@@ -19,6 +19,7 @@
%%
%% This work consists of all files listed in README.md
%%
+% \RequirePackage[check-declarations,enable-debug]{expl3}
\documentclass[a4paper,11pt]{ltxdoc}
\usepackage{csvsimple-doc}
@@ -102,7 +103,7 @@ This processing is controlled by key value assignments according to the
syntax of |l3keys|. Sample applications of the package
are tabular lists, serial letters, and charts.
-An alternative to |csvsimple-l3| is the |datatool| package
+An alternative to |csvsimple-l3| is the \ctanpkg{datatool} package
which provides considerably more functions and allows sorting of data by \LaTeX.
|csvsimple-l3| has a different approach for the user interface and
is deliberately restricted to some basic functions with fast
@@ -134,7 +135,7 @@ alternatives inside the preamble:
\end{dispListing}
Not automatically loaded, but used for many examples are the packages
-|longtable|, |booktabs|, |ifthen|, and |booktabs|.
+\ctanpkg{longtable}, \ctanpkg{booktabs}, \ctanpkg{ifthen}, and \ctanpkg{etoolbox}.
\clearpage
@@ -788,12 +789,21 @@ to be used inside these macros.
\begin{docCsvKey}{before filter}{=\meta{code}}{no default, initially empty}
Sets the \meta{code} to be executed after reading and consistency checking
- of a data line. They are executed before any filter condition is checked,
- see e.g. \refKey{/csvsim/filter ifthen}.
- Also see \refKey{/csvsim/full filter}.
+ of a data line. It is executed before any filter condition is checked,
+ see e.g. \refKey{/csvsim/filter ifthen} and
+ also see \refKey{/csvsim/full filter}.
+ No additions to the input stream should be given here.
All line entries are available.
\end{docCsvKey}
+\begin{docCsvKey}[][doc new=2021-07-06]{after filter}{=\meta{code}}{no default, initially empty}
+ Sets the \meta{code} to be executed for an accepted line after
+ \refKey{/csvsim/late after line} and before \refKey{/csvsim/before line}.
+ All line entries are available.
+ No additions to the input stream should be given here. \meta{code} may
+ contain processing of data content to generate new values.
+\end{docCsvKey}
+
\begin{docCsvKey}{late after head}{=\meta{code}}{no default, initially empty}
Sets the \meta{code} to be executed after reading and disassembling
of the first accepted data line.
@@ -833,7 +843,7 @@ to be used inside these macros.
\begin{docCsvKey}{before line}{=\meta{code}}{no default, initially empty}
- Sets the \meta{code} to be executed after \refKey{/csvsim/late after line}
+ Sets the \meta{code} to be executed after \refKey{/csvsim/after filter}
and before \refKey{/csvsim/command}.
All line entries are available.
\refKey{/csvsim/before line} overwrites
@@ -848,6 +858,7 @@ to be used inside these macros.
This key has to be set after \refKey{/csvsim/before line}.
\end{docCsvKey}
+\pagebreak
\begin{docCsvKey}{command}{=\meta{code}}{no default, initially \cs{csvline}}
Sets the \meta{code} to be executed for every accepted data line.
@@ -857,8 +868,6 @@ to be used inside these macros.
parameter.
\end{docCsvKey}
-\pagebreak
-
\begin{docCsvKey}{after line}{=\meta{code}}{no default, initially empty}
Sets the \meta{code} to be executed for every accepted data line
after \refKey{/csvsim/command}.
@@ -889,6 +898,7 @@ parameter of \refCom{csvreader}.
before reading = \meta{before reading}\\,
after head = \meta{after head},
before filter = \\\meta{before filter},
+ after filter = \meta{after filter},
late after head = \meta{late after head},
late after line = \meta{late after line},
late after first line = \meta{late after first line},
@@ -1041,20 +1051,20 @@ The following string compare filters \refKey{/csvsim/filter strcmp} and
\begin{docCsvKey}{filter equal}{=\marg{stringA}\marg{stringB}}{style, no default}
Only lines where \meta{stringA} and \meta{stringB} are equal after expansion
are accepted.
- The implementation is done with the |ifthen| package (loading required!).
+ The implementation is done with the \ctanpkg{ifthen} package (loading required!).
\end{docCsvKey}
\begin{docCsvKey}{filter not equal}{=\marg{stringA}\marg{stringB}}{style, no default}
Only lines where \meta{stringA} and \meta{stringB} are not equal after expansion
are accepted.
- The implementation is done with the |ifthen| package (loading required!).
+ The implementation is done with the \ctanpkg{ifthen} package (loading required!).
\end{docCsvKey}
\begin{docCsvKey}[][doc new=2021-06-25]{filter fp}{=\meta{floating point expression}}{no default}
Only data lines which fulfill a \LaTeX3 \meta{floating point expression}
- (|l3fp|, |xfp|) are accepted.
+ (|l3fp|, \ctanpkg{xfp}) are accepted.
\begin{dispExample}
% \usepackage{booktabs}
\csvreader[
@@ -1146,7 +1156,7 @@ The following string compare filters \refKey{/csvsim/filter strcmp} and
\begin{dispListing}
filter test=\iftest{some testing},
\end{dispListing}
- For |\iftest|, tests from the |etoolbox| package like
+ For |\iftest|, tests from the \ctanpkg{etoolbox} package like
|\ifnumcomp|, |\ifdimgreater|, etc. and from \Fullref{sec:stringtests} can be used.
Also, arbitrary own macros fulfilling this signature can be applied.
\begin{dispExample}
@@ -1169,7 +1179,7 @@ filter test=\iftest{some testing},
\begin{docCsvKey}[][doc new=2016-07-01]{filter expr}{=\meta{boolean expression}}{no default}
Only data lines which fulfill a \meta{boolean expression} are accepted.
Every \meta{boolean expression}
- from the |etoolbox| package is feasible (package loading required!).
+ from the \ctanpkg{etoolbox} package is feasible (package loading required!).
To preprocess the data line before testing the \meta{condition},
the option key \refKey{/csvsim/before filter} can be used.
\begin{dispExample}
@@ -1193,7 +1203,7 @@ filter test=\iftest{some testing},
\clearpage
\begin{docCsvKey}[][doc new=2016-07-01]{filter ifthen}{=\meta{boolean expression}}{no default}
Only data lines which fulfill a \meta{boolean expression} are accepted.
- For the \meta{boolean expression}, every term from the |ifthen| package
+ For the \meta{boolean expression}, every term from the \ctanpkg{ifthen} package
is feasible (package loading required!).
To preprocess the data line before testing the \meta{condition},
the option key \refKey{/csvsim/before filter} can be used.
@@ -1372,7 +1382,7 @@ The following example displays the last three line numbers:
\begin{docCsvKey}{tabular}{=\meta{table format}}{style, no default}
Surrounds the CSV processing with |\begin{tabular}|\marg{table format}
at begin and with |\end{tabular}| at end.
-Additionally, the commands defined by the key values of
+ Additionally, the commands defined by the key values of
\refKey{/csvsim/before table}, \refKey{/csvsim/table head}, \refKey{/csvsim/table foot},
and \refKey{/csvsim/after table} are executed at the appropriate places.
\end{docCsvKey}
@@ -1385,7 +1395,7 @@ Additionally, the commands defined by the key values of
\begin{docCsvKey}{longtable}{=\meta{table format}}{style, no default}
Like \refKey{/csvsim/tabular} but for the |longtable| environment.
- This requires the package |longtable| (not loaded automatically).
+ This requires the package \ctanpkg{longtable} (not loaded automatically).
\end{docCsvKey}
@@ -1399,6 +1409,21 @@ Additionally, the commands defined by the key values of
\end{docCsvKey}
+\begin{docCsvKey}[][doc new=2021-07-06]{tabularray}{=\meta{table format}}{style, no default}
+ Like \refKey{/csvsim/tabular} but for the |tblr| environment.
+ This requires the package \ctanpkg{tabularray} (not loaded automatically).
+ This also sets \refKey{/csvsim/collect data} since this kind of table
+ needs collected content, see \Fullref{sec:datacollection}.
+ Note that \refKey{/csvsim/after reading} is set to use the collected
+ data immediately. See \Fullref{sec:tabularray} for examples.
+\end{docCsvKey}
+
+
+\begin{docCsvKey}[][doc new=2021-07-06]{centered tabularray}{=\meta{table format}}{style, no default}
+ Like \refKey{/csvsim/tabularray} but inside an additional |center| environment.
+\end{docCsvKey}
+
+
\begin{docCsvKey}{no table}{}{style, no value}
Deactivates |tabular|, |longtable|, and |tabbing|.
\end{docCsvKey}
@@ -1879,6 +1904,118 @@ Now, we can use the new rule:
\clearpage
+\subsection{Data Collection}\label{sec:datacollection}
+
+|csvsimple-l3| reads and processes a CSV file line by line. Accordingly, the \TeX{}
+input stream is filled line by line.
+Although this is an efficient procedure, for some applications like tables with
+the \ctanpkg{tabularray} package, collecting the data from the CSV file into a macro is needed.
+This macro can be given to the target application for further processing.
+
+
+\begin{docCsvKey}[][doc new=2021-07-06]{collect data}{\colOpt{=true\textbar false}}{default |true|, initially |false|}
+|csvsimple-l3| provides limited and experimental support to collect the input data
+from the CSV file plus user additions into a macro named \refCom{csvdatacollection}.
+Setting \refKey{/csvsim/collect data} adds the contents of the following keys
+to \refCom{csvdatacollection}:
+\begin{itemize}
+\item\refKey{/csvsim/after head}
+\item\refKey{/csvsim/after line}
+\item\refKey{/csvsim/before first line}
+\item\refKey{/csvsim/before line}
+\item\refKey{/csvsim/late after first line}
+\item\refKey{/csvsim/late after head}
+\item\refKey{/csvsim/late after last line}
+\item\refKey{/csvsim/late after line}
+\end{itemize}
+Also, the \emph{expanded} content of
+\begin{itemize}
+\item\refKey{/csvsim/command}
+\end{itemize}
+is added to \docAuxCommand{csvdatacollection}.
+Note that for \refKey{/csvsim/command} special care has to be taken
+\emph{what} should be protected from expansion and \emph{what not}.
+Observe the following hints for \refKey{/csvsim/command}:
+\begin{itemize}
+\item For data macros like |\csvcoli| use |\csvexpval\csvcoli| to add
+ the \emph{value} of this macro to \refCom{csvdatacollection}.
+ This is optional, if |\csvcoli| contains numbers or text without active
+ characters, but essential, if it contains macros.
+\item For macros like |\textbf| use |\csvexpnot\textbf| to \emph{prevent}
+ expansion.
+\item Using computations or not expandable conditionals may likely cause
+ compilation errors.
+\end{itemize}
+
+\begin{dispExample}
+\csvreader[
+ collect data,
+ head to column names,
+ late after line=\\,
+ late after last line=,
+ ]{grade.csv}{}{%
+ \thecsvrow. \csvexpval\givenname\ \csvexpnot\textbf{\csvexpval\name}
+ }
+Collected data:\par
+\csvdatacollection
+\end{dispExample}
+
+Note that data collection is \emph{limited} to some special cases and does not
+allow to save all possible content. Table options like \refKey{/csvsim/longtable}
+are generally not supported with the important exception of \refKey{/csvsim/tabularray}
+which uses \refKey{/csvsim/collect data} automatically.\par
+See \Fullref{sec:tabularray} for examples.
+\end{docCsvKey}
+
+\clearpage
+
+\begin{docCsvKey}[][doc new=2021-07-06]{data collection}{=\meta{macro}}{no default, initially \refCom{csvdatacollection}}
+Sets the collection macro to an alternative for \refCom{csvdatacollection}.
+\begin{dispListing}
+ data collection = \myData, % instead of \csvdatacollection
+\end{dispListing}
+\end{docCsvKey}
+
+
+\begin{docCommand}[doc new=2021-07-26]{csvdatacollection}{}
+ Macro which contains the collected data of a CSV file processed with
+ \refKey{/csvsim/collect data}. This macro name can be changed by
+ settiing \refKey{/csvsim/data collection}.
+\end{docCommand}
+
+
+\begin{docCommand}[doc new=2021-07-26]{csvexpval}{\meta{macro}}
+ Recovers the content of the given \meta{macro} and prevents further
+ expansion. This is a wrapper for \docAuxCommand*{exp_not:V}.
+ Alternatively, |\expandonce| from \ctanpkg{etoolbox} could be used.
+\end{docCommand}
+
+
+\begin{docCommand}[doc new=2021-07-26]{csvexpnot}{\meta{macro}}
+ Prevents the expansion of the given \meta{macro}. This is a wrapper
+ for \docAuxCommand*{exp_not:N}.
+ Alternatively, |\noexpand| could be used.
+\end{docCommand}
+
+
+\begin{docCommand}[doc new=2021-07-26]{csvcollectn}{\marg{code}}
+ Appends the given \meta{code} to \refCom{csvdatacollection}.\\
+ This corresponds to \docAuxCommand*{tl_gput_right:Nn}.
+\end{docCommand}
+
+
+\begin{docCommand}[doc new=2021-07-26]{csvcollectx}{\marg{code}}
+ Appends the expansion of the given \meta{code} to \refCom{csvdatacollection}.\\
+ This corresponds to \docAuxCommand*{tl_gput_right:Nx}.
+\end{docCommand}
+
+\begin{docCommand}[doc new=2021-07-26]{csvcollectV}{\meta{macro}}
+ Appends the content of the given \meta{macro} to \refCom{csvdatacollection}.\\
+ This corresponds to \docAuxCommand*{tl_gput_right:NV}.
+\end{docCommand}
+
+
+\clearpage
\section{String and Number Tests}\label{sec:stringtests}%
The following string tests are complementing the string tests
@@ -2003,7 +2140,7 @@ introduced.
\clearpage
-\subsection{A Graphical Presentation}%
+\subsection{A Graphical Presentation}\label{sec:examgrapghpres}%
For this example, we use some artificial statistical data given by a CSV file.
%-- file embedded for simplicity --
@@ -2202,10 +2339,10 @@ December, 2.2, 3.3e3
\medskip
-The |siunitx| package provides a huge amount of formatting options for
-numbers. A good and robust way to apply formatting by |siunitx| inside
+The \ctanpkg{siunitx} package provides a huge amount of formatting options for
+numbers. A good and robust way to apply formatting by \ctanpkg{siunitx} inside
tables generated by |csvsimple-l3| is the |\tablenum| macro from
-|siunitx|.
+\ctanpkg{siunitx}.
\begin{dispExample}
% \usepackage{siunitx,array,booktabs}
@@ -2366,6 +2503,113 @@ because there is no head, but the columns can be addressed by their numbers:
\end{dispExample}
+
+\clearpage
+\subsection{Tables with \texttt{tabularray}}\label{sec:tabularray}%
+
+The \ctanpkg{tabularray} package gives extended control for generating
+tables. \refKey{/csvsim/tabularray} and \refKey{/csvsim/centered tabularray}
+support such tables. A distinctiveness is that for \ctanpkg{tabularray}
+data from a CSV file has to be \emph{collected} first (into a macro)
+and applied afterwards. The process is hidden from the user view, but
+has to be taken into account when \refKey{/csvsim/command} is set up,
+see \Fullref{sec:datacollection}.
+
+The following examples uses |data.csv| from \Fullref{sec:examgrapghpres}.
+
+\begin{dispExample}
+% \usepackage{tabularray,siunitx,xfp}
+\csvreader[
+ head to column names,
+ centered tabularray =
+ {
+ rowsep = 1mm,
+ colsep = 5mm,
+ rows = {blue7},
+ hlines = {2pt, white},
+ vlines = {2pt, white},
+ row{1} = {bg=azure3, fg=white, font=\bfseries\large, 8mm},
+ },
+ table head = {\SetCell[c=4]{c} Important Data Table \\},
+ ]{data.csv}{}{
+ \ifcsvstrcmp{\group}{A}{\csvexpnot\SetRow{brown7}}{}
+ \csvexpnot\SetCell{bg=purple7}
+ \csvexpval\land
+ & \csvexpval\group
+ & \csvexpval\amount
+ & \csvexpnot\tablenum[exponent-mode=scientific, round-precision=3,
+ round-mode=places, table-format=1.3e1]{\fpeval{pi*\amount}}
+ }
+\end{dispExample}
+
+Note in the example above that
+\begin{itemize}
+\item \refKey{/csvsim/table head} is \emph{collected} unexpanded, i.e.
+ |\SetCell| has not to be protected. On the other hand, CSV data could not
+ be used here.
+\item \refKey{/csvsim/command} is \emph{collected} expanded. This is identical
+ to the mandatory last argument of \refCom{csvreader}.
+ \begin{itemize}
+ \item Therefore, expansion of |\SetRow|, |\SetCell|, etc. is prevented by \refCom{csvexpnot}.
+ \item The \emph{values} (content) of |\land|, |\group|, etc. are recovered by
+ \refCom{csvexpval}.
+ \item |\ifcsvstrcmp| and |\fpeval| are \emph{expandable} and therefore the
+ results of these commands are \emph{collected}.
+ \end{itemize}
+\end{itemize}
+
+\clearpage
+
+Filters and line ranges can be used for \ctanpkg{tabularray} and all
+data collections without restriction:
+
+\begin{dispExample}
+% \usepackage{tabularray}
+Display group `A` only:\par
+\csvreader[
+ head to column names,
+ filter strcmp = {\group}{A},
+ centered tabularray =
+ {
+ rowsep = 1mm,
+ colsep = 5mm,
+ column{1} = {r, fg=yellow5, colsep=2pt},
+ column{2} = {r, yellow8!10, font=\bfseries},
+ column{3} = {l, yellow8},
+ hlines = {2pt, white},
+ },
+ ]{data.csv}{}{
+ \thecsvrow
+ & \csvexpval\land
+ & \csvexpval\amount
+ }
+\end{dispExample}
+
+
+\begin{dispExample}
+% \usepackage{tabularray}
+Display data from line 3 on:\par
+\csvreader[
+ head to column names,
+ range = 3-,
+ centered tabularray =
+ {
+ rowsep = 1mm,
+ colsep = 5mm,
+ column{1} = {r, fg=violet5, colsep=2pt},
+ column{2} = {r, violet8!10, font=\bfseries},
+ column{3} = {l, violet8},
+ hlines = {2pt, white},
+ },
+ ]{data.csv}{}{
+ \thecsvrow
+ & \csvexpval\land
+ & \csvexpval\amount
+ }
+\end{dispExample}
+
+
+
\clearpage
\subsection{Imported CSV data}\label{sec:importeddata}%
If data is imported from other applications, there is not always a choice
diff --git a/macros/latex/contrib/csvsimple/csvsimple-legacy.pdf b/macros/latex/contrib/csvsimple/csvsimple-legacy.pdf
index 93c22e5fc3..d732b8d80c 100644
--- a/macros/latex/contrib/csvsimple/csvsimple-legacy.pdf
+++ b/macros/latex/contrib/csvsimple/csvsimple-legacy.pdf
Binary files differ
diff --git a/macros/latex/contrib/csvsimple/csvsimple-legacy.sty b/macros/latex/contrib/csvsimple/csvsimple-legacy.sty
index 53a30ab9e3..90be1ca205 100644
--- a/macros/latex/contrib/csvsimple/csvsimple-legacy.sty
+++ b/macros/latex/contrib/csvsimple/csvsimple-legacy.sty
@@ -1,4 +1,4 @@
-%% The LaTeX package csvsimple - version 2.0.0 (2021/06/29)
+%% The LaTeX package csvsimple - version 2.1.0 (2021/07/06)
%% csvsimple-legacy.sty: Simple LaTeX CSV file processing (LaTeX2e)
%%
%% -------------------------------------------------------------------------------------------
@@ -18,7 +18,7 @@
%% This work consists of all files listed in README.md
%%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{csvsimple-legacy}[2021/06/29 version 2.0.0 LaTeX2e CSV file processing]
+\ProvidesPackage{csvsimple-legacy}[2021/07/06 version 2.1.0 LaTeX2e CSV file processing]
%---- check package
diff --git a/macros/latex/contrib/csvsimple/csvsimple-legacy.tex b/macros/latex/contrib/csvsimple/csvsimple-legacy.tex
index c22c56181f..d38d3de3a7 100644
--- a/macros/latex/contrib/csvsimple/csvsimple-legacy.tex
+++ b/macros/latex/contrib/csvsimple/csvsimple-legacy.tex
@@ -1,6 +1,6 @@
% \LaTeX-Main\
% !TeX encoding=UTF-8
-%% The LaTeX package csvsimple - version 2.0.0 (2021/06/29)
+%% The LaTeX package csvsimple - version 2.1.0 (2021/07/06)
%% csvsimple.tex: Manual
%%
%% -------------------------------------------------------------------------------------------
diff --git a/macros/latex/contrib/csvsimple/csvsimple.pdf b/macros/latex/contrib/csvsimple/csvsimple.pdf
index 805a052473..46cfca6325 100644
--- a/macros/latex/contrib/csvsimple/csvsimple.pdf
+++ b/macros/latex/contrib/csvsimple/csvsimple.pdf
Binary files differ
diff --git a/macros/latex/contrib/csvsimple/csvsimple.sty b/macros/latex/contrib/csvsimple/csvsimple.sty
index def091859f..f4c8a1d503 100644
--- a/macros/latex/contrib/csvsimple/csvsimple.sty
+++ b/macros/latex/contrib/csvsimple/csvsimple.sty
@@ -1,4 +1,4 @@
-%% The LaTeX package csvsimple - version 2.0.0 (2021/06/29)
+%% The LaTeX package csvsimple - version 2.1.0 (2021/07/06)
%% csvsimple.sty: Simple LaTeX CSV file processing
%%
%% -------------------------------------------------------------------------------------------
@@ -19,7 +19,7 @@
%%
\RequirePackage{l3keys2e}
-\ProvidesExplPackage{csvsimple}{2021/06/29}{2.0.0}
+\ProvidesExplPackage{csvsimple}{2021/07/06}{2.1.0}
{LaTeX CSV file processing}
\cs_if_exist:NT \c__csvsim_package_expl_bool
diff --git a/macros/latex/contrib/csvsimple/csvsimple.tex b/macros/latex/contrib/csvsimple/csvsimple.tex
index 305f949631..448e6698b0 100644
--- a/macros/latex/contrib/csvsimple/csvsimple.tex
+++ b/macros/latex/contrib/csvsimple/csvsimple.tex
@@ -1,6 +1,6 @@
% \LaTeX-Main\
% !TeX encoding=UTF-8
-%% The LaTeX package csvsimple - version 2.0.0 (2021/06/29)
+%% The LaTeX package csvsimple - version 2.1.0 (2021/07/06)
%% csvsimple.tex: Manual
%%
%% -------------------------------------------------------------------------------------------
@@ -78,7 +78,7 @@ following packages:
\end{dispListing}
\medskip
-\item \href{csvsimple-l3.pdf}{\flqq The |csvsimple-legacy| package\frqq}:\\
+\item \href{csvsimple-legacy.pdf}{\flqq The |csvsimple-legacy| package\frqq}:\\
This is the \LaTeXe{} version of |csvsimple|. It is considered
to be the \emph{superseded} version identical to version 1.22 of |csvsimple|.
Documents based on that former version do \emph{not have to be changed}
@@ -121,7 +121,7 @@ upgrade point of view.
\item The most significant change of the user interface is that the key value
engine of |csvsimple-legacy| is |pgfkeys| (root \docAuxKey*[csv]{}) while |csvsimple-l3| uses
|l3keys| (root \docAuxKey*[csvsim]{}).
- Names und usage of the keys are \emph{unchanged}.
+ Names and usage of the keys are \emph{unchanged}.
But, if
you made own |pgfkeys| \emph{styles} using the |pgfkeys| style handler,
these \emph{styles} have to be adapted to |.meta| keys of |l3keys|.