I had a long-standing problem with word-to-latex and latex-to-word conversion. Finally, I soved this problem for my real life needs. I just asked the AI chatbots in Telegram. I asked them again and again until wrote two Word macros for word-to-latex and latex-to-word conversion. I want to share them with everyone who will find them useful.
Some remarks: For everyday needs I use MS Word 97, sometimes MS Word 2007. I write equations in MS Word EQ field codes. Something like {eq \f(1;2)} written in MS Word give me vertical fraction 1/2. Curved brackets actually is a field code brackets inserted by pressing Ctrl-F9. Professionally I still working at Windows XP (today is 26 June 2024), feel happy. Russian language settings of the system. On English language settings listing divisor is comma ",", while on Russian it is ";". So you see ";" in my example above. Unfortunately, Microsoft has discontinued support for the EQ field in Word2018 and later.
For journals or conferences, I need to convert for something understandable for everyone: MS Equation 3.0, MathType, or Latex. Sometimes I need to convert from these common formats to MS EQ format I use.
MathType understands Word2007 and later, Mathematica, Latex, and Equation 3.0 and can convert them to Latex. So today I can convert Latex to MS EQ and MS EQ to Latex. The source of my macros is here along with two test files Latex.doc and Word.doc): https://drive.google.com/drive/folders/1FU23oX7CI16VSFC_m-m8fHQb_gkywKCL
To install the macros in Word just press Alt-F11 in Word. VBA project is opened. Find in left tree under bold Normal the Module "NewMacros" (or create it) and paste provided code to the end of the code window in the center. Save Normal.dot by pressing Ctrl-S or button with floppy disk icon. You can close VBA window.
- For Word 97-2003: In Word, right-click on the toolbar and select Settings/Commands/Macros. In the list of macros on the right, select the Normal.NewMacros.ReplaceEqWithLatex macro and drag it to the toolbar, right-click on the new button and change the name to EQ2Latex. Repeat for the Normal.NewMacros.ReplaceLatexWithEq macro, giving the button name Latex2EQ.
- For Word 2007-2016: In Word, right-click on the Quick Access toolbar at the top and select "Customize Quick Access Toolbar...". Expand the list at the top left, select "Macros". In the list of macros at the bottom, select Normal.NewMacros.ReplaceEqWithLatex and click the "Add >>" button. At the bottom right, click the "Edit" button. Select the dollar icon "$" and name it EQ2Latex at the bottom. Click OK. Repeat for the Normal.NewMacros.ReplaceLatexWithEq macro, select the Greek pi icon "π" and name the button Latex2EQ.
- Enjoy. Feel free to share, reuse, and rewrite.
To work with the macros, you need to switch the fields to codes (Alt-F9 - switch back and forth). To see EQ field formulas on English language system settings you need to change listing divisor to ";".