[Libreoffice] Expending LO Math capabilities

Olivier Hallot olivier.hallot at documentfoundation.org
Wed Dec 7 09:08:57 PST 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi

Actually I think (after doing the patch) that such extensions should be
more easily handled by macros.

On a side note: Have you get to now dmath?
http://www.dmaths.org/documentation/doku.php?id=presentation:en

In any case, here is a fragment of a very simple macro that allow you to
append whatever you want into a formula:


+++++++++++++++

Sub MacroMath

GlobalScope.BasicLibraries.LoadLibrary("Tools")

Dim oDocument as object

oDocument = ThisComponent

'test if the document is a math document (OpenDocument Formula)
If getDocumentType(oDocument) <> "smath" then
   msgbox " The document is not a ODF formula"
   Stop
EndIf

oWhatIHave = oDocument.Formula

myExpression = "forall <?> in <?>, exists <?> in <?> divides f(<?>) +
g(<?>) leslant <?>, <?> in <?>"

oDocument.Formula = oWhatIHave & myExpression

' bla bla bla
End Sub

+++++++++++++++

Add a nice dialog to get some input parameters and a lot of clumsy math
expressions could be added very quickly.

Regards

Olivier	


Em 07-12-2011 14:11, Michael Meeks escreveu:
> Hi Nir,
> 
> On Mon, 2011-12-05 at 10:40 -0800, Nir Kristal wrote:
>> I've asked the same question in the users mailing list but didn't 
>> receive an answer, maybe you could help more. 
> 
> 	:-)
> 
>> I'm looking for a way to customize Math. I would like to make 
>> predefined symbols (somthing like %dVol => dxdydz or %eye{3} => 3x3 
>> identity matrix).
> 
> 	Sounds fun. I wonder if it is generally useful, then (probably) the
> easiest way would be to get this into the core - Olivier made a patch
> recently that did some of this work too, which you can see here:
> 
> http://cgit.freedesktop.org/libreoffice/core/commit/?id=cfc84011b3fb609ac78f35666d9aecda4ca34678
> 
> 	Hopefully that's a good template to follow to expand the functionality
> there. Luckily starmath is quite hack-able.
> 
>> are there any accessible files to edit to achieve this? Or some other
>> way maybe? If not, adding the option to create this kind of macros
>> would by great. 
> 
> 	I'd suggest building on Olivier's work and re-targetting it to what you
> want to achieve. Failing that - just reading the code in starmath - it's
> quite nice and self-contained would be worthwhile.
> 
> 	All the best,
> 
> 		Michael.
> 

- -- 
Olivier Hallot
Founder, Board of Directors Member - The Document Foundation
LibreOffice translation leader for Brazilian Portuguese
+55-21-8822-8812
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJO352pAAoJEJp3R7nH3vLxy38IAK/fEqpimioFxFHsw5WfiCXw
dWfNlePgOxutTtEbvrhXBJpL/2NYK7nSCPfg1OdQ1S7lRL1gpJdSX11S8XAS0aiq
xbCw8/xVzDDJrXWSFAfuRjyOLX8EKGenWD9DGsNP+exN96XFaq6echX5RIoUgumT
D16Cuc1V9N5+f5IzsXJ4mjw8h0+yIR9n5NKcXnIzNDpcQtyEUCnNiSUM7t9qNbkP
TDJJMXSxe2/xYyZNb59aMsIVkMXEpX+NQpjG42VtfEcfc2HBNDeFznEAyrLFsgkf
7/7hq28W8C4bnvZ2IY4BoIhi167QnzineNDdB8g4pxw7zUqIpoyx/wQaeEyTGk4=
=ZUEc
-----END PGP SIGNATURE-----


More information about the LibreOffice mailing list