yishn / tikzcd-editor

A simple visual editor for creating commutative diagrams.
https://tikzcd.yichuanshen.de/
MIT License
1.88k stars 99 forks source link

Nodes containing square brackets produce invalid tikzcd code #21

Closed varkor closed 6 years ago

varkor commented 6 years ago

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.

yishn commented 6 years ago

Do you, by chance, know what characters require escaping?

varkor commented 6 years ago

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.

technicalguy commented 6 years ago

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?

varkor commented 6 years ago

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.

yishn commented 6 years ago

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.

varkor commented 6 years ago

Ah, that's a good point. Ignore that comment, then: I can blame LaTeX instead!

technicalguy commented 6 years ago

I can blame LaTeX instead!

That's what I was trying to get at ;)