Closed wstomv closed 5 months ago
I don't know Beamer's implementation details, but I assume the command you mentioned uses \everymath
internally. Thus, it is executed after and hence takes priority over the tikzcd settings. I'd say this is actually the expected behavior.
The reason why the arrow labels change color is because tikzcd redefines the \everymath
parameter for labels (namely, to make them print in \scriptstyle
). This could be considered a bug, and we should append to \everymath
instead. Do you care about this?
@astoff Yes, apparently \setbeamercolor{math text}{fg=...}
works via \everymath
(according to the Beamer manual Section 17.3). So, for now, I will not use that command, because this mechanism is too blunt.
By the way, if you use a command like \color{blue}
with a node or arrow label itself (rather than using tikz
styling), like
\begin{tikzcd}
A \ar[d, "\color{blue}f"] & \color{orange}B
\end{tikzcd}
then that will override the color set by \setbeamercolor{math text}{fg=...}
, because in that case the color command ends up inside the math material, and will be applied after \everymath
has taken effect.
It would certainly be good to append to, rather than just redefine, \everymath
. But the coloring of the arrow labels already agrees with that of nodes. So, that won't improve anything. To be more explicit: when you use \setbeamercolor{math text}{fg=...}
, this affects both the coloring of the nodes and of the arrow labels. It does not affect the coloring of the arrows themselves.
The latter could be considered undesirable, since the arrows are part of the math as well. But the user of tikz-cd
can easily fix that by issuing
\tikzcdset{every arrow/.append style = {green}}
By the way, for some reason
\tikzcdset{every node/.append style = {green}}
does not work as expected.
Concerning \scriptstyle
: I don't like that default behavior of tikz-cd
. So, after loading tikz-cd
, my code does
\tikzcdset{every label/.append style = {font = \normalsize}}
to revert it.
My final conclusion is that this issue is not with tikz-cd
, but rather with the combination of tikz
and beamer
.
A solution could be for tikz
to apply styling to math material by temporarily appending the relevant commands to \everymath
. (I have no idea how it does it now. I may drop it is as an issue there.)
My final conclusion is that this issue is not with tikz-cd, but rather with the combination of tikz and beamer.
I agree, so I will close this ticket and hope the situation can be improved upstream.
If you use the LaTeX beamer package, and set a color for math material using
then styling applied within a
tikzcd
environment only affacts the arrows, but not the nodes or arrow labels.With the default setting for
math text
, things work fine intikzcd
. It always works in regular equations. Any idea what is going on, and how to work around this?Here is a small example (output with and without
setbeamercolor
attached):