Skip to main content
This topic has been closed for replies.

8 replies

Inspiring
August 2, 2024

Do you have user instructions? I can't get it to produce anything at all in InDesign.

Participant
March 11, 2024

Wonderful. Would be even more wonderful if user can select Inline or Block. One can select on the editor page. https://editor.codecogs.com/

Robert at ID-Tasker
Legend
March 5, 2024

@Gleb Osipov

 

Not sure about the Mac's side - don't know the environment - but if you are interested, the Window's part can be literally converted to just two lines of code. 

 

Peter Kahrel
Community Expert
Community Expert
March 5, 2024

Pickory raises a good point: you need the equation's baseline so that when it's placed as an inline equation, e.g. 'ln', 'x', and 'C' sit on the baseline of the line it's on. Without baseline information, the SVG sits too high, with its bottom on the line's baseline.

Gleb Osipov
Participating Frequently
March 5, 2024

but if SVG inside the text block with the baseline what properties I shoud give it to? Otherwise it's aligned by the bottom line

Robert at ID-Tasker
Legend
March 5, 2024

@Gleb Osipov 

 

This is in the EPS - when generated by MathMagic and others:

 

 

Highlited line is used by all kind of scripts to re-position linked image file vertically.

 

m1b
Community Expert
Community Expert
March 4, 2024

This looks great @Gleb Osipov, thanks for sharing!

 

Could you add a check for when the active document has never been saved?

 

- Mark

Gleb Osipov
Participating Frequently
March 5, 2024

Good remark, thanks, I will add

Peter Kahrel
Community Expert
Community Expert
March 4, 2024

I get a different error message: 'Failed to connect to latex.codecogs.com'.

Gleb Osipov
Participating Frequently
March 4, 2024

Try to open in browser latex.codecogs.com maybe it's blocked by provider, that why it's give you that message

Peter Kahrel
Community Expert
Community Expert
March 4, 2024

The site opens without any problem.

Kasyan Servetsky
Legend
March 4, 2024

Wow! Very cool! Thanks for sharing this, Gleb.
On my side -- on Windows --  this line throws an error:

var svgFileName = latexCode.replace("/[^\w\d]/g", '');

because it fails to make a valid file name from a formula.
I suggest changing it to, say, a prefix plus a randomly generated number, like so:

var randomNum = Math.random();
randomNum = String(randomNum);
randomNum = randomNum.replace(/^0\./g, "LtxEqtn_");
var svgFileName = randomNum;

I think it's hardly possible that the same number would be generated twice overwriting an existing formula.

Or, even better a unique date string: up to secs.

Legend
March 4, 2024

Store the LaTeX code with the image on the page.

When the image is selected, load the LaTeX code into the palette.

Store baseline / position offsets for the image.

 

Loads of cools stuff.

Legend
March 4, 2024

Very clever.

 

Who runs the web site?

 

P.