0

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}

enter image description here

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}

enter image description here

1
  • 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{}.
    – Symbol 1
    Jun 24 at 22:16
2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.