Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

When I try to put an = symbol into a TikZ node label specified as an option (using label=), I get an error:

Extra }, or forgotten $.

Is there a way to specify = in such cases that I'm missing?


\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
  \node(x){$X$};
  \path(x)[late options={label=right:=$A$}];     % Works but doesn't display anything
  \path(x)[late options={label=above:$\neq B$}]; % Works 
  \path(x)[late options={label=below:$C$}];      % Works 
  \path(x)[late options={label=left:$=D$}];      % Fails! 
\end{tikzpicture}
\end{document}
share|improve this question
    
Related: Equal (=) sign within TikZ label –  Qrrbrbirlbel Oct 17 '13 at 12:16
add comment

1 Answer 1

up vote 13 down vote accepted

Key-value systems look for =, and can't 'tell' that the = here is part of the 'value'. You therefore need braces:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
  \node(x){$X$};
  \path(x)[late options={label={right:=$A$}}];
  \path(x)[late options={label=above:$\neq B$}]; 
  \path(x)[late options={label=below:$C$}]; 
  \path(x)[late options={label={left:$=D$}}]; 
\end{tikzpicture}
\end{document}

(You get an error as the = inside math mode leaves to grouping issues, which don't happen in the first case.)

share|improve this answer
    
Thanks! I thought I tried that too, but must have put the braces around the wrong thing. –  raxacoricofallapatorius Jun 27 '12 at 19:32
1  
An answer is in the pgfmanual : /tikz/late options=⟨options⟩ with an example : \path (a) [late options={label=above:world}]; –  Alain Matthes Jun 28 '12 at 7:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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