From f93333686d22cebe3d2955d891e02a17929e9c61 Mon Sep 17 00:00:00 2001 From: physikerwelt Date: Wed, 5 Aug 2015 11:53:10 +0200 Subject: [PATCH] Fix: Set default MathStyle to inlineDisplaystyle Redo Ibf6bdbd4ea36b4905445d5878f32f7e0b2bc8bac, which was reverted by I029328849f05ec2afcabf38d2b79b337cb54cbd5. In addition this patch simplifies the tex sent to the mathoid server. Instead of {\displaystyle {\textstyle ... } } only {\textstyle is sent (which overwrites \displaystyle anyway). Change-Id: I16d6f67215c2f85ecd1d3a0bddacfc1700681557 --- MathMathML.php | 2 ++ MathRenderer.php | 9 +++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/MathMathML.php b/MathMathML.php index 0bb18f6..058400e 100644 --- a/MathMathML.php +++ b/MathMathML.php @@ -219,6 +219,8 @@ class MathMathML extends MathRenderer { if ( $this->getMathStyle() == 'inlineDisplaystyle' ) { // default preserve the (broken) layout as it was $out = 'type=inline-TeX&q=' . rawurlencode( '{\\displaystyle ' . $input . '}' ); + } elseif ($this->getMathStyle() == 'inline' ){ + $out = 'type=inline-TeX&q=' . rawurlencode( $input ); } else { $out = 'type=tex&q=' . rawurlencode( $input ); } diff --git a/MathRenderer.php b/MathRenderer.php index 0ae380b..46aeeea 100644 --- a/MathRenderer.php +++ b/MathRenderer.php @@ -67,17 +67,16 @@ abstract class MathRenderer { if ( isset( $params['id'] ) ) { $this->id = $params['id']; } - $mathStyle = null; if ( isset( $params['display'] ) ) { $layoutMode = $params['display']; if ( $layoutMode == 'block' ) { - $mathStyle = 'display'; + $this->mathStyle = 'display'; $tex = '{\displaystyle ' . $tex . '}'; } elseif ( $layoutMode == 'inline' ) { - $mathStyle = 'inlineDisplaystyle'; + $this->mathStyle = 'inline'; $tex = '{\textstyle ' . $tex . '}'; } elseif ( $layoutMode == 'linebreak' ) { - $mathStyle = 'linebreak'; + $this->mathStyle = 'linebreak'; $tex = '\[ ' . $tex . ' \]'; } } @@ -93,8 +92,6 @@ abstract class MathRenderer { // be centered in a new line, or just in be displayed in the current line. $this->userInputTex = $tex; $this->tex = $tex; - $this->mathStyle = $mathStyle; - } /**