From 6bb312f68701dbddf5a8fec5fd4de34ef0f1d292 Mon Sep 17 00:00:00 2001 From: Tesla_Ice_Zhang <951394653@qq.com> Date: Thu, 25 Apr 2019 10:23:00 -0400 Subject: [PATCH] Support double-square curly braces (#1953) * Support double-square curly braces Signed-off-by: ice1000 * Rename `llbrace` to `lBrace` * Address comments: add mathml * Fix code style * Fix doc * Add to docs/support_table --- docs/support_table.md | 2 ++ docs/supported.md | 2 +- src/macros.js | 10 ++++++++++ test/katex-spec.js | 1 + 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/support_table.md b/docs/support_table.md index 47597ed1..4c1eee56 100644 --- a/docs/support_table.md +++ b/docs/support_table.md @@ -527,6 +527,7 @@ table td { |\Large|$\Large Large$|`\Large Large`| |\LARGE|$\LARGE LARGE$|`\LARGE LARGE`| |\LaTeX|$\LaTeX$|| +|\lBrace|$\lBrace$|| |\lbrace|$\lbrace$|| |\lbrack|$\lbrack$|| |\lceil|$\lceil$|| @@ -841,6 +842,7 @@ table td { |\Rarr|$\Rarr$|| |\rArr|$\rArr$|| |\rarr|$\rarr$|| +|\rBrace|$\rBrace$|| |\rbrace|$\rbrace$|| |\rbrack|$\rbrack$|| |\rceil|$\rceil$|| diff --git a/docs/supported.md b/docs/supported.md index d7bd38ce..c6115a6d 100644 --- a/docs/supported.md +++ b/docs/supported.md @@ -56,7 +56,7 @@ See also [letters](#letters) |$\vert$ | |$\vert$ `\vert` |$┌ ┐$ `┌ ┐`|$\ulcorner \urcorner$ `\ulcorner`
$~~~~$`\urcorner` |$\Downarrow$ `\Downarrow` |$\Vert$ \| |$\Vert$ `\Vert` |$└ ┘$ `└ ┘`|$\llcorner \lrcorner$ `\llcorner`
$~~~~$`\lrcorner` |$\Updownarrow$ `\Updownarrow` |$\lvert~\rvert$ `\lvert`
$~~~~$`\rvert`|$\lVert~\rVert$ `\lVert`
$~~~~~$`\rVert` |`\left.`| `\right.` |$\backslash$ `\backslash` -|$\lang~\rang$ `\lang`
$~~~~$`\rang`|$\lt~\gt$ `\lt \gt`|$⟦~⟧$ `⟦ ⟧`|$\llbracket~\rrbracket$ `\llbracket`
$~~~~$`\rrbracket`| +|$\lang~\rang$ `\lang`
$~~~~$`\rang`|$\lt~\gt$ `\lt \gt`|$⟦~⟧$ `⟦ ⟧`|$\llbracket~\rrbracket$ `\llbracket`
$~~~~$`\rrbracket`|$\lBrace~\rBrace$ `\lBrace \rBrace` **Delimiter Sizing** diff --git a/src/macros.js b/src/macros.js index 8fa26955..5738958a 100644 --- a/src/macros.js +++ b/src/macros.js @@ -849,6 +849,16 @@ defineMacro("\\rrbracket", "\\html@mathml{" + defineMacro("\u27e6", "\\llbracket"); // blackboard bold [ defineMacro("\u27e7", "\\rrbracket"); // blackboard bold ] +defineMacro("\\lBrace", "\\html@mathml{" + + "\\mathopen{\\{\\mkern-3.2mu[}}" + + "{\\mathopen{\\char`\u2983}}"); +defineMacro("\\rBrace", "\\html@mathml{" + + "\\mathclose{]\\mkern-3.2mu\\}}}" + + "{\\mathclose{\\char`\u2984}}"); + +defineMacro("\u2983", "\\lBrace"); // blackboard bold { +defineMacro("\u2984", "\\rBrace"); // blackboard bold } + // TODO: Create variable sized versions of the last two items. I believe that // will require new font glyphs. diff --git a/test/katex-spec.js b/test/katex-spec.js index 49ab0591..43f91fec 100644 --- a/test/katex-spec.js +++ b/test/katex-spec.js @@ -3362,6 +3362,7 @@ describe("Unicode", function() { expect`┌x┐ └x┘`.toBuild(); expect("\u231Cx\u231D \u231Ex\u231F").toBuild(); expect("\u27E6x\u27E7").toBuild(); + expect("\\lBrace \\rBrace").toBuild(); }); it("should build some surrogate pairs", function() {