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
850 stars 59 forks source link

Is it possible to port to a MS Word plugin? #70

Open MGG1996 opened 5 days ago

MGG1996 commented 5 days ago

Greetings Jonathan, thank you for your wonderful plugin, it works fine and helps me to typeset beautiful equations elegently.

The excellence of this plugin makes me strart wondering if the same thing could be achieved in MS Word, so is there any possibility of porting this plugin to MS Word, or do you have any plans to develp a new plugin for MS Word.

I hope this message wouldn't disturb you. Wishing you all the best.

Jonathan-LeRoux commented 5 days ago

I have thought about it, and I believe I even briefly looked at it several years ago but quickly ran into issues and gave up. It must be feasible to adapt quite a few features (while many other PowerPoint-specific ones will become irrelevant), but I just don't know Word and its VBA object model well enough to feel comfortable taking this upon me. I'd be happy to help someone willing to do it though.

MGG1996 commented 5 days ago

Thank you for your immediate response!

It turns out that migrating to MS Word is not an easy task. Thanks again for your patience.

For a Word plugin design noob, like me, what information do I need to know, what development tools do I should to use, and what programming languages do I need to master?

Jonathan-LeRoux commented 4 days ago

You don't need much, as the VBA editor is built into Office applications. Just use Alt+F11 to open it.

Then you need to code in VBA. It's not the best programming language, to be honest. I would start by looking at the IguanaTex code and trying to understand how things work (that's how I learned...). You could also use the Debugger to go through typical action calls and see what happens. Open the .pptm of IguanaTex, open the VBA editor, search for "Macros" under "Module" in the exploration pane, and put a breakpoint at Line 7 Load LatexForm under NewLatexEquation(). Then click on the button in the IguanaTex Ribbon to create a New Display, and it should take you to that line and stop there. You can now "Step over" (Shift+F8) or "Step Into" (F8) the various steps to see what's going on.

To modify the add-in for Word, my strategy would be to heavily use ChatGPT or MS Copilot, asking them how to convert the parts of IguanaTex that are PowerPoint-specific to Word-specific equivalents. I just tried to do that with the first few lines of NewLatexEquation(), which involve a Slide object, and honestly it seems to give pretty useful answers:

Adapting a PowerPoint VBA add-in to Word involves replacing PowerPoint-specific objects and methods with their Word equivalents. In PowerPoint, Slide objects and selections are commonly used, but in Word, you'll work with Document, Selection, and Range objects. Here's how you can adapt the given code snippet to work in Word: ...

MGG1996 commented 4 days ago

Thanks a lot for your kind assistance. Best wishes!