Convert an Equation Editor Object back to plain text

  • Thread starter Muskyboi
  • Start date
  • #1
10
0
Is there a tool that can convert something like this:
1595065591933.png


which when copied as plain text looks like this: \frac{4}{\pi}\sin\left(x\right)+\frac{4}{3\pi}\sin\left(3x\right)+\frac{4}{5\pi}\sin\left(5x\right)+\frac{4}{7\pi}\sin\left(7x\right)+\frac{4}{9\pi}\sin\left(9x\right)

To this: 4/pi*sin(x)+4/(3pi)*sin(3x)+4/(5pi)*sin(5x)+4/(7pi)*sin(7x)+4/(9pi)*sin(9x)
 

Answers and Replies

  • #3
berkeman
Mentor
57,957
8,035
Is there a tool that can convert something like this:
View attachment 266516

which when copied as plain text looks like this: \frac{4}{\pi}\sin\left(x\right)+\frac{4}{3\pi}\sin\left(3x\right)+\frac{4}{5\pi}\sin\left(5x\right)+\frac{4}{7\pi}\sin\left(7x\right)+\frac{4}{9\pi}\sin\left(9x\right)

To this: 4/pi*sin(x)+4/(3pi)*sin(3x)+4/(5pi)*sin(5x)+4/(7pi)*sin(7x)+4/(9pi)*sin(9x)
1595103593915.png


What format is the source? Is it just a JPEG or BMP picture, or a PDF snapshot? Or something copy/pasted from MSWord? The source format will make a big difference in how difficult the conversion will be, IMO.
it would be an interesting parsing project in a Comp Sci course on Compilers.
Absolutely. It would be a fun project, if the input format was something reasonable (instead of having to do full character recognition from a BMP file as a first step). :smile:
 
  • #4
12,022
5,672
I thought the source was just the latex string to convert to a plain text target

A related fun project would be conversion to character graphics:

Code:
              //\\ pi/2
            //
           // sin(x) dx
          //
       \\// 0
come in useful source code

This would come in useful in source code comments or markdown where the viewer uses character graphics.
 
  • #5
berkeman
Mentor
57,957
8,035
Oh, oops, I think you're right. I misread the OP to be "convert from this math equation to LaTeX". Sorry, nothing to see here, everybody move along... o0)
 
  • #6
berkeman
Mentor
57,957
8,035
I thought the source was just the latex string to convert to plain text
And yeah, that's a MUCH easier problem to assign in a compiler class. :wink:
 
  • #7
FactChecker
Science Advisor
Gold Member
5,745
2,133
What about exporting it as a PDF or PNG file and using OCR software? I tried with FreeOCR on the PNG in the OP, but it did not do very well. Maybe better OCR software would do a better job.

FreeOCR converted it to
%si.1.1[x)+% sin(3x)+% sin(5x)+% sin(Tx) + sin[9.\'

Not a good result. But I have seen OCR software do some impressive things.
PS. I just tried a couple of online TEX to TXT converters and they did not work well.
 
Last edited:
  • #8
robphy
Science Advisor
Homework Helper
Insights Author
Gold Member
5,672
941
Input: \frac{4}{\pi}\sin\left(x\right)+\frac{4}{3\pi}\sin\left(3x\right)+\frac{4}{5\pi}\sin\left(5x\right)+\frac{4}{7\pi}\sin\left(7x\right)+\frac{4}{9\pi}\sin\left(9x\right)


https://www.wolframalpha.com/input/?i=+\frac{4}{\pi}\sin\left(x\right)+\frac{4}{3\pi}\sin\left(3x\right)+\frac{4}{5\pi}\sin\left(5x\right)+\frac{4}{7\pi}\sin\left(7x\right)+\frac{4}{9\pi}\sin\left(9x\right)

1595221901334.png

produces

4/π sin(x) + 4/(3 π) sin(3 x) + 4/(5 π) sin(5 x) + 4/(7 π) sin(7 x) + 4/(9 π) sin(9 x)



also interesting:

https://mathpix.com/
http://www.i2ocr.com/free-online-math-equation-ocr
http://www.inftyproject.org/en/index.html
 
Last edited:
  • Like
Likes Muskyboi and FactChecker
  • #9
10
0
Input: \frac{4}{\pi}\sin\left(x\right)+\frac{4}{3\pi}\sin\left(3x\right)+\frac{4}{5\pi}\sin\left(5x\right)+\frac{4}{7\pi}\sin\left(7x\right)+\frac{4}{9\pi}\sin\left(9x\right)


https://www.wolframalpha.com/input/?i=+\frac{4}{\pi}\sin\left(x\right)+\frac{4}{3\pi}\sin\left(3x\right)+\frac{4}{5\pi}\sin\left(5x\right)+\frac{4}{7\pi}\sin\left(7x\right)+\frac{4}{9\pi}\sin\left(9x\right)

View attachment 266604
produces

4/π sin(x) + 4/(3 π) sin(3 x) + 4/(5 π) sin(5 x) + 4/(7 π) sin(7 x) + 4/(9 π) sin(9 x)



also interesting:

https://mathpix.com/
http://www.i2ocr.com/free-online-math-equation-ocr
http://www.inftyproject.org/en/index.html
This is exactly what I was looking for. Thank you.
 
  • #10
BvU
Science Advisor
Homework Helper
2019 Award
13,533
3,254
produces

4/π sin(x) + 4/(3 π) sin(3 x) + 4/(5 π) sin(5 x) + 4/(7 π) sin(7 x) + 4/(9 π) sin(9 x)
For the record: When you hover the mouse over the picture of the equation, extra buttons appear and the one on the right brings up the plain text

1595505922395.png
 
  • #11
FactChecker
Science Advisor
Gold Member
5,745
2,133
The only potential problem with Wolfram's plain text is that it uses the extended character set, so ##\pi## instead of Pi. That is acceptable in many places that you might paste it, but not everywhere.
 
  • #12
BvU
Science Advisor
Homework Helper
2019 Award
13,533
3,254
Turns out Excel (?:)) accepts ##\pi## as a name, but of course it wants all the asterisks :frown:

π 3.141592654 (formulas|create from selection)

=4/π* sin(x) + 4/(3 *π) *sin(3* x) + 4/(5 *π) *sin(5* x)+ 4/(7 *π)* sin(7 *x) + 4/(9* π) *sin(9* x)

does the work an comes up with a value
 
  • Like
Likes sysprog and FactChecker

Related Threads on Convert an Equation Editor Object back to plain text

Replies
3
Views
3K
  • Last Post
Replies
1
Views
5K
Replies
2
Views
824
Replies
7
Views
3K
Replies
5
Views
2K
  • Last Post
Replies
4
Views
28K
  • Last Post
Replies
1
Views
1K
Replies
3
Views
3K
Top