How to convert LaTeX equation into editable equation using Google Apps Script
Asked Answered
M

2

10

tldr: How can I convert a LaTeX equation in Google Docs so that it is editable as a Google Doc equation?

Background: I want to import html into Google Docs. This HTML includes (in my native database) LaTeX equations. When I import to Google Docs, the LaTeX is converted into non-editable images. I want to convert the LaTeX into editable Google equations. I'm thinking I can use Google Apps Scripts to accomplish this. My plan is to insert the equations as a text-string "tag" such as [latex: x + 5 = -3] - then I'll run a Google Apps Scripts function that converts that tag to a Google Docs equation.

I'm not sure if there's a well-known way to convert LaTeX into Google Apps Scripts equations? Should I just load a javascript library to accomplish this? Would I convert LaTeX to MathML and load that into the Google Apps Scripts equation object?

Marking answered 21/8, 2017 at 19:22 Comment(0)
E
2

This genuinely isn't possible - and I tried for ages! The official Docs say that equations are not supported as insertable types, IE they can only be edited in place.

Esperanto answered 15/10, 2018 at 14:59 Comment(1)
Just to add to this answer, we have figured out that if you put an equation into a Word Doc, and then import the Word Doc, the equation is editable in Google Docs! Which is nuts, but the only method we've found so far.Marking
B
0

Found a free add on called Auto-Latex Equations add-on for Google Docs. It replaces all the text between $$ signs with high-quality images of the equation.

Basically your tag becomes the delimiters, like $$55 + \sqrt{5}$$ and renders all or one of the equations. If you mess up, you can always undo one or all the equations.

Bocage answered 16/7, 2022 at 1:35 Comment(2)
I don't think this permits importing into GDocs? There are a few plugins that replace GDoc equations, but I don't think any allow you to natively edit GDoc equations. So if someone doesn't have the plugin, the markup doesn't work. This plugin doesn't fix that does it?Marking
You can just keep them all in native form like within $$ until one person with the add on hits render all --- so only a single collaborator needs it, and everyone can edit and see the results.Bocage

© 2022 - 2024 — McMap. All rights reserved.