3

How to do some arithmetic with matrix entries?

I'd like, in the following example, to produce $[A_0,A_1],[A_1, A_2]$ by evaluating the entries, in contrast to the next code which displays the operation, without evaluating it:

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}

\usepackage{nicematrix}
\begin{document}


\[\bAutoNiceMatrix{2-2}{ A_{\arabic{iRow}+\arabic{jCol}-2} }\]

\end{document}

1 Answer 1

6

Use \inteval.

\documentclass[a4paper,10pt]{article}

\usepackage{nicematrix}

\begin{document}

\[\bAutoNiceMatrix{2-2}{ A_{\inteval{\value{iRow}+\value{jCol}-2}} }\]

\end{document}

For older versions of LaTeX you may need to add \usepackage{xfp}.

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .