TransWikia.com

Change tikz-cd arrow 'background color' in beamer

TeX - LaTeX Asked by mattecapu on May 10, 2021

I’m typesetting a diagram in beamer. It renders like this:

enter image description here

EDIT: the problem appears to be just the background color of the arrow. It’s white and not transparent, therefore stands out on the black background.

This is the result I want:

enter image description here

Here’s a MWE:

documentclass[10pt, notheorems]{beamer}

usepackage{tikz}
usetikzlibrary{cd, arrows, decorations.pathmorphing}

definecolor{colornormaltext}{HTML}{e5e8f8}
definecolor{colorbg}{HTML}{101316}
definecolor{colorgold}{HTML}{db9a46}

setbeamercolor{background canvas}{bg=colorbg}
setbeamercolor{normal text}{fg=colornormaltext}

begin{document}
    begin{frame}
        begin{equation*}
            begin{tikzcd}[ampersand replacement=&]
                Sh_ W &[-3ex] &[-3ex] Sh_ V
                & Msbl
                arrow[""{name=0, anchor=center, inner sep=0}, "{f_*}"', shift right=2, from=1-1, to=1-3]
                arrow[""{name=1, anchor=center, inner sep=0}, "{f^*}"', shift right=2, from=1-3, to=1-1]
                arrow["{O_W}", from=2-2, to=1-1]
                arrow[""{name=2, anchor=center, inner sep=0}, "{O_V}"', from=2-2, to=1-3]
                arrow["dashv"{anchor=center, rotate=-90}, draw=none, from=1, to=0]
                arrow[shift left=2, Rightarrow, "hat f", from=2, to=1-1]
            end{tikzcd}
        end{equation*}
    end{frame}
end{document}

The incriminated arrow is the very last one in the code:

arrow[shift left=2, Rightarrow, "hat f", from=2, to=1-1]

3 Answers

Found the answer in a different thread.

The tikz-cd environment has a setting for the background color, which you would need to set to black in your case, i.e. simply change

begin{tikzcd}[ampersand replacement=&]

to

begin{tikzcd}[ampersand replacement=&, background color=black]

and it gives the desired result.

Correct answer by kitsune on May 10, 2021

I am not going to create MWE but have you tried adding usetikzlibrary{arrows.meta} to your preamble? Then, try this:

arrow[""{name=0, anchor=center, inner sep=0,latex-}, "{f_*}"', shift right=2, from=1-1, to=1-3]

Answered by NIck Bennett on May 10, 2021

  • You should provide complete MWE, not just fragment diagram code.
  • Your code fragment is a bit strange, so it is hart to understand what is your problem.
  • I just clean-up your code and try to reproduce showed image (without thick arrows which purpose is not clear)
documentclass{beamer}
usepackage{tikz-cd}
usetikzlibrary{arrows.meta}

begin{document}
begin{frame}[fragile]
frametitle{tikz-cd diagram}
[
    begin{tikzcd}[
    row sep = large,
arrow style = tikz,
          > = {Straight Barb[scale=0.8]}  
                    ]
Sh_{mathrm{a.e.}}W_{infty} ar[rr,shift right=0.5em, "1_t*" ', "bot"]
    &   & Sh_{mathrm{a.e.}}W_t  ar[ll,shift right=0.5em,"1^*_t" ']    
    & mathsf{Msbl} ar[ul, "mathcal{O}_{infty}"]
                    ar[ur, "mathcal{O}_t" ']
        &
end{tikzcd}
]
end{frame}
end{document}

enter image description here

Addendum:

It is still (unfortunately) not clear where arrow in the middle of diagram should be. Also if it need to be Rightarrow In case that it need to cross arrows from node 2-2 to 1-3 result can be ugly (to my opinion). So below are two examples of:

documentclass{beamer}
usepackage{tikz-cd}
usetikzlibrary{arrows.meta}

begin{document}
begin{frame}[fragile]
frametitle{tikz-cd diagram}
[
    begin{tikzcd}[
    row sep = large,
arrow style = tikz,
          > = {Straight Barb[scale=0.8]},
                    ]
Sh_{mathrm{a.e.}}W_{infty} ar[rr,shift right=0.5em, "1_t*" ', "bot"]
    &   & Sh_{mathrm{a.e.}}W_t  ar[ll,shift right=0.5em,"1^*_t" ']    
    & mathsf{Msbl} ar[ul, "mathcal{O}_{infty}"]
                    ar[ur, ""{name=Ot,right}]
                    ar[ur, "mathcal{O}_t" ']
                    ar[dashrightarrow, from=Ot, to=1-1,yshift=-1ex]
        &
end{tikzcd}
]
end{frame}
end{document}

enter image description here

or (only diagram code):

Sh_{mathrm{a.e.}}W_{infty} ar[rr,shift right=0.5em, "1_t*" ', "bot"]
    &   & Sh_{mathrm{a.e.}}W_t  ar[ll,shift right=0.5em,"1^*_t" ']    
    & mathsf{Msbl} ar[ul, "mathcal{O}_{infty}"]
                    ar[ur, draw=none, ""{name=Ot,right}]
                    ar[ur, "mathcal{O}_t" ']
                    ar[Rightarrow, crossing over, from=Ot, to=1-1,yshift=-1ex]
        &

enter image description here

or with Rightarrow inside diagram:

Sh_{mathrm{a.e.}}W_{infty} ar[rr,shift right=0.5em, "1_t*" ', "bot"]
    &   & Sh_{mathrm{a.e.}}W_t  ar[ll,shift right=0.5em,"1^*_t" ']    
    & mathsf{Msbl} ar[ul, "mathcal{O}_{infty}"]
                    ar[ur, "mathcal{O}_t" ', ""{name=Ot}]
                    ar[Rightarrow,  from=Ot, to=1-1,yshift=-1ex]
        &

enter image description here

Answered by Zarko on May 10, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP