|
From: Michel G. <mg...@gm...> - 2025-04-24 16:38:46
|
The workaround works great. (\setcounter..° Thanks very much Le jeu. 24 avr. 2025 à 17:13, Leo Butler <Leo...@um...> a écrit : > On Wed, Apr 23 2025, Robert Dodier <rob...@gm...> wrote: > > > On Wed, Apr 23, 2025 at 12:38 PM Leo Butler <Leo...@um...> > wrote: > >> > >> This is a limit in tex: > >> > >> > https://stackoverflow.com/questions/2789416/typesetting-a-large-matrix-in-latex > >> > >> The solution, made clear in the second answer, is to do something like > >> > >> \setcounter{MaxMatrixCols}{30} > >> > >> See also: https://sourceforge.net/p/maxima/bugs/4332/#7f8b > > > > There is a different implementation of TeX output for a matrix in > > share/utils/mactex-utilities.lisp, which makes use of \begin{pmatrix} > > and \end{pmatrix}. I think load("mactex-utilities.lisp") should find > > it. Does that obviate the problem with the maximum number of columns? > > No, it does not, as you can confirm by loading that package into an > imaxima session and creating a matrix with ≥ 10 columns (the SO question > I cite found the problem using the amsmath `bmatrix' environment.) > > The following does work (again, tested using imaxima): > > texput(matrix,lambda([expr], > printf(false,"\\setcounter{MaxMatrixCols}{~a}\\begin{pmatrix}~%~{~{~a~^&~}~^\\\\~}~%\\end{pmatrix}",length(first(args(expr))),map(lambda([row],map(tex1,row)),args(expr))))) > $ > > > > > > I gather that \begin{pmatrix} / \end{pmatrix} is from AMSTeX. Is that > > a reason to avoid it? > > I guess this is a perennial question about the `tex' command; the > command's name suggests that it should emit valid TeX (\pmatrix // > \endpmatrix), not LaTeX (\begin{pmatrix} // \end{pmatrix}). > > The current version of mactex.lisp does use \pmatrix if it is available. > > > Should we consider moving TEX-MATRIX from > > share/utils/mactex-utilities.lisp to src/mactex.lisp? > > I don't think so. Although it is easier to read the output, it violates > the presumption that `tex' generates valid TeX. > > The same SO link suggests using the `+bmatrix' environment from the > tabularray package. Apparently, this obviates the need to set > `MaxMatrixCols'. > > Leo |