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

Discuss the formula editor

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

Postby jdpipe » Mon Jul 14, 2008 4:35 am

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 de l'Est 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
jdpipe
 
Posts: 50
Joined: Wed Jun 04, 2008 8:02 am

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

Postby RGB » Mon Jul 14, 2008 9:37 am

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: the ones that believe that there are two types of people and the ones that not.

openSUSE 11.2 with kde 4.3.1 / OOo 3.1.1
User avatar
RGB
Volunteer
 
Posts: 470
Joined: Mon Oct 08, 2007 1:34 am

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

Postby jdpipe » Tue Jul 15, 2008 8:13 am

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: 50
Joined: Wed Jun 04, 2008 8:02 am

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

Postby jdpipe » Tue Jul 15, 2008 8:15 am

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
jdpipe
 
Posts: 50
Joined: Wed Jun 04, 2008 8:02 am

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

Postby acknak » Tue Jul 15, 2008 5:11 pm

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.
OOo 3 • Linux • Fedora 11
User avatar
acknak
Moderator
 
Posts: 8403
Joined: Mon Oct 08, 2007 1:25 am
Location: 39.916,-75.08

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

Postby jumbo444 » Thu Jul 24, 2008 6:10 pm

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?
OOo 3.0.X on Ms Windows XP
User avatar
jumbo444
 
Posts: 6
Joined: Wed Dec 05, 2007 8:37 pm
Location: Rouen - FRANCE

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

Postby Hagar de l'Est » Fri Jul 25, 2008 5:24 pm

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   Expand viewCollapse view
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!
OOo 3.1.1 (Sun) / xubuntu Karmic Koala 9.10 & W2000
User avatar
Hagar de l'Est
Moderator
 
Posts: 11862
Joined: Sun Oct 07, 2007 9:07 pm
Location: France


Return to Math

Who is online

Users browsing this forum: No registered users and 2 guests