texlive[72886] Master/texmf-dist: latex2pydata (18nov24)
commits+karl at tug.org
commits+karl at tug.org
Mon Nov 18 22:05:35 CET 2024
Revision: 72886
https://tug.org/svn/texlive?view=revision&revision=72886
Author: karl
Date: 2024-11-18 22:05:35 +0100 (Mon, 18 Nov 2024)
Log Message:
-----------
latex2pydata (18nov24)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/latex2pydata/CHANGELOG.md
trunk/Master/texmf-dist/doc/latex/latex2pydata/latex2pydata.pdf
trunk/Master/texmf-dist/source/latex/latex2pydata/latex2pydata.dtx
trunk/Master/texmf-dist/tex/latex/latex2pydata/latex2pydata.sty
Modified: trunk/Master/texmf-dist/doc/latex/latex2pydata/CHANGELOG.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/latex2pydata/CHANGELOG.md 2024-11-18 21:05:24 UTC (rev 72885)
+++ trunk/Master/texmf-dist/doc/latex/latex2pydata/CHANGELOG.md 2024-11-18 21:05:35 UTC (rev 72886)
@@ -1,6 +1,14 @@
# Changelog — latex2pydata LaTeX package
+## v0.4.0 (2024/11/17)
+
+* Replaced buffer index counter with a macro to prevent issues with commands
+ and environments such as `\text` from `amsmath` that modify counter
+ behavior.
+
+
+
## v0.3.0 (2024/10/16)
* Replaced buffer length counters with macros to prevent issues with
Modified: trunk/Master/texmf-dist/doc/latex/latex2pydata/latex2pydata.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/latex/latex2pydata/latex2pydata.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/latex2pydata/latex2pydata.dtx 2024-11-18 21:05:24 UTC (rev 72885)
+++ trunk/Master/texmf-dist/source/latex/latex2pydata/latex2pydata.dtx 2024-11-18 21:05:35 UTC (rev 72886)
@@ -26,7 +26,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{latex2pydata}
%<*package>
- [2024/10/16 v0.3.0 latex2pydata - write data to file in Python literal format]
+ [2024/11/17 v0.4.0 latex2pydata - write data to file in Python literal format]
%</package>
%
%<*driver>
@@ -816,11 +816,10 @@
%
% The buffer consists of a sequence of macros of the form |\<buffer_name>line<n>|, where each line of data corresponds to a macro and |<n>| is an integer greater than or equal to one. The length of the buffer is stored in the macro |\<buffer_name>length|. The buffer includes comma-separated key-value data, without any opening or closing dict delimiters |{}|.
%
-% \begin{macro}{pydata at bufferindex}
-% Counter for looping through buffers.
+% \begin{macro}{\pydata at bufferindex}
+% Macro for looping through buffers.
% \begin{macrocode}
-\newcounter{pydata at bufferindex}
-\setcounter{pydata at bufferindex}{0}
+\def\pydata at bufferindex{0}
% \end{macrocode}
% \end{macro}
%
@@ -857,13 +856,13 @@
{\pydata at error{Cannot write buffer when file has a key waiting for a value}}{}%
\ifbool{pydata at bufferhaskey}%
{\pydata at error{Cannot write buffer when a buffered key is waiting for a value}}{}%
- \setcounter{pydata at bufferindex}{1}%
- \loop\unless\ifnum\value{pydata at bufferindex}>\pydata at bufferlengthmacro\relax
+ \gdef\pydata at bufferindex{1}%
+ \loop\unless\ifnum\pydata at bufferindex>\pydata at bufferlengthmacro\relax
\immediate\write\pydata at filehandle{%
- \csname\pydata at bufferlinename\arabic{pydata at bufferindex}\endcsname}%
- \stepcounter{pydata at bufferindex}%
+ \csname\pydata at bufferlinename\pydata at bufferindex\endcsname}%
+ \xdef\pydata at bufferindex{\the\numexpr\pydata at bufferindex+1\relax}%
\repeat
- \setcounter{pydata at bufferindex}{0}}
+ \gdef\pydata at bufferindex{0}}
% \end{macrocode}
% \end{macro}
%
@@ -877,14 +876,14 @@
\else
\pydata at error{Buffer #1 does not exist}%
\fi
- \setcounter{pydata at bufferindex}{1}%
- \loop\unless\ifnum\value{pydata at bufferindex}>\csname#1length\endcsname\relax
+ \gdef\pydata at bufferindex{1}%
+ \loop\unless\ifnum\pydata at bufferindex>\csname#1length\endcsname\relax
\expandafter\global\expandafter\let
- \csname#1line\arabic{pydata at bufferindex}\endcsname\pydata at undefined
- \stepcounter{pydata at bufferindex}%
+ \csname#1line\pydata at bufferindex\endcsname\pydata at undefined
+ \xdef\pydata at bufferindex{\the\numexpr\pydata at bufferindex+1\relax}%
\repeat
\expandafter\gdef\csname#1length\endcsname{0}%
- \setcounter{pydata at bufferindex}{0}%
+ \gdef\pydata at bufferindex{0}%
\ifx\pydata at clearbuffername\pydata at buffername
\boolfalse{pydata at bufferhaskey}%
\fi}
Modified: trunk/Master/texmf-dist/tex/latex/latex2pydata/latex2pydata.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/latex2pydata/latex2pydata.sty 2024-11-18 21:05:24 UTC (rev 72885)
+++ trunk/Master/texmf-dist/tex/latex/latex2pydata/latex2pydata.sty 2024-11-18 21:05:35 UTC (rev 72886)
@@ -20,7 +20,7 @@
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{latex2pydata}
- [2024/10/16 v0.3.0 latex2pydata - write data to file in Python literal format]
+ [2024/11/17 v0.4.0 latex2pydata - write data to file in Python literal format]
\def\pydata at error#1{%
\PackageError{latex2pydata}{#1}{}%
\batchmode\read -1 to \pydata at exitnow}
@@ -155,8 +155,7 @@
\else
\pydata at error{Unknown file name "#1"}%
\fi}
-\newcounter{pydata at bufferindex}
-\setcounter{pydata at bufferindex}{0}
+\def\pydata at bufferindex{0}
\def\pydatasetbuffername#1{%
\ifbool{pydata at bufferhaskey}%
{\pydata at error{Cannot change buffers when a buffered key is waiting for a value}}%
@@ -181,13 +180,13 @@
{\pydata at error{Cannot write buffer when file has a key waiting for a value}}{}%
\ifbool{pydata at bufferhaskey}%
{\pydata at error{Cannot write buffer when a buffered key is waiting for a value}}{}%
- \setcounter{pydata at bufferindex}{1}%
- \loop\unless\ifnum\value{pydata at bufferindex}>\pydata at bufferlengthmacro\relax
+ \gdef\pydata at bufferindex{1}%
+ \loop\unless\ifnum\pydata at bufferindex>\pydata at bufferlengthmacro\relax
\immediate\write\pydata at filehandle{%
- \csname\pydata at bufferlinename\arabic{pydata at bufferindex}\endcsname}%
- \stepcounter{pydata at bufferindex}%
+ \csname\pydata at bufferlinename\pydata at bufferindex\endcsname}%
+ \xdef\pydata at bufferindex{\the\numexpr\pydata at bufferindex+1\relax}%
\repeat
- \setcounter{pydata at bufferindex}{0}}
+ \gdef\pydata at bufferindex{0}}
\def\pydataclearbuffername#1{%
\def\pydata at clearbuffername{#1}%
\ifcsname#1length\endcsname
@@ -194,14 +193,14 @@
\else
\pydata at error{Buffer #1 does not exist}%
\fi
- \setcounter{pydata at bufferindex}{1}%
- \loop\unless\ifnum\value{pydata at bufferindex}>\csname#1length\endcsname\relax
+ \gdef\pydata at bufferindex{1}%
+ \loop\unless\ifnum\pydata at bufferindex>\csname#1length\endcsname\relax
\expandafter\global\expandafter\let
- \csname#1line\arabic{pydata at bufferindex}\endcsname\pydata at undefined
- \stepcounter{pydata at bufferindex}%
+ \csname#1line\pydata at bufferindex\endcsname\pydata at undefined
+ \xdef\pydata at bufferindex{\the\numexpr\pydata at bufferindex+1\relax}%
\repeat
\expandafter\gdef\csname#1length\endcsname{0}%
- \setcounter{pydata at bufferindex}{0}%
+ \gdef\pydata at bufferindex{0}%
\ifx\pydata at clearbuffername\pydata at buffername
\boolfalse{pydata at bufferhaskey}%
\fi}
More information about the tex-live-commits
mailing list.