Replies: 5   Views: 3056
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


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).


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.
 *             (
 * @license
 * @version    2013.11.20
 * @link
 * @since      File available since Release 1.0

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


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


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:


require_once 'classes/';

$docx = new CreateDocx();

$mathML = '<math xmlns="">
                <mfenced open="[" close="]">

$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');


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], and we'll generate a patch to be able to set alignment using a new option with addMathEquation.


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

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


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


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