1

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.

2

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:

\documentclass[border=1mm]{standalone}
\usepackage{tikz-cd}

\pagecolor{yellow}

\begin{document}

\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]\\
\end{tikzcd}

\end{document}

Result:

enter image description here

1
  • This is great, thank you!
    – trujello
    Feb 26 '20 at 4:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.