public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: "Denis José Navas Vega" <denis.navas-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: Math whitespace commands and docx output
Date: Fri, 25 Nov 2016 20:25:48 -0800 (PST)	[thread overview]
Message-ID: <33f0e49f-edaa-435f-a98a-1dc36a68c3ce@googlegroups.com> (raw)
In-Reply-To: <20161125103541.GG77617-l/d5Ua9yGnxXsXJlQylH7w@public.gmane.org>


[-- Attachment #1.1: Type: text/plain, Size: 7552 bytes --]

I made some tests that I wish to share with the group.

This is the ecuation in docx as readed by LibreOffice: 

    {y =m x +b  none  none  \( 1  \)}

You can observe that LibreOffice can't interprete the quad spaces and 
translates 
it as 'none'.

The same equation generated by Pandoc from markdown to odt, lacks the 
space. 
If made directly with the LibreOffice suite, its equation editor provides a 
tilde 
'~' character with provides a 'large space' according to LibreOffice 
MathGuide. 
It is necessary to use four tildes to equal the space of an quad as viewed 
in 
MS Office. For a qquad are necesary 8 tildes ('~~~~~~~~') to represent that 
space. Thats is explained in the following text:


    From Math-guide (pag 38):

    Space at the end of a formula

    The grave accent ` inserts a small additional space into the formula; 
the 
    tilde ~ inserts a larger one. In the basic installation, these symbols 
are 
    ignored when they occur at the end of a formula. However, when working 
with
    running text, it may be necessary to include spacing at the end of 
formulas 
    as well. This customization is only available when you are working with 
a 
    Math document, and not when you are embedding a Math object.

The next code is an export of LibreOffice Math as MathML 1.01, of the 
equation written in LibreOffice:

    ~~~
    <?xml version="1.0" encoding="UTF-8"?>

    <math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
     <semantics>
      <mrow>
       <mrow>
        <mi>y</mi>
        <mo stretchy="false">=</mo>
        <mi>m</mi>
       </mrow>
       <mrow>
        <mi>x</mi>
        <mo stretchy="false">+</mo>
        <mi>b</mi>
       </mrow>
       <mspace width="16em"/>
       <mo stretchy="false">(</mo>
       <mn>1</mn>
       <mo stretchy="false">)</mo>
      </mrow>
      <annotation encoding="StarMath 5.0">{y = m x + b ~~~~~~~~ \(  1  
\)}</annotation>
     </semantics>
    </math>
    ~~~

I verified with 
[Wolfram Research](http://www.mathmlcentral.com/Tools/ValidateMathML.jsp) 
and reports that "The input is valid MathML".


Pandoc's manual states (p46, pdf):

    Docx It will be rendered using OMML math markup.

    RTF, OpenDocument, ODT It will be rendered, if possible, using unicode
    characters, and will otherwise appear verbatim.


LibreOffice MathGuide informs that are some limitations converting math 
objects 
from docx to odt; therefore its preferable the direct route markdown --> 
odt. 
But my test shows that what Pandoc's generate is not understood as spaces
 by LibreOffice.

Here I reproduce the manual aboout conversion by LibreOffice from docx to 
odt 
(pag 42), that confirms the restrictions from docx to odt.

    Microsoft file formats

    The options in Tools > Options > Load/Save > Microsoft Office [in 
LibreOffice]
    control how the import and export of Microsoft Office file formats is 
    carried out in regard to formulas.

    Loading

    If [L] is checked, LibreOffice converts Microsoft formulas into native
    format when a document is loaded. This is possible if the formulas
    were created with MathType 4 (up to version 3.1) or with the Microsoft
    Equation Editor. The latter is a reduced, older version of MathType
    licensed by Microsoft and included in the Microsoft Office package.

    Formulas created by newer versions of MathType or by the new Microsoft
    formula editor “OMML 5 Equation Editor” (Microsoft Office Suite 2010
    and to some extent 2007) cannot be converted.

    If a document created in Microsoft Office 2010 and containing an OMML
    formula is saved into a .doc file format, Microsoft Office converts
    the formula into a graphic. Only this graphic is then accessible to
    LibreOffice.

    If you load a .docx document that contains OMML formulas, these fail
    in conversion whether [L] is checked or not.

    Inside Microsoft Office, formulas created with MathType or Microsoft
    Equation Editor are treated as OLE objects. If [L] is not checked,
    LibreOffice maintains this. Double-clicking on the object launches
    MathType and new formulas can be inserted using Insert > Object > OLE
    Object. This setup is to be recommended if you have MathType installed
    and wish to use it to create and edit formulas.

Therefore, is preferable the direct route 'markdown --> odt' and look by 
mechanisms to get the \qquad spaces. Its preferable to settle on math 
expressed with TeX commands, because is a referent on the field.


El viernes, 25 de noviembre de 2016, 4:35:47 (UTC-6), John MacFarlane 
escribió:
>
> You can see how pandoc handles whitespace here (using the 
> texmath executable from texmath): 
>
> % echo "\\qquad" | texmath -t omml 
> <m:oMathPara> 
>   <m:oMathParaPr> 
>     <m:jc m:val="center" /> 
>   </m:oMathParaPr> 
>   <m:oMath> 
>     <m:r> 
>       <m:t> </m:t> 
>     </m:r> 
>   </m:oMath> 
> </m:oMathPara> 
>
> It uses a "text" node with an appropriate combination of unicode 
> whitespaces.  I don't know if there's a better way to do this, 
> but I can say that the results look fine in Word, so this may be 
> a LibreOffice issue. 
>
>
> +++ Thomas J. Duck [Nov 24 16 07:52 ]: 
> >   Hi there, 
> >   Pandoc seems to ignore math whitespace commands when the output format 
> >   is docx (as viewed with LibreOffice 5.2.3.3).  For example, the \qquad 
> >   in the following equation is ignored: 
> >   $$ y = mx + b \qquad (1) $$ 
> >   It works for LaTeX and html output. 
> >   This is a simple example: Whitespace is used for many purposes in 
> >   writing equations. 
> >   Is this a bug, or am I missing something?  Is there a workaround? 
> >   Thanks, 
> >   Tom 
> > 
> >   -- 
> >   You received this message because you are subscribed to the Google 
> >   Groups "pandoc-discuss" group. 
> >   To unsubscribe from this group and stop receiving emails from it, send 
> >   an email to [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. 
> >   To post to this group, send email to 
> >   [2]pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. 
> >   To view this discussion on the web visit 
> >   [3]
> https://groups.google.com/d/msgid/pandoc-discuss/417644b0-297f-42de- 
> >   9678-f622120644b4%40googlegroups.com. 
> >   For more options, visit [4]https://groups.google.com/d/optout. 
> > 
> >References 
> > 
> >   1. mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:> 
> >   2. mailto:pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:> 
> >   3. 
> https://groups.google.com/d/msgid/pandoc-discuss/417644b0-297f-42de-9678-f622120644b4-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org?utm_medium=email&utm_source=footer 
> >   4. https://groups.google.com/d/optout 
>
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/33f0e49f-edaa-435f-a98a-1dc36a68c3ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 11806 bytes --]

  parent reply	other threads:[~2016-11-26  4:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-24 15:52 Thomas J. Duck
     [not found] ` <417644b0-297f-42de-9678-f622120644b4-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2016-11-25 10:35   ` John MacFarlane
     [not found]     ` <20161125103541.GG77617-l/d5Ua9yGnxXsXJlQylH7w@public.gmane.org>
2016-11-26  4:25       ` Denis José Navas Vega [this message]
     [not found]         ` <33f0e49f-edaa-435f-a98a-1dc36a68c3ce-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2016-11-26 17:39           ` John MacFarlane
     [not found]             ` <20161126173958.GA4430-l/d5Ua9yGnxXsXJlQylH7w@public.gmane.org>
2016-11-26 18:06               ` John MacFarlane
     [not found]                 ` <20161126180613.GA8286-l/d5Ua9yGnxXsXJlQylH7w@public.gmane.org>
2016-11-27  2:08                   ` Denis José Navas Vega
2016-11-27  2:40                   ` Denis José Navas Vega
2016-11-27  3:41                   ` Denis José Navas Vega
2016-11-29 18:24                   ` Thomas J. Duck
     [not found]                     ` <99514f6f-b316-48e0-ab0c-7d9b6a8eca3c-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2016-12-08  3:12                       ` Denis José Navas Vega

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=33f0e49f-edaa-435f-a98a-1dc36a68c3ce@googlegroups.com \
    --to=denis.navas-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).