Closed tobiasBora closed 3 years ago
The nesting restriction actually comes from PGF matrices (the error message is quite hopeful: "You cannot nest pgfmatrix environments, yet", but it's 15 years old).
Same for merging columns: if this was available from PGF/TikZ, then it would be immediately avaiable in tikz-cd
.
Ok thanks for your help. I was thinking that execute at end picture
could escape this nesting issue, but I'll continue to use my method then. Thanks!
First, thanks a lot for this great library. I recently designed a library to typeset ZX-calculus on top of
tikz-cd
, and sometimes I would like to "nest" tikz-cd matrices, or, more precisely, to add at the end of the figure drawing a tikz-cd drawing (using thefit
library) on top of an existing matrix. However, when I try that I get an error.To illustrate my need, here is a simple example. The following code:
produces this picture:
If I insert below some stuff, like that:
then I get this picture:
As you can see the initial drawing is now much wider, because of the nodes below. So I tried to include the first drawing in the second like that, but unfortunately it fails:
the error I get is
! Package tikz-cd Error: Diagrams cannot be nested.
.A first solution I found is to save the box before the drawing like that:
and I get the expected result:
This is better than nothing, but it is not really practical since I need to create the box before the matrix: therefore I can't create a command inside the matrix that will automatically add this code at the end. The following code indeed fails:
Do you have any solution?
By the way, I'd love also a way to merge columns, it would be more robust to overlays than using the fit library. But I think it's quite hard to get.