I was trying to insert a label into a node in the tikzpicture environment and I found that some math fonts are recognized while others are not. For example, node {$\mathcal{R}$} works fine but when I try node {$\mathbb{R}$} or node {$\mathfrak{R}$}, I get 'undefined control sequence' error.

How can I insert math expressions involving these fonts as labels into tikzpicture?

  • 2
    Please give some examples in code we can compile. Jul 21 at 16:35
  • Have you loaded the amssymb package? Jul 21 at 17:56
  • you would have exactly the same error if you used those commands without tikz, the question isn't related to tikz at all. Jul 21 at 18:31

Picture of three Rs working fine

\node at (0,0) {$\mathcal{R}$};
\node at (1,0) {$\mathbb{R}$};
\node at (2,0) {$\mathfrak{R}$};

You probably don't have the required fonts loaded; they seem to load automatically in the amsart document class. Try \usepackage{amsfonts} or \usepackage{amssymb} in your document's preamble.

  • Yes, that was indeed the reason, thank you.
    – S.Z.
    Jul 21 at 16:44

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.