math issues

Was looking at recent changes and came across this
http://stackoverflow.com/questions/10300067/how-to-load-and-mathml-formula-into-libreoffice,
which suggests that there is in LO an Insert Formula option from the
Tools menu. I can find no such thing and I don't recall that I ever saw
this. Is there a way to import mathml without deconstructing zip files
now? WHile looking at this I also discovered that my existing extensions
for xhtml and latex have been apparently deleted as a result of an
update....

Hi Marc,

Marc Grober schrieb:

Was looking at recent changes and came across this
http://stackoverflow.com/questions/10300067/how-to-load-and-mathml-formula-into-libreoffice,
which suggests that there is in LO an Insert Formula option from the
Tools menu. I can find no such thing and I don't recall that I ever saw
this.

You have to be inside the formula editor to get that menu.

   Is there a way to import mathml without deconstructing zip files

now?

? Why "deconstructing zip files"? Import of MathML is possible at least since OOo2.4.

Kind regards
Regina

You are right: it is not there. Here is where it is located:
        Insert > Object > Formula.
Even the link you mentions shows that. Insert has a blue background
(highlighted), and so to Object and Formula.

--Dan

Hi :slight_smile:
Re: side issue about Extensions ...

Prior to 3.5.x branch the UserProfile, which contains the Extensions, was located in
.libreoffice
The 3.5.x branch moved it's UserProfile to
.config/libreoffice
You might find Extensions still in the old folders.  It might be worth looking in
Tools - Options - Paths
to get some idea of where your UserProfile is now and maybe to get it looking in the old places.  Alternatively this wiki-page might help
http://wiki.documentfoundation.org/Documentation/UserProfile
Regards from
Tom :slight_smile:

But it looked like at least some of the extensions survived the
upgrade... and the balance of my profile seemed to have been picked up
(name etc.) so what would have happened?

     You are right: it is not there. Here is where it is located:
        Insert > Object > Formula.
Even the link you mentions shows that. Insert has a blue background
(highlighted), and so to Object and Formula.
--Dan

AHA, the issue is that in order to "Import Formula" from the Tool menu
you must first have the equation editor OPEN!

And unfortunately, this allows input by file only... why would the
application, specifically intended to llow one to import MathML, not
allow one to paste the mathml in, as opposed to requiring one to place
the mathml in an xml file?

? Why "deconstructing zip files"? Import of MathML is possible at least
since OOo2.4.

because that way I can edit the file, as opposed to playing little games
with creating lots of little xml files and adding them hither thither
and yon

Then, Regina, how does one import MathML? Would Insert > File be
the way?

--Dan

Hi :slight_smile:
Maybe the Extensions are not compatible with the newer version of LO yet?  Hmmm, maybe not such a good idea to test them in the new profile unless you take care to use back-ups!

It might be possible to contact the devs maintaining or original creators of those Extensions and see if they want to update their extensions or perhaps make them OpenSource so that other people could.  At worst it lets them know you value their work :slight_smile:
Regards from
Tom :slight_smile:

Dan Lewis schrieb:

Hi Marc,

Marc Grober schrieb:

Was looking at recent changes and came across this
http://stackoverflow.com/questions/10300067/how-to-load-and-mathml-formula-into-libreoffice,
which suggests that there is in LO an Insert Formula option from the
Tools menu. I can find no such thing and I don't recall that I ever saw
this.

You have to be inside the formula editor to get that menu.

    Is there a way to import mathml without deconstructing zip files

now?

? Why "deconstructing zip files"? Import of MathML is possible at least
since OOo2.4.

Kind regards
Regina

      Then, Regina, how does one import MathML? Would Insert> File be
the way?

It is exact as described in the link: First Insert > Object > Formula. Now you are in the formula editor. And then Tools > Import Formula.

Of cause need the have the MathML already as file.

Kind regards
Regina

Hi Marc,

Marc Grober schrieb:

? Why "deconstructing zip files"? Import of MathML is possible at least
since OOo2.4.

because that way I can edit the file, as opposed to playing little games
with creating lots of little xml files and adding them hither thither
and yon

It is still not clear to me. Where is your MathML source, that you will get into a LO document?

Kind regards
Regina

It is still not clear to me. Where is your MathML source, that you will
get into a LO document?

MathML source is obtained via mathjax - one need only copy and paste

Have you tried this?
Insert > Object > Formula. Then copy and paste the MathML into the area
where the cursor is. I was able to copy and paste text there.

--Dan

It is exact as described in the link: First Insert > Object > Formula.
Now you are in the formula editor. And then Tools > Import Formula.

Only if yo don't exit the equation editor before selecting
Tools->Import, which one might do in as much as the documentation does
not include those few precious words "while the equation editor is
open", lol.

Now, as far as importing xml files, I have never been successful at
importing mathml and must assume that this is accomplished through some
secret handshake as well :wink:
for example, an attempt to import test.xml which consisted of the following:

<?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN"
           "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">
  <math xmlns="http://www.w3.org/1998/Math/MathML">
    <mrow>
      <mi>a</mi>
      <mo>&#x2062;<!-- &InvisibleTimes; --></mo>
      <msup>
        <mi>x</mi>
        <mn>2</mn>
      </msup>
      <mo>+</mo>
      <mi>b</mi>
      <mo>&#x2062;<!-- &InvisibleTimes; --></mo>
      <mi>x</mi>
      <mo>+</mo>
      <mi>c</mi>
    </mrow>
  </math>

was unsuccessful.

An attempt to export similar code as writer xml was similarly
ineffective on import.

putting mathml into the editor box will not work as the editor only
parses the syntax that LO uses (as opposed to parsing universally based
on tokens like a well behaved program, lol) so one can't just insert
MathML ASCIIMathML or TeX or anything lese, nor is there a simple tool
to manage the translation.

I was finally able to get some files to import. The results largely
acceptable (there were some flaws as a result of inadequate curly braces
and the like) - and the experience suggests that there are, as expected,
some issues. Some of those issues relate potentially to the lack of
specifics as far as what kind of mathml can be imported and the
specifics of the import files.

The question remains, though, why not simply allow the user to paste the
MathML in to the importer and avoid the xml and DTD statements.

Hmmmmm.......
And exporting a document with imported MathML results in the MathML
being saved as an image ..... Ack. No way to alter that behavior I
suppose?

Hi Marc,

Marc Grober schrieb:

It is exact as described in the link: First Insert> Object> Formula.
Now you are in the formula editor. And then Tools> Import Formula.

Only if yo don't exit the equation editor before selecting
Tools->Import, which one might do in as much as the documentation does
not include those few precious words "while the equation editor is
open", lol.

Now, as far as importing xml files, I have never been successful at
importing mathml and must assume that this is accomplished through some
secret handshake as well :wink:
for example, an attempt to import test.xml which consisted of the following:

  <?xml version="1.0" encoding="UTF-8"?>
   <!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN"
            "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">
   <math xmlns="http://www.w3.org/1998/Math/MathML">
     <mrow>
       <mi>a</mi>
       <mo>&#x2062;<!--&InvisibleTimes; --></mo>
       <msup>
         <mi>x</mi>
         <mn>2</mn>
       </msup>
       <mo>+</mo>
       <mi>b</mi>
       <mo>&#x2062;<!--&InvisibleTimes; --></mo>
       <mi>x</mi>
       <mo>+</mo>
       <mi>c</mi>
     </mrow>
   </math>

was unsuccessful.

I had tested that very same example before I had answered. Besides the fact, that the character &#x2062; is rendered wrong, the import is without problems.

So there must be some difference between my and your way. So next try with a step by step description:

Precondition: The MathML is saved as file on disk, for example "mymath.xml".

1. Open a Writer document or use a new one. Set the cursor where the formula should be.

2. Insert > Object > Formula. Now the equation editor is open. The top menu has changed, a part of the writer document is shown, with a rectangle where the formula will be, and a command window with a blinking cursor exists.

4. Tools > Import Formula. You get a file picker. Choose your MathMl-file, here mymath.xml. Click on button 'Insert'.

5. Now you have the proper command in the command window. If something is wrong (for example the character &#x2062; mentioned above), you can correct it.

6. Klick outside the formula into your Writer document. Finished.

An attempt to export similar code as writer xml was similarly
ineffective on import.

If you only want to convert a single formula to MathML and your formula is inside a Writer document, then right-click the formula. The context menu opens and the last item is "Save as...". Use this and select "MathML" from the list of available file formats. You will get a single MathML file. It does not matter whether you use the file extension .mml or .xml.
Reimporting this file as described above, gives the same formula as exported, because the original LO formula is written to an annotation element and read when imported.
You should use grouping brackets to generate a well structured formula in LO, although LO does not need them to render the formula. It will give better results in export.

If you want to export the whole Writer document with an easy access to the MathML without unzipping, you can use File > Export > type XHTML, or File > Save as > type "Flat XML".

Do you understand German? Than the German "Handbuch für Math" on http://de.libreoffice.org/hilfe-kontakt/handbuecher/ might give you some ideas.

Kind regards
Regina

Hi :slight_smile:
It probably doesn't get quite so far into it but the official Math Guide is ready
http://wiki.documentfoundation.org/Documentation/Publications#LibreOffice_Math_Guide

The docs team have done an amazing amount in the last couple of weeks.
Regards from
Tom :slight_smile:

Hi Tom,
Tom Davies schrieb:

Hi :slight_smile:
It probably doesn't get quite so far into it but the official Math Guide is ready
http://wiki.documentfoundation.org/Documentation/Publications#LibreOffice_Math_Guide

The docs team have done an amazing amount in the last couple of weeks.
Regards from
Tom :slight_smile:

We (German group) too. The English Guide has no section on Import and Export. That section is new in the German Guide (and some other parts). For LO 3.5 or 3.6 it is worth to look at the German Guide and if you find it useful, translate it to English.

Kind regards
Regina