[Issue] Set base size for all formula/math objects at once

Discuss the formula editor
Post Reply
jdpipe
Posts: 52
Joined: Wed Jun 04, 2008 8:02 am

[Issue] Set base size for all formula/math objects at once

Post by jdpipe »

Hi all

I have imported a Word document that contains many formulas, in OOo 2.4.1 on Ubuntu Hardy. For some reason, the base size on these equations is set to 32 pt in all cases, then the imported formula contains slightly strange context such as

size 12{ { dot {Q}} rSub { size 8{ ital "cv"} } = { dot {m}} \( h rSub { size 8{e} } - h rSub { size 8{i} } \) + { dot {W}} rSub { size 8{ ital "cv"} } } {}

When attempting to edit this, if I remove the 'size 12' from the start, the base size shows through, and the whole equation becomes much larger than I want.

How can I change the base size of all of the equations in my document?

Cheers
JP
Last edited by Hagar Delest on Fri Jul 25, 2008 5:15 pm, edited 1 time in total.
Reason: Tagged the thread as issue (link to a bug report).
OOo 3.1.1 on Mac OS X 10.5, OOo 3.0.1 on Ubuntu 9.04
User avatar
RGB
Posts: 1456
Joined: Mon Oct 08, 2007 1:34 am

Re: How to set 'base size' on many formula/math objects at once?

Post by RGB »

jdpipe wrote:How can I change the base size of all of the equations in my document?
By modifying them one by one. Math is the less developed component of OOo and its main flaw is the lack of styles. To change the base size you need to modify it on every equation one by one going to Format -> Font Size.
There are two types of people: those who believe that there are two types of people and those who do not.

openSUSE Leap with KDE Plasma / LibreOffice
jdpipe
Posts: 52
Joined: Wed Jun 04, 2008 8:02 am

Re: How to set 'base size' on many formula/math objects at once?

Post by jdpipe »

Is there any possibility that this could be automated using a macro, perhaps?
OOo 3.1.1 on Mac OS X 10.5, OOo 3.0.1 on Ubuntu 9.04
jdpipe
Posts: 52
Joined: Wed Jun 04, 2008 8:02 am

Re: How to set 'base size' on many formula/math objects at once?

Post by jdpipe »

FWIW this problem is arising becuase I am editing a word document that contains many formula that were probably initialy typed into powerpoint, hence the default size is 32pt on all formulae, but really I would like the default size to be 12pt as it is for the text in my document. I can imagine that many people working on lecture notes etc would see this sort of problem.
OOo 3.1.1 on Mac OS X 10.5, OOo 3.0.1 on Ubuntu 9.04
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: How to set 'base size' on many formula/math objects at once?

Post by acknak »

It looks like it could be done easily by editing the XML text, if you have access to tools like sed or Perl.

If you want to try it, I can give you some specifics. Or, if you want to email me the file, it would take less time for me to do it than to explain it ;-) See my profile/interests for email.
AOO4/LO5 • Linux • Fedora 23
User avatar
jumbo444
Posts: 7
Joined: Wed Dec 05, 2007 8:37 pm
Location: Rouen - FRANCE

Re: How to set 'base size' on many formula/math objects at once?

Post by jumbo444 »

Hello,
RGB wrote:By modifying them one by one. ... To change the base size you need to modify it on every equation one by one going to Format -> Font Size.
Hopefully no, you just need a macro, as proposed on french FAQ. I could not find it on English FAQ?
LibO 3.6.7.1 on Win7
User avatar
Hagar Delest
Moderator
Posts: 32628
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: [Issue] Set base size for all formula/math objects at on

Post by Hagar Delest »

For those afraid of French:
You can subscribe and vote for that report (up to 2 votes per issue): Issue 5092 - formula styles.

Macro to change all the formulas at once:

Code: Select all

Sub Main
	embeddedObjects = ThisComponent.getEmbeddedObjects()
	elementNames = embeddedObjects.getElementNames()
	for i=0 to UBOUND(elementNames)
		element = embeddedObjects.getByName(elementNames(i)).Model
		if (element.supportsService("com.sun.star.formula.FormulaProperties")) then
			element.BaseFontHeight = 14
			element.FontNameVariables= "Arial"
			element.FontNameFunctions = "Arial"		
			element.FontNameNumbers= "Arial"		
			element.FontNameText= "Arial"		
		endif
	next i
	ThisComponent.reformat()	
End Sub
Change the element.BaseFontHeight = 14 value to suit your need.
NB: I just tried it and the results are not so good. Formula frames are not resized and not all the formulas are updated!
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
User avatar
Agilar
Posts: 85
Joined: Mon Oct 04, 2010 6:51 pm

Re: [Issue] Set base size for all formula/math objects at on

Post by Agilar »

There's a dmath extension - and it can fix the size of all the formulas in the selection (but selection could not have tables). To do it this way - You should install dmath, a lot of toolbars will pop up, of which You'll need a button with two-side arrow, like the green one in right of the screenshot:
allFormulas.png
LibreOffice 4.1.2.3 on Kubuntu 14.04
Post Reply