I'm making a Tikzcd diagram but I wanted to add color to the background of my document like so:

enter image description here

However, there's clearly an issue with the middle diagram.

In the middle diagram, I wanted to make cube diagram, and as to implement the 3D-effect I had to use the crossing over attribute for those arrows. However, this has now made me realize that Tikzcd implements this by assuming your background color is white; they just put a white rectangle around it. This explains why, when a user wants to cross over two arrows, one must write crossing over on the arrow which is crossing over the other.

It seems unlikely that it's impossible to change the background color from white to something else. Does anyone know how? In addition, it also seems like it might be useful to know how to adjust the thickness of this white rectangle, which would be a nice bonus if anyone knows how to do that too.

By the way, I'm using pagecolor for the background color, if that helps.

1 Answer 1


You can define the background color in the options for the tikzcd environment. This color will then be used for crossing over. As you did not provide a minimal working example, I use the example from the documentation of the tikz-cd package:




\begin{tikzcd}[row sep=scriptsize, column sep=scriptsize, background color=yellow]
    & f^* E_V \arrow[dl] \arrow[rr] \arrow[dd] & & E_V \arrow[dl] \arrow[dd] \\
    f^* E \arrow[rr, crossing over] \arrow[dd] & & E \\
    & U \arrow[dl] \arrow[rr] & & V \arrow[dl] \\
    M \arrow[rr] & & N \arrow[from=uu, crossing over]\\



enter image description here

  • This is great, thank you!
    – trujello
    Commented Feb 26, 2020 at 4:08

You must log in to answer this question.

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