question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

select sub-region of mathField that matches latex string?

See original GitHub issue

what is the most straightforward way to search for a latex string (e.g. \frac{2}{4} ) in an active MathField and if found, select the occurrence of subexpression in the mathField. I can think of a way of creating a DOM-detached mathField just with $$\frac{2}{4}$$ and then doing a deep comparison of the resulting spans with the existing active mathField, but that sounds painful. Also, not clear how i would select a specific portion programmatically after the span section is found. search probably needs to be done on MathAtom internal representation, but those traversal functions are not in documentation.

Any help would be greatly appreciated. i’m working on a speech driven selection and this is a key missing component.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
arnogcommented, Nov 18, 2020

Yes, the current template type (string | RegExp) will be expanded to include a MathJson expression. Same thing for the replacement pattern, you will be able to return either a Latex string or a MathJson expression.

1reaction
zoranpopoviccommented, Nov 17, 2020

@arnog that’s awesome. Things will be so much cleaner with this. thanks for adding it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Selecting a string beginning with $ and ending with $ - TeX
This script assumes (i) your cursor is lying inside the math environment $..$ already, and that (ii) the whole $...$ content lies within...
Read more >
MathLive - CortexJS
Set the content of the mathfield to the text interpreted as a LaTeX expression. ... Return a nested mathfield element that match the...
Read more >
How to render substrings of a LaTeX string, in different colors ...
I need to change the color of substrings within a LaTeX string for a plot title. I have tried several different approaches, most...
Read more >
Text rendering with LaTeX — Matplotlib 3.6.2 documentation
Text rendering with LaTeX#. Matplotlib can use LaTeX to render text. This is activated by setting text.usetex : True in your rcParams, or...
Read more >
The stringstrings Package - CTAN
Abstract. The stringstrings package provides a large and sundry array of routines for the manipulation of strings. The routines are developed not only...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found