Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion Rules/Intent/general.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@
-
name: limit
tag: [msub, munder]
variables: [NoSpacesBase: "translate(*[1], ' \u00A0\u2004\u2005\u2006\u2007\u2008\u2009\u200A','')"] # Sometimes these have (weird) spaces in them
variables: [NoSpacesBase: "translate(*[1], ' \u00A0\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2061','')"] # Sometimes these have spaces or an invisible function-application character in them
match: "*[1][$NoSpacesBase='lim' or $NoSpacesBase='limsup' or $NoSpacesBase='liminf']"
replace:
- intent:
Expand Down Expand Up @@ -809,6 +809,22 @@
variables: [TableProperty: "'determinant'"]
replace: [x: "*[2]"]

-
# TeX's gathered environment is one derivation split across display lines,
# not a system whose rows are independent equations.
name: mtable-gathered-property
tag: mtable
match: "contains(concat(' ', normalize-space(@class), ' '), ' gathered ')"
replace:
- with:
variables:
- TableProperty: "'lines'"
replace:
- intent:
name: "lines"
children:
- x: "*"

-
name: mtable-equations-property
tag: mtable
Expand Down
43 changes: 43 additions & 0 deletions Rules/Intent/linear-algebra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,49 @@
- x: "*[1]/*[2]" # grab the contents of the bracketed expr
- x: "*[2]"

-
# TeX4ht commonly attaches the norm's subscript to the closing bar only:
# <mrow><mo>∥</mo>...<msub><mo>∥</mo><mi>p</mi></msub></mrow>.
name: norm-with-subscripted-closing-bar
tag: mrow
match:
- "count(*) >= 3 and *[1][.='∥'] and *[last()][self::m:msub and *[1][.='∥']]"
replace:
- intent:
name: "subscripted-norm"
attrs: "data-intent-property='concat(data-intent-property, \":function:\")'"
children:
- x: "*[position() > 1 and position() < last()]"
- x: "*[last()]/*[2]"

-
# The same TeX4ht shape can use two ordinary vertical bars for each double bar.
name: norm-with-doubled-bars-and-subscripted-closing-bar
tag: mrow
match:
- "count(*) >= 5 and *[1][.='|'] and *[2][.='|'] and *[last()-1][.='|'] and *[last()][self::m:msub and *[1][.='|']]"
replace:
- intent:
name: "subscripted-norm"
attrs: "data-intent-property='concat(data-intent-property, \":function:\")'"
children:
- x: "*[position() > 2 and position() < last()-1]"
- x: "*[last()]/*[2]"

-
# Canonicalization groups ||x||_p as an indexed row containing a nested |x|.
name: norm-with-canonicalized-doubled-bars
tag: msub
match:
- "*[1][self::m:mrow and count(*)=3 and *[1][.='|'] and *[2][self::m:mrow and IsBracketed(., '|', '|')] and *[3][.='|']]"
replace:
- intent:
name: "subscripted-norm"
attrs: "data-intent-property='concat(data-intent-property, \":function:\")'"
children:
- x: "*[1]/*[2]/*[2]"
- x: "*[2]"

-
name: vector-magnitude
tag: mrow
Expand Down
Loading