We will be migrating from Ask to Discourse on the first week of August, read the details here

Ask Your Question

easy way to change fonts of all mathematical formulas (OLE) [closed]

asked 2016-10-24 09:42:31 +0200

Kostas Koudas gravatar image

updated 2020-10-05 15:55:58 +0200

Alex Kemp gravatar image


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.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2020-10-05 15:54:37.378139

1 Answer

Sort by » oldest newest most voted

answered 2016-10-24 12:31:34 +0200

Regina gravatar image

updated 2017-05-31 20:11:58 +0200


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".

edit flag offensive delete link more


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?


Kostas Koudas gravatar imageKostas Koudas ( 2016-10-27 10:04:11 +0200 )edit

"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.

Regina gravatar imageRegina ( 2016-10-27 11:54:59 +0200 )edit


You have helped me a lot!!!

Thanks a lot!!!!!

Kostas Koudas gravatar imageKostas Koudas ( 2016-10-27 12:09:51 +0200 )edit

Hi, 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 Thanks

kianisergio gravatar imagekianisergio ( 2017-05-28 14:45:03 +0200 )edit

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.

Regina gravatar imageRegina ( 2017-05-28 22:15:37 +0200 )edit

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....

kianisergio gravatar imagekianisergio ( 2017-05-30 13:56:34 +0200 )edit

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!!

avouz gravatar imageavouz ( 2019-12-27 09:12:25 +0200 )edit

Question Tools

1 follower


Asked: 2016-10-24 09:42:31 +0200

Seen: 1,615 times

Last updated: May 31 '17