Skip to content

feature request for vector from O to A #621

Description

@hjy1210

In some area, people use $\overset{\rightharpoonup}{OA}$ to denote a vector from point O to point A.
In all area, people use $\overline{OA}$ to denote a line segment from point O to point A.

In Intent/geometry.yaml, there is already a rule geometry-line-segment(mover) for line segment:

-
  name: geometry-line-segment
  tag: mover
  match:
    - "*[2][self::m:mo][.='¯'] and"
    - "*[1][self::m:mrow][count(*)=3 and "
    - "     *[1][self::m:mi and string-length(text()) and translate(., 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', '') = ''] and"
    - "     *[2][self::m:mo and (.='\u2062' or .='\u2063')] and"
    - "     *[3][self::m:mi and string-length(text()) and translate(., 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', '') = '']"
    - "                  ]"
  replace:
  - intent:
      name: "line-segment"
      attrs: "data-intent-property='concat(data-intent-property, \":prefix:\")'"
      children:
      - x: "*[1]/*[1]"
      - x: "*[1]/*[3]"

hope MathCAT can add new rule geometry-harpoonvector(mover) for vector in Intent/geometry.yaml:

-
  name: geometry-harpoonvector
  tag: mover
  match:
    - "*[2][self::m:mo][.='⇀'] and"  # u21c0
    - "*[1][self::m:mrow][count(*)=3 and "
    - "     *[1][self::m:mi and translate(., 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', '') = ''] and"
    - "     *[2][self::m:mo and (.='\u2062' or .='\u2063')] and"
    - "     *[3][self::m:mi and translate(., 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', '') = '']"
    - "                  ]"
  replace:
  - intent:
      name: "harpoonvector"
      attrs: "data-intent-property='concat(data-intent-property, \":prefix:\")'"
      children:
      - x: "*[1]/*[1]"
      - x: "*[1]/*[3]"

Here we use harpoonvector instead of vector, because MathCAT already have a rule vector(mover) with intent name vector in Intent/general.yaml.

So people can add rule in local zh/tw/SharedRules/geometry.yaml as

- name: geometry-harpoonvector
  tag: harpoonvector
  match: "count(*)=2"
  replace:
  - test:
      if: "$Verbosity='Verbose'"
      then:
      - T: "向量"             # phrase('vector' from A to B)
      - x: "*[1]"
      - T: "到"                       # phrase(the vector from A 'to' B)
      - x: "*[2]"
      else:
      - T: "向量"                      # phrase(the 'vector'A  B)
      - x: "*[1]"
      - x: "*[2]"

Then people can use $\overset{\rightharpoonup}{OA}$ to display a vector from point O to point A.

Because, translator should not add rules in Intent/geometry.yaml, so raise this feature request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions