OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Automatically switch between regular text and forumals

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Math
View previous topic :: View next topic  
Author Message
EnforcerSG
Newbie
Newbie


Joined: 21 Sep 2006
Posts: 3

PostPosted: Sun Sep 24, 2006 4:11 pm    Post subject: Automatically switch between regular text and forumals Reply with quote

Hello everyone. First post, a question that I didn't find an answer to in a quick search.

I have homework that involves solving some fun math problems and to make my life easier I am doing them using perl scripts (perl data language helps). I have tried to make it look pretty by formating the output of my scripts such that I can copy and paste it into Insert -> Object -> Formula and get equations. It really comes out very well.

But the output is not just equations; I have paragraphs, explanations of why I am doing what I am doing. I slap quotes around those and it works pretty well, but it is just a comment in OOMath. I have to guess at how long the line will be (no word wrap), it would be nice to spell check it (my IDE has a pathetic spell checker [when I find mistakes I do fix them]), and just a whole bunch of little touch up things for specific runs that is much easier to do with plane old Writer than with Math. I am looking for an easy way to fix that.

I am open to suggestions and willing to learn new things. Yeah, I can just copy and paste each section of output into the proper place, but the whole point of me using these scripts is to make the job easier and faster. I am not sure if there is an easy way to formate output to make the xml formats of open documents. It would be great if there was some sort of text or something I could put in at the start and end of an equation to tell it to switch, or some sort of super quotes, but I doubt whatever solution there is won't be that easy. Is there a way around this?
Back to top
View user's profile Send private message AIM Address
ms777
Super User
Super User


Joined: 07 Feb 2004
Posts: 1355

PostPosted: Tue Oct 03, 2006 3:23 am    Post subject: Reply with quote

Hi,

I am quite sure that there is no built in way to solve your problem. I do not remember having seen a related post here, either.

But if you are willing to to learn some API programming it should be not too difficult:
I would recommend to use the object name (what you can modify by right clicking on the formula, while not in editing mode). OO sets them to Object1, Object2, ... you can work with these names or put your own names there.

To modify the formula content programmatically see this snippet
Code:
Sub Main
oDoc = ThisComponent
oEmbObjs = oDoc.EmbeddedObjects
for k=0 to oEmbObjs.Count-1
  oEmbObj = oEmbObjs.getByIndex(k)
  if HasUnoInterfaces(oEmbObj, "com.sun.star.document.XEmbeddedObjectSupplier") then
    oFormObj = oEmbObj.EmbeddedObject
    if oFormObj.supportsService("com.sun.star.formula.FormulaProperties") then
      sFormulaName = oEmbObj.Name 'that is the name you can set by right clicking on the formula
      oFormObj.Formula = "a/b" & Chr(10) & "sum " & sFormulaName
      endif
    endif
  next k
End Sub

You will have to store the formula strings somewhere. This is up to your discretion Smile maybe you invent your own tags like <Formula1>...</Formula1> and put them into your text ...

Good luck,

ms777
Back to top
View user's profile Send private message
David
Super User
Super User


Joined: 24 Oct 2003
Posts: 5668
Location: Canada

PostPosted: Tue Oct 03, 2006 5:32 am    Post subject: Re: Automatically switch between regular text and forumals Reply with quote

EnforcerSG wrote:
I have to guess at how long the line will be (no word wrap), it would be nice to spell check it (my IDE has a pathetic spell checker [when I find mistakes I do fix them]), and just a whole bunch of little touch up things for specific runs that is much easier to do with plane old Writer than with Math.


I'm trying to understand the problem [my problem, not yours.] Why are you not in fact using Writer and then embedding the formulas by using Insert/Object/Formula, as is usual? Or am I having one of those "senior moments"?

David.
Back to top
View user's profile Send private message
EnforcerSG
Newbie
Newbie


Joined: 21 Sep 2006
Posts: 3

PostPosted: Tue Oct 03, 2006 3:24 pm    Post subject: Reply with quote

ms77

That looks interesting. I will play with that and see if I can make it work.

Looking over the documentation it looks like I have a lot to learn.

David

I could, but some of these math problems are VERY long and it would get very repetitive and very long very fast. I just think that there has got to be a way to automate it.
Back to top
View user's profile Send private message AIM Address
David
Super User
Super User


Joined: 24 Oct 2003
Posts: 5668
Location: Canada

PostPosted: Tue Oct 03, 2006 6:28 pm    Post subject: Reply with quote

EnforcerSG wrote:

David

I could, but some of these math problems are VERY long and it would get very repetitive and very long very fast. I just think that there has got to be a way to automate it.


Long doesn't mean complicated. It would help [me] to know what sort of math problems specifically, and what platform [Windows?] then I might be able to offer something further ...or not. I cheat and use things like MathType, Scientific Notebook, Mupad, and other odds and sods. Right now I'm muddling through doing a text using MathType and Writer. MathType cuts out some options after 30 days trial, but they let you keep the equivalent of what is bundled in WordPerfect and Word. You can't save what you do for example, but can copy/paste. Good enough for what I'm doing presently, and if I do need more, I'll consider purchasing the full version.

David.
Back to top
View user's profile Send private message
EnforcerSG
Newbie
Newbie


Joined: 21 Sep 2006
Posts: 3

PostPosted: Sat Dec 30, 2006 6:33 am    Post subject: Reply with quote

Back finally. Sorry I didn't get to reply sooner (it has been a crazy few months). I have found a couple of tutorials that I will go through and try to understand what ms777 wrote.

David. I am doing problems from a book called Fundamentals of Astrodynamics by Bates, Muler and White. I am working in Linux (Ubuntu) but I am trying to make it so it will work on any OS with the right things installed. They are converting between different orbital elements, solving for change of velocities for satellites, predicting where a satellite will be after a given time, intercept problems, etc... They can be both long and complicated.

I used to do these by hand, but then I thought 'anything is possible in software.' It is not a huge deal to get this working perfectly, at worst it just means a couple of extra minutes of cut and paste, but it would be nice.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Math All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group