From 7e6e9eee29d7b7041ecba3504a6b48c50f66dbf4 Mon Sep 17 00:00:00 2001 From: Erik Demaine Date: Sun, 28 Aug 2022 13:18:49 -0400 Subject: [PATCH] docs: Fix \set documentation (#3646) Work around `|` in tables See https://github.com/facebook/docusaurus/issues/2004 --- docs/support_table.md | 10 ++++++---- docs/supported.md | 8 +++++--- website/lib/remarkable-katex.js | 6 ++++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/docs/support_table.md b/docs/support_table.md index 757207c66f..ea2e4f5eba 100644 --- a/docs/support_table.md +++ b/docs/support_table.md @@ -16,6 +16,8 @@ table td { ## Symbols +$\gdef\VERT{|}$ + |Symbol/Function | Rendered | Source or Comment| |:---------------|:------------|:-----------------| |\!|$n!$|`n!`| @@ -192,8 +194,8 @@ table td { |\boxtimes|$\boxtimes$|| |\Bra|$\Bra{\psi}$|`\Bra{\psi}`| |\bra|$\bra{\psi}$|`\bra{\psi}`| -|\braket|$\braket{\phi\vert\psi}$|`\braket{\phi\vert\psi}`| -|\Braket|$\Braket{ ϕ \| \frac{∂^2}{∂ t^2} \| ψ }$| `\Braket{ ϕ \| \frac{∂^2}{∂ t^2} \| ψ }`| +|\braket|$\braket{\phi\VERT\psi}$|\braket{\phi|\psi}| +|\Braket|$\Braket{ ϕ \VERT \frac{∂^2}{∂ t^2} \VERT ψ }$| \Braket{ ϕ | \frac{∂^2}{∂ t^2} | ψ }| |\brace|${n\brace k}$|`{n\brace k}`| |\bracevert|Not supported|| |\brack|${n\brack k}$|`{n\brack k}`| @@ -954,8 +956,8 @@ use `\ce` instead| |\searrow|$\searrow$|| |\sec|$\sec$|| |\sect|$\text{\sect}$|`\text{\sect}`| -|\set|$\set{x\|x<5}$|`\set{x\|x<5}` | -|\Set|$\Set{ x \| x<\frac 1 2 }$ | `\Set{ x \| x<\frac 1 2 }` | +|\set|$\set{x\VERT x<5}$|\set{x|x<5} | +|\Set|$\Set{ x \VERT x<\frac 1 2 }$ | \Set{ x | x<\frac 1 2} | |\setlength|Not supported|[Issue #687](https://github.com/KaTeX/KaTeX/issues/687)| |\setminus|$\setminus$|| |\sf|$\sf AaBb123$|`\sf AaBb123`| diff --git a/docs/supported.md b/docs/supported.md index f726dbe23e..a65a3da4f3 100644 --- a/docs/supported.md +++ b/docs/supported.md @@ -312,6 +312,8 @@ KaTeX also supports `\llap`, `\rlap`, and `\clap`, but they will take only text, ## Logic and Set Theory +$\gdef\VERT{|}$ + ||||| |:--------------------|:--------------------------|:----------------------------|:----- |$\forall$ `\forall` |$\complement$ `\complement`|$\therefore$ `\therefore` |$\emptyset$ `\emptyset` @@ -321,7 +323,7 @@ KaTeX also supports `\llap`, `\rlap`, and `\clap`, but they will take only text, |$\in$ `\in` |$\land$ `\land` |$\gets$ `\gets` |$\impliedby$ `\impliedby` |$\isin$ `\isin` |$\lor$ `\lor` |$\leftrightarrow$ `\leftrightarrow`|$\iff$ `\iff` |$\notin$ `\notin` |$\ni$ `\ni` |$\notni$ `\notni` |$\neg$ `\neg` or `\lnot` -| | $\Set{ x \| x<\frac 1 2 }$
`\Set{ x \| x<\frac 1 2 }` | $\set{x\|x<5}$
`\set{x\|x<5}` +| | $\Set{ x \VERT x<\frac 1 2 }$
\Set{ x | x<\frac 1 2 } | $\set{x\VERT x<5}$
\set{x|x<5} || Direct Input: $∀ ∴ ∁ ∵ ∃ ∣ ∈ ∉ ∋ ⊂ ⊃ ∧ ∨ ↦ → ← ↔ ¬$ ℂ ℍ ℕ ℙ ℚ ℝ @@ -563,8 +565,8 @@ Extensible arrows all can take an optional argument in the same manner
as `\x |||| |:----------|:----------|:----------| -|$\bra{\phi}$ `\bra{\phi}` |$\ket{\psi}$ `\ket{\psi}` |$\braket{\phi\vert\psi}$ `\braket{\phi\vert\psi}` | -|$\Bra{\phi}$ `\Bra{\phi}` |$\Ket{\psi}$ `\Ket{\psi}` |$\Braket{ ϕ \| \frac{∂^2}{∂ t^2} \| ψ }$ `\Braket{ ϕ \| \frac{∂^2}{∂ t^2} \| ψ }`| +|$\bra{\phi}$ `\bra{\phi}` |$\ket{\psi}$ `\ket{\psi}` |$\braket{\phi\VERT\psi}$ \braket{\phi|\psi} | +|$\Bra{\phi}$ `\Bra{\phi}` |$\Ket{\psi}$ `\Ket{\psi}` |$\Braket{ ϕ \VERT \frac{∂^2}{∂ t^2} \VERT ψ }$ \Braket{ ϕ | \frac{∂^2}{∂ t^2} | ψ }| ## Style, Color, Size, and Font diff --git a/website/lib/remarkable-katex.js b/website/lib/remarkable-katex.js index 71299b4bf5..aa6b96853e 100644 --- a/website/lib/remarkable-katex.js +++ b/website/lib/remarkable-katex.js @@ -1,6 +1,6 @@ // https://github.com/bradhowes/remarkable-katex/blob/master/index.js // Modified here to require("../..") instead of require("katex") -// and add options {trust: true, strict: false}. +// and add options {trust: true, strict: false, macros}. /* MIT License @@ -25,6 +25,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +const macros = {}; // allow sharing macros within a page + /** * Plugin for Remarkable Markdown processor which transforms $..$ and $$..$$ sequences into math HTML using the * Katex package. @@ -41,7 +43,7 @@ module.exports = (md, options) => { */ const renderKatex = (source, displayMode) => katex.renderToString(source, {displayMode: displayMode, throwOnError: false, - trust: true, strict: false}); + trust: true, strict: false, macros}); /** * Parse '$$' as a block. Based off of similar method in remarkable.