1

I don't know why, but I tried to print some code in a tikzmath file, and the result is really strange, it looks like that tikzmath tries to substitute texts even if does not begin with a backslash... For example here the variable is not even used, and a substitution is done...

MWE:

\documentclass{report}
\usepackage{tikz}
\usetikzlibrary{math}

\begin{document}

\begin{tikzpicture}
  \tikzmath{
    % Fails
    \color = "blue!80";
    % Works
    % \ccolor = "blue!80";
    {\draw[-latex] (0,0) -- (1,1) node{$\textcolor{red}{A}$};};
  }      
\end{tikzpicture}

\end{document}

Output: enter image description here

Wanted output: enter image description here

Thank you!

1
  • Try node[red]{$A$};.
    – user121799
    Feb 6, 2018 at 16:12

1 Answer 1

3

The reason is that your statement \color = "blue!80"; overrides the TeX command \color. If you comment out this line, it also works as expected. Otherwise you can use {\draw[-latex] (0,0) -- (1,1) node[red]{$A$};};, but I'd recommend not to (ab)use TeX commands like this.

1
  • Hum I'm so stupid. Thank you! And I don't want to use node[red] here because in "real life" I just want to change a single letter. Thank you!
    – tobiasBora
    Feb 6, 2018 at 16:28

You must log in to answer this question.

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