Skip to content

add support for unicode angle brackets, single vertical bar, double vertical bar#1123

Merged
k4b7 merged 5 commits intomasterfrom
unicode_angle_brackets
Feb 1, 2018
Merged

add support for unicode angle brackets, single vertical bar, double vertical bar#1123
k4b7 merged 5 commits intomasterfrom
unicode_angle_brackets

Conversation

@k4b7
Copy link
Member

@k4b7 k4b7 commented Jan 31, 2018

This PR also allows these symbols to be used with left/right delimiters. This should allow us to finally close #243.

TODO: write some tests

"<", ">", "\\langle", "\\rangle", "\\lt", "\\gt",
"\\lvert", "\\rvert", "\\lVert", "\\rVert",
"<", ">", "\\langle", "\u27e8", "\\rangle", "\u27e9", "\\lt", "\\gt",
"\\lvert", "\\rvert", "\u2223", "\\lVert", "\\rVert", "\u2225",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just out of curiosity, is it valid to have right delimiters, e.g., \rangle, as a left delimiter?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked with quicklatex.com and it appears so although I'm not sure in what context you'd actually want to do that.

@ronkok
Copy link
Collaborator

ronkok commented Jan 31, 2018

PR #993 and unicode-math both map U+2223 to \mid, not to \lVert or \rVert. \mid is an operator, not a delimiter, useful for set builder notation.

The single character analogue to \vert is ASCII "|", U+007C. That's been true since the TeXbook, p146.

@k4b7
Copy link
Member Author

k4b7 commented Jan 31, 2018

PR #993 and unicode-math both map U+2223 to \mid, not to \lVert or \rVert. \mid is an operator, not a delimiter, useful for set builder notation.

@ronkok thanks for catching this. I'll remove the \lvert/\rvert changes from this diff.

@ronkok
Copy link
Collaborator

ronkok commented Jan 31, 2018

Similarly, unicode-math maps U+2225 to \parallel, which is also an operator, not a delimiter.

const cases = [
['\\left\\langle \\right\\rangle', '\\left< \\right>'],
['\\left\\langle \\right\\rangle', '\\left\u27e8 \\right\u27e9'],
];
Copy link
Member Author

@k4b7 k4b7 Feb 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could be extend to something like:

const cases = {
    'shouldParse': [ ... ],
    'shouldBuild': [ ... ],
    'shouldNotParse': [ ... ],
    'shouldNotBuild': [ ... ],
    'shouldParseLike': [ ... ],
    'shouldBuildLike': [ ... ],
};

I'll open a separate PR for this.

@k4b7 k4b7 merged commit 603f12d into master Feb 1, 2018
@k4b7 k4b7 deleted the unicode_angle_brackets branch February 1, 2018 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Symbol unicode replacement doesn’t work

3 participants