Nodes containing square brackets produce invalid tikzcd code
varkor opened this issue · comments
A diagram containing a single node [A]
causes a tikzcd error when exported. It should be escaped as {[A]}
. Perhaps it'd be easiest to ensure all nodes are wrapped with {}
, or else work out which characters require escaping in this way.
Do you, by chance, know what characters require escaping?
I was trying to find out earlier, but I didn't have much success. TikZ itself lists a range of "special characters", but they don't seem to exactly coincide with tikzcd. It might be sufficient now to take an overly-generous range like TikZ's: [Unicode characters] with a decimal code number between 33 and 126 that are neither digits nor letters
. Though there are some characters in that range that are valid in tikzcd (I'm not sure if there are some outside that range that are not).
An addendum to this issue, which is slightly different, but similar, is that some special characters like ±
or é
are displayed correctly in tikzcd-editor, but are invisible in the generated diagram. I'm not sure quite what's going on there.
some special characters like ± or é are displayed correctly in tikzcd-editor, but are invisible in the generated diagram.
Do these work in LaTeX outside of a TikZ CD diagram?
Do these work in LaTeX outside of a TikZ CD diagram?
No, they don't — so I'd either expect them not to be displayed in tikzcd-editor, or for them to be escaped/converted correctly when exporting the LaTeX, for consistency. Preferably the latter, but consistency is most important.
No, they don't
Then it's possible that your LaTeX environment isn't properly configured to support Unicode. See also this discussion on StackExchange.
Ah, that's a good point. Ignore that comment, then: I can blame LaTeX instead!
I can blame LaTeX instead!
That's what I was trying to get at ;)