1

I would like to change the colour of all my tikzcd diagrams. From the manual, I read that I can write

\tikzcdset{color=localblack}

in my preamble and change the colours globally. However, some lines later, the manual warns

Besides the keys described in this manual, numerous TikZ parameters can affect the appearance of a diagram. However, only a few of them (namely those appearing in every diagram, every cell, every arrow, and every label below) are reinitialized when {tikzcd} is called. This means that modifying a certain TikZ parameter globally may or may not affect the output of {tikzcd}. [...] Some examples are [...] color=〈color〉, [...]

and, in fact, adding the command above to my preamble makes only some parts of tikzcd diagrams of the right colour leaving some others (like arrows) of the default colour.

Here's a small example:

\documentclass{article} 
\usepackage{tikz} 
\usepackage{tikz-cd} 
\tikzset{color=red} 
\begin{document} 
\[ \begin{tikzcd}    
V_i \arrow[dd, "f_V"'] \arrow[rd, "c_i"] & \\     
& V_0 \\    
V_j \arrow[ru, "c_j"']                  &  
\end{tikzcd} \]
\end{document}

How do I prevent tikzcd from reinitializing the 'color' parameter? Other solutions to this would also be welcome.

3
  • 2
    Can you please show an example of code we can play with?
    – egreg
    Nov 11, 2022 at 14:02
  • Here's a small example: \documentclass{article} \usepackage{tikz} \usepackage{tikz-cd} \tikzset{color=red} \begin{document} \[ \begin{tikzcd} V_i \arrow[dd, "f_V"'] \arrow[rd, "c_i"] & \\ & V_0 \\ V_j \arrow[ru, "c_j"'] & \end{tikzcd} \] \end{document}
    – Elena
    Nov 11, 2022 at 15:16
  • Please, add it to the question. You can edit it as many times as you want.
    – egreg
    Nov 11, 2022 at 15:33

1 Answer 1

1

You can use the tikz-cd style arrows, which appends to every arrow.

\documentclass{article}
\usepackage{tikz-cd}

\tikzcdset{
  color=red,
  arrows={color=red},
}

\begin{document}

\[
\begin{tikzcd}
  V_i \arrow[dd, "f_V"'] \arrow[rd, "c_i"] \\
  & V_0 \\
  V_j \arrow[ru, "c_j"']
\end{tikzcd}
\]

\end{document}

enter image description here

You must log in to answer this question.

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