4

When I put one tblr environment in another there is an alignment problem, it is centered when it should not as you can see in the example below.

enter image description here

\documentclass{article} \usepackage{tabularray} \usepackage{amsmath} \begin{document} tblr in tblr : \[ \begin{tblr}{cr@{\ }c@{\ }l} & \det( \overrightarrow{AM};\overrightarrow{AB}) &=& 0 \\ \iff& \begin{tblr}{|cc|} x-1 & -3 \\ y+3 & 4 \\ \end{tblr} &=& 0 \\ \iff& 4(x-1) + 3(y+3) &=& 0 \\ \end{tblr}\] array in tblr : \[ \begin{tblr}{cr@{\ }c@{\ }l} & \det( \overrightarrow{AM};\overrightarrow{AB}) &=& 0 \\ \iff& \begin{array}{|cc|} x-1 & -3 \\ y+3 & 4 \\ \end{array} &=& 0 \\ \iff& 4(x-1) + 3(y+3) &=& 0 \\ \end{tblr}\] \end{document} 
2
  • 2
    I see no reason for using tblr in this case. And I don't think that nesting tblr is supported. Commented May 16, 2024 at 10:01
  • @egreg In fact, I used the tabularray +vmatrix environment but I simplified it for the example. Commented May 16, 2024 at 14:16

1 Answer 1

8

I don't think that you can nest tblr environments, because they seem to do global assignments.

You might prepare the inner one separately, but you have available much better tools for math alignments.

\documentclass{article} \usepackage{tabularray} \usepackage{amsmath} \newsavebox{\tblrbox} \begin{document} Nesting \texttt{tblr} can be made to work \[ \sbox{\tblrbox}{$\begin{tblr}{|cc|} x-1 & -3 \\ y+3 & 4 \\ \end{tblr}$} \begin{tblr}{cr@{\ }c@{\ }l} & \det( \overrightarrow{AM};\overrightarrow{AB}) &=& 0 \\ \iff& \usebox{\tblrbox} &=& 0 \\ \iff& 4(x-1) + 3(y+3) &=& 0 \\ \end{tblr} \] With \texttt{array} it seems to work \[ \begin{tblr}{cr@{\ }c@{\ }l} & \det( \overrightarrow{AM};\overrightarrow{AB}) &=& 0 \\ \iff& \begin{array}{|cc|} x-1 & -3 \\ y+3 & 4 \\ \end{array} &=& 0 \\ \iff& 4(x-1) + 3(y+3) &=& 0 \\ \end{tblr} \] However, with \texttt{amsmath} alignments it's even better and easier \[ \begin{alignedat}{2} && \det( \overrightarrow{AM};\overrightarrow{AB}) &= 0 \\ &\Longleftrightarrow\quad& \begin{vmatrix} x-1 & -3 \\ y+3 & 4 \\ \end{vmatrix} &= 0 \\ &\Longleftrightarrow\quad& 4(x-1) + 3(y+3) &= 0 \end{alignedat} \] \end{document} 

enter image description here

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.