Easy way to change fonts of all mathematical formulas (OLE)


I am teacher of mathematics and I use LibreOffice to prepare my students’ notes. Sometimes I realise that a font that I use is not useful, for example at Comic Sans MS you can’t distinguish “t” from “+”, so I have to change the font of all the formulas in the document.

The problem is that I have to change the font of each formula (ole-object) one-by-one. If I press “ctrl+A” and choose to change the document’s font, then the text will be changed, but the formulas will be like before.

Is it an easy way to do this?

Thanks a lot!!!

P.C.: I can’t use Latex, I have about 2000 files at LibreOffice, so it’s too late to change my work.


The attached file contains a collection of my macros for manipulating formulas. You can easily adapt them to your needs.

In most cases I do not use an input field, but take the needed information from the anchor (in Writer) or from a style (in Draw). If it is not clear, how to use the macros, please ask. They are not yet in a state, that I would publish them as extension, but they work fine for me.

You likely want to look at the macro “AdaptFormulaAllFontAndSizeToEnvironment” in module “WriterAdaptFormulaToAnchor”.

Thanks for your answer!!!

One more question… The macro you have sent me immediately changes all the formulas’ variables in italics. How can I change that? Can I change the macro by myself?


“Italic” is the correct typesetting for variables and that is the default in Math too. But if you don’t like it, look for the line “oModel.FontVariablesIsItalic = true” and replace it with "oModel.FontVariablesIsItalic = false ". So yes, you can edit the macros easily: Tools > Marcros > Edit Macros.


You have helped me a lot!!!

Thanks a lot!!!

Your macro does what i was looking for and is very useful. The thing is that i want to use the macro only for the selected object, so i don’t have to make the changes by hand.
I have seen on internet that i can create buttons and attach a macro to them. I thought that maybe i could create a button and use it when i select a formula.
Could you tell me what changes do i have to make to the macro to make it work? Have in mind that this is my first touch with macros

kianisergio: I have added a macro AdaptSingleFormulaToEnvironment to the module WriterAdaptFormulaToAnchor in the above linked file. And I have added a short text, how to get a button for the macro.

Thank you very much you are awesome…!!!The next thing i will try to do is to make it change the font not according to the text, but according to the font i want for each formula. I think i found out how, but maybe i will need your valuable help again…
Thanks again…

I had the same problem and I was so lucky to find this post and download and make use of your macros. They are just FANTASTIC. THANKS A LOT!!