The Tikz Quotes Library provides a convenient means of drawing labeled edges between nodes. However, I have encountered a problem when the edge label has a comma in it. Given below is a MWE of the problem. The comma between x and y in the edge drawing statement causes the code not to compile. The code compiles when the comma is removed.

I would appreciate any help with the resolution of the comma issue.

    \node (A) at (0,0) {$x$};
    \node (B) [right = 2cm of A] {$y$};
    \draw[-latex] (A) edge ["$\left(x,y\right)$"] (B);
  • 2
    The same will happen with [ and ], probably. You have to hide them from the option parser with a group, as shown by @Οὖτις (checked, it works here.)
    – Rmano
    Feb 23, 2023 at 9:28
  • 1
    Thanks a lot @Rmano. This is an invaluable advice.
    – user24098
    Feb 23, 2023 at 10:50

1 Answer 1


Try curly brackets around the statement which causes the problem: \draw[-latex] (A) edge ["{$\left(x,y\right)$}"] (B); works fine for me. enter image description here

  • Thanks @Οὖτις for your quick response. I have tried putting a curly brackets around the edge drawing statement but it still does not work.
    – user24098
    Feb 23, 2023 at 9:25
  • 3
    @user24098 works here, please notice the braces position --- they must be inside the quotation mark.
    – Rmano
    Feb 23, 2023 at 9:29
  • 3
    I assume that the square brackets have to "see" the quotation marks, but they must not see the comma because then they start to do weird things, probably they see everything behind the comma as a second argument. Therefore the curly brackets have to contain the comma and be inside the quotation marks (e.g. like I did) Feb 23, 2023 at 9:29
  • Thank you very much @Rmano. I had not taken keen not of where the curly brackets were supposed to be. I have corrected the mistake and the code now works as expected. Great stuff.
    – user24098
    Feb 23, 2023 at 10:47
  • Thank you very much @Οὖτις. I greatly appreciate your solution to my problem.
    – user24098
    Feb 23, 2023 at 10:48

You must log in to answer this question.

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