Bug introduced in 9.0.0 and fixed in 10.0.0

PetersenGraph[5, 2, EdgeLabels -> {8 \[UndirectedEdge] 9 -> "hello"}]

appears to evaluate perfectly, as expected, but in my version, the option EdgeLabels -> {8 \[UndirectedEdge] 9 -> "hello"} is marked in red (as well as the preceding comma), as if it is a syntax error.

This happens for all predefined graphs I've tried so far.

Either this is an interface bug, or I've managed to mess up my syntax highlighting somehow. Can anyone confirm or deny this behaviour?


1 Answer 1


This seems to be a minor bug that shouldn't affect the functionality of PetersenGraph. The symbol has an incorrect SyntaxInformation. If it bothers you, you can (mostly) fix it by putting the following in your Kernel init.m:

If[$Version == 9.0,

  PetersenGraph; (* load symbol *)
  SyntaxInformation[PetersenGraph] = {"ArgumentsPattern"->{_.,_.,OptionsPattern[]}};

After the first use of the function the red colouring will go away.

  • $\begingroup$ Does anyone know if there's a better way, avoiding the wrong colouring even before the first use? $\endgroup$
    – Szabolcs
    Commented Dec 6, 2013 at 18:49
  • $\begingroup$ @rm-rf If you do that, it's still coloured wrong before the first use. I think the problem is that the colouring is done by the front end, and the front end won't synchronize the colouring rules before the symbol has been used at least once (with the knowledge of the FE---which excludes a use in init.m) $\endgroup$
    – Szabolcs
    Commented Dec 6, 2013 at 18:55
  • $\begingroup$ That answers my question. I think I'll wait until the bugfix (presumably coming as bugs in documentation might be embarrassing?) as I'd probably end up fixing quite a lot of symbols; it isn't just the PetersenGraph that exhibits this bug. $\endgroup$
    – fairflow
    Commented Dec 6, 2013 at 19:06
  • $\begingroup$ @fairflow I'd rather hope for fixes for bugs that actually affect functionality ... this little thing I can live with. If you write to support at wolfram.com it's more likely that they'll fix it, provided there's a minor update to v9. I believe this to be already fixed in v10. $\endgroup$
    – Szabolcs
    Commented Dec 6, 2013 at 19:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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