Jonathan-LeRoux / IguanaTex

A PowerPoint add-in allowing you to insert LaTeX equations into PowerPoint presentations on Windows and Mac
http://www.jonathanleroux.org/software/iguanatex/
Other
790 stars 57 forks source link

Wrong output size when generating a SVG (on Mac) #39

Open Atcold opened 1 year ago

Atcold commented 1 year ago

IguanaTeX output (top) is 87% × 97% while LaTeXiT's (bottom) is 100% × 100%.

Screenshot 2022-10-13 at 15 36 53
Atcold commented 1 year ago

I scaled it up to 100% × 100% manually. The two outputs are now identical if not for the extended bounding box for IguanaTeX (perhaps that's what causes the wrong output size).

image
Atcold commented 1 year ago

Something's really wrong…

image
Atcold commented 1 year ago

I think this is due to the fact that the equation is converted to SVG. Is there a way to leave it in PDF instead? This is what LaTeXiT does.

Jonathan-LeRoux commented 1 year ago

Hi! Are you using version 1.60.1 or newer? There should no longer be a big margin around the equation when generating a "Bitmap" (which on Mac is actually a PDF...). This unfortunately results in the equation appearing cropped on Windows machines (bounding box stays the same but the content inside expands; most likely a PPT bug), but I haven't found a fix yet, short of moving to PNGs for Mac as well. Windows users can always regenerate the display as a PNG, it will get back to the same appearance as on Mac.

For you last example with colors, was that a "vector graphics" display? Those are indeed SVGs. The scale does look very strange... The "Bitmap" displays are PDFs, although under the hood PPT is storing them as EMFs (even on Mac!). IguanaTex shouldn't be converting them to SVG.

Atcold commented 1 year ago

Aaaaaaah! PDF is not bitmap! LOL. 😅

Everything's perfect now. I'd heartwarmingly suggest changing the word "Bitmap" to "PDF".

Jonathan-LeRoux commented 1 year ago

I agree, "Bitmap" is not a good term, it is used because that's what it is under Windows (PNG). The PDF ("Bitmap") displays on Mac also cannot have their paths edited or individual components tweaked independently, as the "Vector" displays can, so they are closer to the PNGs on Windows in that regard.

I'll have to think about how to handle this. Easiest in terms of implementation would be to find a term that describes both PNG and PDF cases, but I can't see one. Another option would be to adapt the terminology on Windows vs Mac, but I don't know if the ribbon text can be made adaptive on Mac vs Windows, as it is handled outside of VBA in an XML file; that may require having two separate versions of the add-in. Yet another option would be to implement PNG on Mac for "Bitmap" displays, and provide PDF as a "Vector" option, with the caveat that it has the crispness of vector graphics format but cannot be edited.

Atcold commented 1 year ago

Vector graphics are digital art that is rendered by a computer using a mathematical formula. Raster images are made up of tiny pixels, making them resolution dependent and best used for creating photos.

See reference.

Vector graphics does not have anything to do with editability.

I'd suggest having the user choosing between "SVG", "PDF", and "PNG".

A PDF is a container. It can contain both a raster and / or a vector image. PowerPoint cannot edit PDFs. This does not mean PDFs are not editable in their individual components. Inkscape, Adobe Illustrator, and Adobe Acrobat have no issues with editing PDF paths.

Atcold commented 1 year ago

Reopening this because the bug persists, although it no longer affects me (as in I'm perfectly fine with generating PDFs instead of SVGs). Let me know if I can help debug this.

So, the reported size is most of the time 100% × 100%. If you click and unclick several times, you finally get the real wrong aspect ratio.

A workaround is generating a PDF first and then converting it to SVG (although it says sometimes it's 112% × 100%).

Screenshot 2022-10-17 at 12 51 28 Screenshot 2022-10-17 at 12 51 44 Screenshot 2022-10-17 at 12 51 06

About the version, I'm not sure. I don't see it written anywhere. I've just installed everything via brew.