# What is the problem with \node[red]{X}; in RTL context (xelatex)

This example on tikz node if I use \node[red]{x}; in math mode (RTL context) the node appears faraway unlike \node[color=red]{x};, I thought the two were equivalent

In pgfmanual (Page 173) we can find that

What happens is that every option that TikZ does not know, like red!20, gets a “second chance” as a color name.

\documentclass{article}
\usepackage{tikz}
\usepackage{bidi}

\begin{document}

\huge

\setRTL

Text start here

$$A \tikz\node[red]{X}; B$$

\bigskip

$$A \tikz\node[color=red]{X}; B$$

\end{document}


The problem do not appears if we use just \beginR provided to change text direction and used intensively in bidi package

Example without bidi

\documentclass{article}
\usepackage{tikz}

\TeXXeTstate=1

\begin{document}

\huge

\everypar{\beginR}

Text start here

$$A \tikz\node[red]{X}; B$$

\bigskip

$$A \tikz\node[color=red]{X}; B$$

\end{document}


• In this very particular case \color is called, which is known for not working well in the RTL mode. Neutralize it by \def\color#1{}. Jun 24 at 22:16

A step by step breakdown:

• red is not a predefined TikZ key.

• /tikz/.unknown/.code is called. (tikz.code.tex line 1651) This is the routine that checks if the passed key is (a) a PGF key, (b) a color, (c) an arrow, or (d) a shape

• red is a color; \tikz@addoption{\tikz@compat@color@set{red}} is fired.

• \tikz@compat@color@set (tikz.code.tex line 1687) calls \pgfutil@color.

• \pgfutil@color (pgfutil-latex.def line 30) calls \color.

• Boom.