Closed muzimuzhi closed 3 months ago
Also although the doc of csvsim/consume collected data
reads
Otherwise, if set to
true
, the collected data is not saved, but directly used after reading the CSV file, seecsvsim/generic collected table
.
The code actually globally clears the data collection
macro when consume collected data=true
, which is an undocumented behavior. See line 994 in code snippet below
https://github.com/T-F-S/csvsimple/blob/94632b980ff7f5beed9ca7a1361cf05c2481ac8b/tex/latex/csvsimple/csvsimple-l3.sty#L988-L1000
IMO the global clearing needs either be documented or removed.
Originally, I had a single global setting for data collection
in mind. But the usage in https://tex.stackexchange.com/q/717500 is quite straight-forward and the failure not obvious to the user.
So, I agree to change the behaviour and reset data collection
to \csvdatacollection
for every CSV file. To get back the old behaviour, one would need to set
\csvstyle{every csv}{
data collection = \mymacro
}
consume collected data
consumes the data. After consumation, it is 'gone', i.e. the macro becomes empty (free memory). That is supposed to be the etymology for the naming, but I will add a sentence in the documentation.
Resolved with https://github.com/T-F-S/csvsimple/releases/tag/v2.6.1
Thanks!
Found in https://tex.stackexchange.com/q/717500.
Moving setting of
data~collection = \csvdatacollection
to thedefault
meta key (between resettingcollect data
andconsume collected data
) should fix the problem. https://github.com/T-F-S/csvsimple/blob/94632b980ff7f5beed9ca7a1361cf05c2481ac8b/tex/latex/csvsimple/csvsimple-l3.sty#L1040-L1043 https://github.com/T-F-S/csvsimple/blob/94632b980ff7f5beed9ca7a1361cf05c2481ac8b/tex/latex/csvsimple/csvsimple-l3.sty#L1595-L1599Patch
```diff From 19da6ef6bb18f59a34cc4f6bdbeea08f95a77d5c Mon Sep 17 00:00:00 2001 From: Yukai Chou
Date: Thu, 16 May 2024 03:15:21 +0800
Subject: [PATCH] Reset data collection macro (#39)
---
tex/latex/csvsimple/csvsimple-l3.sty | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/tex/latex/csvsimple/csvsimple-l3.sty b/tex/latex/csvsimple/csvsimple-l3.sty
index 9aa9b2c..4759f7c 100644
--- a/tex/latex/csvsimple/csvsimple-l3.sty
+++ b/tex/latex/csvsimple/csvsimple-l3.sty
@@ -1037,12 +1037,6 @@
}
-\keys_set:nn { csvsim }
- {
- data~collection = \csvdatacollection,
- }
-
-
%---- catcodes
@@ -1607,6 +1601,7 @@
head~to~column~names~prefix = ,
head~to~column~names = false,
collect~data = false,
+ data~collection = \csvdatacollection,
consume~collected~data = false,
column~count = 0,
on~column~count~error =,
--
2.45.0
```