Forum


Replies: 5   Views: 3067
How to increase the font size of mathml in addmathequation and mathml alignment
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by peterdan  · 11-05-2017 - 04:26

Hi admin/developers,
How do you increase the font size of mathml generated especially if it is inlined with other text.

if the mathml i have is together with some text the generated mathml in the docx is small size, how to increase it? what i noticed the defualt is size 12 i want to increase it lets say to 14.

And also, it the mathml is alone in one line it is always center aligned, is it possible to left align it?

Your help is greatly appreciated

Posted by admin  · 11-05-2017 - 07:28

Hello,

Which version and license of phpdocx are you using?

The addMathEquation method doesn't include an option to customize styles in math equations, but this task can be accomplished using DOCXPath (available in Advanced and Premium licenses).

Regards.

Posted by peterdan  · 12-05-2017 - 04:44

Thanks for the reply, im currently using the demo version.

i need to make sure that the mathml equation alignment is possible, Is there any example or any link i could see the coding that does this? so that i can show it to my boss and convince them and let them buy it.. 

Actually we already bought an old  version of this:

/**
 * Generate a DOCX file
 *
 * @category   Phpdocx
 * @package    create
 * @copyright  Copyright (c) 2009-2013 Narcea Producciones Multimedia S.L.
 *             (http://www.2mdc.com)
 * @license    http://www.phpdocx.com/wp-content/themes/lightword/pro_license.php
 * @version    2013.11.20
 * @link       http://www.phpdocx.com
 * @since      File available since Release 1.0
 */

but i think it does not have the embed mathml features yet.

Thanks. 

Posted by admin  · 12-05-2017 - 07:05

Hello,

Sorry but there's no trial of the DOCXPath functionality, as it's only available in Advanced and Premium licenses.

This is a simple sample about how to set left alignment in equations using DOCXPath:

<?php

require_once 'classes/CreateDocx.inc';

$docx = new CreateDocx();

$mathML = '<math xmlns="http://www.w3.org/1998/Math/MathML">
        <mrow>
                <mi>A</mi> 
                <mo>=</mo>
                <mfenced open="[" close="]">
                        <mtable>
                                <mtr>
                                        <mtd>
                                                <mi>x</mi>
                                        </mtd> 
                                        <mtd>
                                                <mn>2</mn>
                                        </mtd>
                                </mtr>
                                <mtr>
                                        <mtd>
                                                <mn>3</mn>
                                        </mtd>
                                        <mtd>
                                                <mi>w</mi>
                                        </mtd>
                                </mtr>
                        </mtable>
                </mfenced>
        </mrow>
</math>';

$docx->addMathEquation($mathML, 'mathml');

$wordML = new WordFragment($docx);
$wordML->addWordML('<m:oMathParaPr><m:jc m:val="left"/></m:oMathParaPr>');

$referenceNode = array(
        'customQuery' => '//m:oMathPara/m:oMath',
);

$docx->insertWordFragment($wordML, $referenceNode, 'before');

$docx->createDocx('output');

Although you can accomplish it using DOCXPath as this script illustrates, after you have purchased an Advanced or Premium license please send us an email to contact[at]phpdocx.com, and we'll generate a patch to be able to set alignment using a new option with addMathEquation.

Regards.

Posted by peterdan  · 18-05-2017 - 08:54

Hi, we already have purchased a premium version for phpdocx and i already sent an email to contact@phpdocx.com.

Can you help do the patch as you said so that extra options like alignment will be there for addMathEquation.
Our domain registered to your system would be ace-learning.com

Peter

Posted by admin  · 18-05-2017 - 09:23

Hello,

Thanks for the upgrading. We have sent the patch to your email.

Regards.