texlive[64845] Master/texmf-dist: association-matrix (29oct22)

commits+karl at tug.org commits+karl at tug.org
Sat Oct 29 21:45:47 CEST 2022


Revision: 64845
          http://tug.org/svn/texlive?view=revision&revision=64845
Author:   karl
Date:     2022-10-29 21:45:47 +0200 (Sat, 29 Oct 2022)
Log Message:
-----------
association-matrix (29oct22)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/association-matrix/association-matrix.pdf
    trunk/Master/texmf-dist/doc/latex/association-matrix/association-matrix.tex
    trunk/Master/texmf-dist/tex/latex/association-matrix/association-matrix.sty

Modified: trunk/Master/texmf-dist/doc/latex/association-matrix/association-matrix.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/association-matrix/association-matrix.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/association-matrix/association-matrix.tex	2022-10-29 19:45:25 UTC (rev 64844)
+++ trunk/Master/texmf-dist/doc/latex/association-matrix/association-matrix.tex	2022-10-29 19:45:47 UTC (rev 64845)
@@ -29,7 +29,7 @@
         hidelinks,              % disable link borders
         %colorlinks=false,       % false: boxed links; true: colored links
     }
-\usepackage[capitalize]{cleveref}
+\usepackage{cleveref}  % *MUST* be loaded *after* HyperRef.
 \usepackage{minted}
     \usemintedstyle{borland}
     \setminted{autogobble}
@@ -36,11 +36,11 @@
 \usepackage{xcolor}
 
 \newrobustcmd{\release}[3]{%
-    \subsection{\emph{#1}: \texttt{#2} - #3}\label{release-#2}%
+    \subsection{\emph{#1}: \texttt{#2} - #3}\label{release:#2}%
 }
 
 \newrobustcmd{\command}[3]{%
-    \paragraph{\textsf{#1}} \textbf{\color{blue} \texttt{#2}}
+    \paragraph{\textsf{#1}} \textbf{\color{blue} \texttt{#2}}\label{command:#1}%
 
     #3
 }
@@ -90,7 +90,7 @@
 \section{Introduction}\label{intro}
 The \textsf{association-matrix} package allows the convenient creation of association matrices.
 The package aims to automate the generation, without the user having to manually write the table's code and have to deal with the inefficiency of copy-pasting information.
-The package's interface is simple, the user needs to define the table's contents (\cref{define}) and then can generate the table (\cref{tablegen}).
+The package's interface is simple, the user needs to define the table's contents (\Cref{define}) and then can generate the table (\Cref{tablegen}).
 
 Note that it is important to have \emph{every} necessary row entries and column headings defined \textbf{before} the first call to a table generation, otherwise, only a partial table will be generated.
 
@@ -101,7 +101,7 @@
 Commonly, the dissertation's \emph{``Introduction''} and \emph{``Summary''} chapters will provide the full table.
 In addition, at the end of each individual thesis chapters will provide a table with the current thesis's row in the table \emph{highlighted}.
 
-An example usage and association matrix is provided in \cref{example}.
+An example usage and association matrix is provided in \Cref{example}.
 
 \subsection{Licence}
 Copyright \textcopyright\ 2020 Whisperity.
@@ -110,7 +110,7 @@
 }
 
 \subsection{Example}\label{example}
-The definitions (\cref{define}) should be done early in the document, but at least before the first table render (\cref{tablegen}) call.
+The definitions (\Cref{define}) should be done early in the document, but at least before the first table render (\Cref{tablegen}) call.
 
 \immediate\openout\tempfile=assoc-mx-example.aux
     \immediate\write\tempfile{\bslchar amxrow{association-matrix}{Association Matrices}}
@@ -183,10 +183,10 @@
     Generates the full table incorporating the previously registered data.
     Internally, a \texttt{tabular} environment is created with the table's data generated by the package.
     It is the user's responsibility to wrap this into a floating \texttt{table}, if they so wish.
-    
+
     If \texttt{[<row>]} is given a row's \emph{key}, the row for that key will be \textbf{highlighted}.
     Highlighting is done by typesetting the row's \emph{text} in \textbf{bold face}, and changing every \textbullet{} in the \emph{other} rows to \textopenbullet{}.
-    
+
     \begin{figure}[H]
         \centering
         \amxgenerate[latex]
@@ -231,7 +231,7 @@
 }
 
 \command{amxsetColumnHeading}{\bslchar amxsetColumnHeading\lbchar<render-command>\rbchar}{%
-    Sets the rendered table's top row's cells to be rendered via passing the column heading's text (see \cref{query}) to the given \texttt{<render-command>}.
+    Sets the rendered table's top row's cells to be rendered via passing the column heading's text (see \Cref{query}) to the given \texttt{<render-command>}.
     This command must be a command that takes \textbf{1} argument, defined by the user earlier.
 
     \immediate\openout\tempfile=setcolheading-example.aux
@@ -242,9 +242,9 @@
 }
 
 \command{amxsetRowFormat}{\bslchar amxsetRowFormat(Highlighted)\lbchar<render-command>\rbchar}{%
-    Sets the rendered table's left cells' to be rendered via passing the row's index and text (see \cref{query}) to the given \texttt{<render-command>}.
+    Sets the rendered table's left cells' to be rendered via passing the row's index and text (see \Cref{query}) to the given \texttt{<render-command>}.
     This command must be a command that takes \textbf{2} arguments, defined by the user earlier.
-    The \texttt{Highlighted} version sets the renderer for the highlighted row, if highlighted rendering (see \cref{tablegen}) is done.
+    The \texttt{Highlighted} version sets the renderer for the highlighted row, if highlighted rendering (see \Cref{tablegen}) is done.
 
     \immediate\openout\tempfile=setrowformat-example.aux
         \immediate\write\tempfile{\bslchar newcommand{\bslchar parenRow}[2]{(\hschar1) \bslchar emph{\hschar2}}}
@@ -287,10 +287,10 @@
 
 \command{amxReset}{\bslchar amxReset}{%
     Clears \textbf{all} internal data structures and customisations for the package, allowing the user to later typeset a different, independent matrix.
-    The previously defined entries are lost, and in case the ``previous'' matrix is needed, it must be set up again with a sequence of definition commands (see \cref{define}).
-    
-    For example, putting the code in \cref{example} and the one below into the same source file will create the smaller matrix at the second invocation of \texttt{\bslchar amxgenerate}.
-    
+    The previously defined entries are lost, and in case the ``previous'' matrix is needed, it must be set up again with a sequence of definition commands (see \Cref{define}).
+
+    For example, putting the code in \Cref{example} and the one below into the same source file will create the smaller matrix at the second invocation of \texttt{\bslchar amxgenerate}.
+
     \immediate\openout\tempfile=reset-example.aux
         \immediate\write\tempfile{\bslchar amxReset}
         \immediate\write\tempfile{\bslchar amxrow{sample}{Sample}}
@@ -298,11 +298,11 @@
         \immediate\write\tempfile{\bslchar amxassociate{x}{sample}}
         \immediate\write\tempfile{\detokenize{\amxgenerate}}
     \immediate\closeout\tempfile
-    
+
     \amxDisable
     \input{reset-example.aux}
     \amxEnable
-    
+
     \begin{figure}[H]
         \centering
         \inputminted{latex}{reset-example.aux}
@@ -311,6 +311,17 @@
 }
 
 \clearpage
+\section{Interaction \& compatibility with other packages}\label{compatibility}
+There are several packages that interact with commands in a way that interferes with the behaviour of \texttt{association-matrix}.
+When using such packages, \texttt{association-matrix} \textbf{must be loaded after} them.
+During the initialisation of \texttt{association-matrix}, compatibility is ensured by rewiring some of the logic.
+
+\begin{enumerate}
+    \item\label{compatibility:array} \texttt{array}:
+        Replaced the \texttt{tabular} environment's logic (used by \hyperref[command:amxgenerate]{\mintinline{latex}{\amxgenerate}}) by eagerly attempting to consume the number of columns to create, which was previously created by a macro locally.
+        The issue was fixed in \hyperref[release:v1.1]{release 1.1} by making sure that in presence of the \texttt{array} package, our package does the right thing.
+\end{enumerate}
+
 \section{Development}
 The development of \textsf{association-matrix} is done on GitHub: \url{http://github.com/whisperity/association-matrix}.
 Please report issues and submit patches here.
@@ -320,6 +331,12 @@
 If there is a discrepancy or regression in the looks of \emph{this document} that is not explained by the changes, it should be investigated!
 
 \section{Changelog}\label{changelog}
+\release{2022/10/29}{v1.1}{Compatibility with \texttt{array}}
+\begin{itemize}
+    \item Fixed error message ``\texttt{Illegal pream-token: \`{}c' used}'' emitted by the \texttt{array} package by injecting a compatibility shim.
+        (See \cref{compatibility:array} in \Cref{compatibility}.)
+\end{itemize}
+
 \release{2020/10/25}{v1.0}{Initial release}
 \begin{itemize}
     \item Basic functionality of defining entries, rendering tables, and customising the renderers are implemented.
@@ -330,12 +347,12 @@
 Whisperity. \textit{The \textsf{association-matrix} Package -- An easy and clear association matrix generator}.
 Online, \url{http://ctan.org/pkg/association-matrix} (accessed 2020/10/25), 2020.
 
-\bibitem{latex} 
-Leslie B.\ Lamport, Donald E.\ Knuth et al. 
-\textit{\LaTeX{} -- A document preparation system}. 
+\bibitem{latex}
+Leslie B.\ Lamport, Donald E.\ Knuth et al.
+\textit{\LaTeX{} -- A document preparation system}.
 Online, \url{http://latex-project.org/} (accessed 2020/10/25), 1984.
 
-\bibitem{etoolbox} 
+\bibitem{etoolbox}
 Philipp Lehman, Joseph Wright.
 \textit{The \textsf{etoolbox} Package -- An e-\TeX{} Toolbox for Class and Package Authors}
 Online, \url{http://ctan.org/pkg/etoolbox} (accessed 2020/10/25), 2007.

Modified: trunk/Master/texmf-dist/tex/latex/association-matrix/association-matrix.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/association-matrix/association-matrix.sty	2022-10-29 19:45:25 UTC (rev 64844)
+++ trunk/Master/texmf-dist/tex/latex/association-matrix/association-matrix.sty	2022-10-29 19:45:47 UTC (rev 64845)
@@ -1,5 +1,5 @@
 %% association-matrix.sty
-%% Copyright 2020 Whisperity
+%% Copyright 2020-2022 Whisperity
 %
 % This work may be distributed and/or modified under the
 % conditions of the LaTeX Project Public License, either version 1.3c
@@ -17,7 +17,7 @@
 % and association-matrix.tex.
 %
 \NeedsTeXFormat{LaTeX2e}[2017/01/01]
-\ProvidesPackage{association-matrix}[2020/10/25 v1.0 Association matrix generator]
+\ProvidesPackage{association-matrix}[2022/10/29 v1.1 Association matrix generator]
 
 \RequirePackage{etoolbox}
 \RequirePackage{forloop}
@@ -25,8 +25,8 @@
 \RequirePackage{textcomp}
 \RequirePackage{xparse}
 
-\newrobustcmd{\amxDate}{2020/10/25}
-\newrobustcmd{\amxVersion}{1.0}
+\newrobustcmd{\amxDate}{2022/10/29}
+\newrobustcmd{\amxVersion}{1.1}
 
 \ExplSyntaxOn
 % (via http://tex.stackexchange.com/a/300215)
@@ -40,6 +40,62 @@
 \ExplSyntaxOff
 
 %%%
+%%%    COMPATIBILITY SHIMS
+%%%
+
+%% Compatibility with the 'array' package, because we need to hand-craft the
+%% table's column specifiers. With the 'array' package changing the definition
+%% of 'tabular' to eagerly parse the specifier for what columns to make, the
+%% logic that built the "|c|c|c|..." sequence in conventional LaTeX broke.
+%%
+%% (via http://tex.stackexchange.com/a/199244)
+\newtoggle{amx at Compatibility@array}
+
+% In pure LaTeX, no compatibility needed because we can expand the tokens in
+% the 'tabular' specifier properly.
+\newenvironment{amx at Tabular}[0]{%
+    \begin{tabular}{|l|%
+        \egreg at Repeat[|]{\expandafter\theamx at ColumnCount}{c}%
+        |}%
+}{%
+    \end{tabular}%
+}%
+
+\@ifpackageloaded{array}{%
+    \global\toggletrue{amx at Compatibility@array}%
+    %
+    \newcolumntype{\amx at amx@Array at Expand}{}%
+    \long\@namedef{NC at rewrite@\string\amx at amx@Array at Expand}{\expandafter\NC at find}%
+    \newcommand{\amx at amx@Array at PreambleTrampoline}{}%
+    %
+    \renewenvironment{amx at Tabular}[0]
+        {%
+            % Creates "|l|c|c|c|c|..." sequence, one 'c' for each column.
+            \protected at edef\amx at amx@Array at PreambleTrampoline{|l|%
+                \egreg at Repeat[|]{\expandafter\theamx at ColumnCount}{c}%
+            |}%
+            \begin{tabular}{\amx at amx@Array at Expand\amx at amx@Array at PreambleTrampoline}
+        }{%
+            \end{tabular}
+        }%
+}{%
+    % Intentionally left empty, the default is good enough.
+}
+
+\newrobustcmd{\amx at CheckCompatibility}[0]{%
+    \@ifpackageloaded{array}{%
+        \iftoggle{amx at Compatibility@array}{%
+            % The compatibility was injected, thus no error needed.
+        }{%
+            \PackageError{association-matrix}{%
+                Package 'array' loaded after 'association-matrix' -- compatibility was not set up}{%
+                Make sure to load 'association-matrix' AFTER 'array' because a compatibility shim needs to be inserted for '\\amxgenerate' to work properly.
+            }%
+        }%
+    }{}%
+}
+
+%%%
 %%%    FIELDS, REPRESENTATION AND DEFINITION FUNCTIONS
 %%%
 
@@ -79,7 +135,7 @@
 %% Registers the row with the given key, and text.
 \newrobustcmd{\amx at NewRow}[2]{%
     \stepcounter{amx at RowCount}%
-    % 
+    %
     \listcsgadd{amx at Rows}{#1}%
     \expandafter\def\csname amx at Rows@\theamx at RowCount\endcsname{#1}%
     \expandafter\def\csname amx at RowTexts@\theamx at RowCount\endcsname{#2}%
@@ -99,7 +155,7 @@
 %% Registers the public with the given key, and body.
 \newrobustcmd{\amx at NewColumn}[2]{%
     \stepcounter{amx at ColumnCount}%
-    % 
+    %
     \listcsgadd{amx at Cols}{#1}%
     \expandafter\def\csname amx at Cols@\theamx at ColumnCount\endcsname{#1}%
     \expandafter\def\csname amx at ColTexts@\theamx at ColumnCount\endcsname{#2}%
@@ -298,7 +354,7 @@
             \global\togglefalse{amx at AreAnyHighlightSet}%
         }{%
             \global\toggletrue{amx at AreAnyHighlightSet}%
-            % 
+            %
             % Set highlight for current row.
             \ifthenelse{\equal{##1}{#1}}{%
                 \global\toggletrue{amx at IsCurrentRowHighlighted}%
@@ -311,15 +367,14 @@
         \hline%
     }%
     %
-    \begin{tabular}{|l|%
-        \egreg at Repeat[|]{\expandafter\theamx at ColumnCount}{c}%
-        |%
-    }
+    \amx at CheckCompatibility{}%
+    %
+    \begin{amx at Tabular}
         \hline
         \amx at amx@RenderHeading \\
         \hline
         \forlistcsloop{\amx at amx@RowRenderHELPER}{amx at Rows}%
-    \end{tabular}%
+    \end{amx at Tabular}%
 }
 \newrobustcmd{\amxgenerate}[1][0]{%
     \amx at amx@MakeTabular{#1}%



More information about the tex-live-commits mailing list.