diff --git a/Rules/Intent/general.yaml b/Rules/Intent/general.yaml index 54303de7..e1652158 100644 --- a/Rules/Intent/general.yaml +++ b/Rules/Intent/general.yaml @@ -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: @@ -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 diff --git a/Rules/Intent/linear-algebra.yaml b/Rules/Intent/linear-algebra.yaml index f8c8fd7b..4b7afe81 100644 --- a/Rules/Intent/linear-algebra.yaml +++ b/Rules/Intent/linear-algebra.yaml @@ -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: + # ∥...∥p. + 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