3

I use a Beamer template with black background. Whenever I type an equal arrow with tikzcd, it appears as a large white line (because some background is added between the two lines of the "equal", and this background is white by default):

i dont want this

How can I get a correct background?

2 Answers2

6

Use the nfold library, so you don't need to guess the background color.

\documentclass{article}
\usepackage{xcolor}
\usepackage{tikz-cd}
\usetikzlibrary{nfold}

\begin{document}

\colorbox{blue!90!red}{% \color{white}% \begin{tikzcd}[ampersand replacement=&] A \arrow[r,equal,nfold] & B \end{tikzcd}% }

\end{document}

enter image description here

egreg
  • 1,121,712
  • 2
    Nice - first time I hear about nfold – hpekristiansen Feb 18 '24 at 22:02
  • @hpekristiansen It's of course slower, but it solves a very important issue with double lines, particularly the curved ones. But also the straight ones showed artifacts. – egreg Feb 18 '24 at 22:08
  • Just read the full manual - I see many benefits. I answered a question today that might have benefitted from nfold : https://tex.stackexchange.com/questions/709865/color-and-opacity-of-rightarrow-in-tikz/709894#709894 – hpekristiansen Feb 18 '24 at 22:12
4

It appears that tikzcd uses TikZ's double option. As I found out in this comment, this option has an optional parameter specifying the background color separating the two lines of the "equal".

In the tikzcd environment, just replace

\arrow[equal]{r}

with

\arrow[equal, double=black]{r}

which produces the correct output:

i want this