Jump to content

Extension talk:SimpleMathJax/Flow

About this board

Visual Editor Integration

7
Spas.Z.Spasov (talkcontribs)

Hello, @Jmnote.

I would like to announce a modified version of Extension:SimpleMathJax which has an integration with Extension:VisualEditor and Extension:Math. It is available in this fork of the main git repository of the extension. I will be happy if this modified version is the basis for further development of the main repository.


Best regards.

Kghbln (talkcontribs)

This sounds exciting to me. Thank you for sharing this information and the link to the fork. However, I also believe that it should be in this extension rather than in a fork.

110.141.255.56 (talkcontribs)

Similar behaviour can be acheived by using both but disabling the rendering of the math extension, this won't allow the math to be rendered in the visual editor with C-S but it will atleast give the dialog menu:

# LocalSettings.php

# This is needed to get the Formula menu item in Visual Editor
wfLoadExtension( 'Math' );
# This is needed to prevent sending all equations to CDN (which can be slow)
$wgDefaultUserOptions['math'] = 'source';

## Mathjax to render LaTeX
wfLoadExtension( 'SimpleMathJax' );
$wgSmjUseCDN = false;
Uvas magicas (talkcontribs)

don't work in mediawiki 1.37

Sm8ps (talkcontribs)

Having the following in LocalSettings.php makes it work with MW-1.39:

wfLoadExtension( 'Math' ) ;
$wgDefaultUserOptions['math'] = 'source';
$wgMathDisableTexFilter = 'always' ;
wfLoadExtension( 'SimpleMathJax' ) ;
$wgSmjExtraInlineMath = [ [ "$", "$" ] ] ;

L2 sets the output mode Math to no rendering ('source'); L3 is a necessary setting for this to work. In this mode, Math will forward the Latex input without rendering, presenting it in a span-element like $ :formula $.

L5 tells SimpleMathJax to interpret text included within dollar signs as formula which it will then render.

Many thanks to user @Kghbln for sharing his idea in the above post!

Sm8ps (talkcontribs)

When doing as described above, then the configuration settings from SimpleMathJax seemingly get over-ruled in the final CSS. Add the following lines to Comon.css to change that. L6 corresponds to the parameter $wgSmjScale.

.mwe-math-fallback-source-inline {
    vertical-align: baseline;
}
mjx-math {
    font-size: 81% !important;
}
Gota de agua (talkcontribs)

the configuration don't work for chem formules

Reply to "Visual Editor Integration"

Thick frame around zommed expression, pop-up window too narrow

2
Sm8ps (talkcontribs)

After upgrading to version 0.8.2 on MW-1.35.3, the pop-up window for zoomed expressions comes with a frame that is roughly the same size as the formula area height. In the top part, "MathJax Zommed Expression" is written at about one third of the height which is not very informative and even distracting.

Furthermore, the window is too narrow. For instance, it is about one third of the window size but only half of the formula is displayed, the rest needs to be shown by scrolling sideways. There would be more than enough space to double the size of the pop-up window within the main browser window.

Does anyone have any pointers about these issues? I have searched through the extension folder itself and have browsed through them MathJax documentation. Thanks in advance!

Sm8ps (talkcontribs)

Answering my own question after having had to delve into it once again. The following rules in Common.css will drastically reduce the borders of the pop-up window and at the same time enlarge its horizontal size.

.CtxtMenu_Info {
  width: fit-content !important ;
  max-width: 80% !important ;
  padding: 0 0.5em !important;
  font-size: 50% !important;
  -webkit-border-radius: 10px !important;
  -moz-border-radius: 10px !important;
  -khtml-border-radius: 10px !important;
}

.CtxtMenu_InfoContent {
  font-size: 200% !important;
  max-width: unset !important ;
  margin: 0.5em 0px !important;
  padding-left: 0.2em !important;
  padding-right: 0.2em !important;
  padding-top: 0.2em !important;
  padding-bottom: 0.2em !important;
}

.CtxtMenu_InfoClose {
  top: 0 !important;
  right: 0 !important;
}

Some rules do need the !important-flag and I ended up simply adding it to all of them. Please understand that I do not have much experience with CSS, so these rules may need improvement. YMMV!

Nevertheless, it is nice to enlarge formulae during presentations using most of the screen width.

Reply to "Thick frame around zommed expression, pop-up window too narrow"

SimpleMathjax and Extension:MobileFrontend don't work

9
Summary by Sophivorus

Fixed in version 0.8.3+

Gdwikimeca (talkcontribs)

Hi,

I'm using mediaWiki 1.31.

I install SimpleMathJax and it work well. Thanks for this extension.

But when i use Extension:MobileFrontend for a phone or tablet displaying, math formulas are not displayed.

Is there a way to fix this problem?

Thanks

Libattery (talkcontribs)

You can use extension:math if you can install.

but there are pros and cons.

extension:math

pro - work with MobileFronted well. work with Visaul Editor ...

con - you can't use \tag, \label \eqref ...

extension:simplemathjax

con - don't work with MobileFronted ...

pro - you can use \tag, \label, \eqref ...

Jmkim dot com (talkcontribs)
Varlin (talkcontribs)

Same issue for me. When using MobileFrontend, the formulas are displayed in raw math syntax (not rendered). I do use version 0.8.1 (and MW 1.34.0)

Perfect Reason (talkcontribs)

Hello!

I've made this quick fix in my fork to make the extension work with MobileFrontend.

P.S. When I originally posted it, the fork used MathJax 2.7.3 for the mobile view. Today I've updated it, so that MathJax 3.1.4 is being used for both desktop and mobile view.

Varlin (talkcontribs)

Thanks for the sharing, but I can't make it work (MW 1.35.3, using only SimpleMathJax, without integration in VE).

Perfect Reason (talkcontribs)

Thanks for trying. Yeah, I have no idea why it works in some cases and doesn't in others, but it still works for me in MW 1.36.2 🤷.

Varlin (talkcontribs)

You know what ? Now it works XD

Sophivorus (talkcontribs)

Hi! See my fix at https://github.com/Appropedia/SimpleMathJax I did a pull request to get it upstream, but until then, feel free to clone the Appropedia fork to get the fix, or see the diff to manually redo the changes on your own source code (they're quite trivial). Cheers!

Error using SimpleMathJax and ParserOutput with Mediawiki 1.38

2
Noloader (talkcontribs)

We recently upgrade from Mediawiki 1.37 to 1.38. ParserOutput appears to be having some trouble with MW 1.38. It looks like SimpleMathJax may be calling the function incorrectly.


Deprecated: Use of ParserOutput::addModules with non-array argument was deprecated in MediaWiki 1.38. [Called from SimpleMathJaxHooks::renderTex in /var/www/html/w/extensions/SimpleMathJax/SimpleMathJaxHooks.php at line 34] in /var/www/html/w/includes/debug/MWDebug.php on line 377
<!DOCTYPE html>

I'm using SimpleMathJax from Git:

#git branch -a
*master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master

It also looks like SimpleMathJax does not follow Mediawiki conventions of offering branches for REL1_35, REL1_36, REL1_37, REL1_38, etc. So we have to use master.

Noloader (talkcontribs)
Reply to "Error using SimpleMathJax and ParserOutput with Mediawiki 1.38"
91.243.4.220 (talkcontribs)

This extension is not working with 1.38 (when usecdn=false)

Reply to "Not working"

SimpleMathJax works great under MW 1.36

1
Noloader (talkcontribs)

Hi Everyone,

Dropping a quick note... SimpleMathJax works great under MW 1.36. We have not observed any problems or issues.

Noloader (talk) 03:38, 30 May 2021 (UTC)

Reply to "SimpleMathJax works great under MW 1.36"
Rayhem (talkcontribs)

It appears mathjax supports automatic equation numbering; is there any way to enable this within SimpleMathJax to get equation numbers and references within a wiki page?

Jmkim dot com (talkcontribs)

Can you show me some examples used in MediaWiki?

Reply to "Equation numbering"
2003:C4:5F15:4B00:3493:8B84:43CB:CC05 (talkcontribs)

Hey folks,

I’m using the MinervaNeue skin in conjunction with the SimpleMathJax extension for math display (version numbers see below).

The live preview (…#editor) does not show rendered math output but raw LaTeX source code. Is there a way to re-invoke MathJax.Hub.Typeset() right after the preview text has been added to the DOM? Is there a hook or some other appropriate event for that?

MediaWiki: 1.31.0

MinervaNeue: (2e70e79)

SimpleMathJax: 0.7.3

(This is a copy of the original question: Topic:Uir4rbph9eogl2mq)

131.111.184.83 (talkcontribs)

Hey! I think I figured out how to do this. This is a bit hacky; adjust the retry time (currently 1000 ms) to your liking.

I've got this in MediaWiki:Common.js:

function waitForMathJax($content) {
  if (typeof MathJax === 'undefined') {
    setTimeout(function () { waitForMathJax($content); }, 1000);
  } else {
    MathJax.Hub.Queue(["Typeset", MathJax.Hub, $content[0]]).execute();
  }
}

mw.hook('wikipage.content').add(waitForMathJax);
Sm8ps (talkcontribs)

Thanks for sharing! Working well with MW 1.31.4 and SimpleMathJax 0.7.3. I shall add this to the extension page.

Jmkim dot com (talkcontribs)

From version 0.8.0, preview is supported without additional code.

Sm8ps (talkcontribs)

Great, thanks for that! I changed to extension page in order to account for this.

Jmkim dot com (talkcontribs)

Good, Thanks!

Sm8ps (talkcontribs)

I have been using SimpleMathJax 0.3 on MW-1.23 where there was a context menu for the MathJax formulae with entries like "Show Math As ...", "Math Settings" etc. Now with version 0.7.3 on MW-1.31 I do not see this anymore and cannot find any way to enable it. Is there something I am missing or has this feature been dropped?

Jmkim dot com (talkcontribs)

Now, the context menu is supported by default. It can also be set with $wgSmjEnableMenu. Try version 0.8.1.

Sadi-Carnot 3 (talkcontribs)

Does anybody know how to left align the display equation version of SimpleMathJax in MediaWiki, so that the following code (shown rendered here) in edit window, displays in left align mode?


:$$ A = - \left ( \frac{\partial G}{\partial \xi} \right ) _{p,T} $$

Jmkim dot com (talkcontribs)

Now it can be set with $wgSmjDisplayAlign. Try version 0.8.1.

Reply to "Left Align Equations?"