TransWikia.com

Fill a matrix with multido

TeX - LaTeX Asked by joaopa on December 10, 2020

I would like to fulfill a matrix with multido (because I will have tons of matrices to write). I would like to do something like this but that does not work

documentclass[11pt]{article}
usepackage{amsmath,multido,ifthen}
begin{document}
$$begin{pMatrix}multido{i=1+1}{13}{%
multido{I=1+1}{7}{%
1ifthenelse{I<7}{&}{\}}}
end{pmatrix}$$
end{document}

If someone has a good idea…

One Answer

You can use pAutoNiceMatrix of nicematrix to construct whatever matrix you want.

documentclass{article}
usepackage{nicematrix}
usepackage{ifthen}

begin{document}
[pAutoNiceMatrix{13-13}{ifthenelse{arabic{iRow}<arabic{jCol}}{1}{0}}]
end{document}

iRow is the LaTeX counter for the current row and jCol for the current column. They are defined by nicematrix.

Output of the above code

Correct answer by F. Pantigny on December 10, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP