MathJax-Talk
This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.
Comments
As the previous maintainer (AMyles) seems to be M.I.A. for 8 years now, I am recording myself as maintainer of this recipe. Please feel free to send me all bug reports and questions!
—Said Achmiz March 27, 2019, at 05:43 PM
You can include the parameters necessary to change the settings using MathJax without changing the file MathJax/config/MathJax.js
.
You only need to change the call to that file:
$HTMLHeaderFmt['MathJax'] = '<script type="text/javascript" src="$MathJaxUrl/MathJax.js"></script>';
to
$HTMLHeaderFmt['MathJax'] = '<script type="text/javascript" src="$MathJaxUrl/MathJax.js">MathJax.Hub.Config({ extensions: ["tex2jax.js","TeX/AMSmath.js","TeX/AMSsymbols.js"], jax: ["input/TeX", "output/HTML-CSS"], tex2jax: { inlineMath: [ [\'{\$\',\'\$}\'] ], displayMath: [ [\'{\$\$\',\'\$\$}\'] ] } });</script>';
in your cookbook.
Domingo Redal November 29, 2010, at 08:21 AM
David C. October 1st, 2011, at 15:56
https://d3eoax9i5htok0.cloudfront.net/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML
rather than to a local installation of MathJax. It works fine for me.
SDV($MathJaxUrl, "$PubDirUrl/MathJax");
SDV($MathJaxUrl, "https://d3eoax9i5htok0.cloudfront.net/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML");
SDV() means "Set default value (if none is set)" and its purpose is to allow you to set your own values without editing the script. You shouldn't ever need to modify files from the PmWiki core distribution or recipes, because they allow you to set your own variables. In config.php, before including the cookbook/RECIPE.php file, add something like:$VARIABLE = "my value"; # now SDV($VARIABLE, "value") in RECIPE.php will do nothing
This principle will allow you to upgrade your PmWiki and/or Recipe installations without losing your local customizations. --Petko October 01, 2011, at 09:53 AM
I suggest to install this way, copy the follwong lines in local/config.php directory:
#MathJax $HTMLHeaderFmt['MathJax'] = '<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>' ;
And use
- \( and \) for inline equation
- \[ and \] for displayed equation.
This way you use alway the last version with all standard optiona enabled.
Massimiliano Vessi August 23, 2013
PHP 5.5
wlkl Jan 1, 2014
- For my installation I implemented the above suggestions plus add php5.5 support (preg_replace_callback). Contact me for the source if interested
For PHP 5.5 compatibility I have changed (on my installation) the 3 Markup lines, from
# equations within {$ $} and {$$ $$}. Markup('{$', '>[=', '/\\{\\$(.*?)\\$\\}/e', "Keep('{\$'.PSS('$1').'\$}')"); Markup('{$$', '<{$', '/\\{\\$\\$(.*?)\\$\$\\}/se', "ProcessLatexEquation(PSS('$1'))"); # PmWiki rule for processing eqrefs. Markup('latexeqref', '>{$$', '/\\\\eqref\\{([^\\}]+)\\}/e', "ProcessEqref('$1')");
to:
# equations within {$ $} and {$$ $$}. function MathJaxInlineCallback($m) { return Keep('{$'.PSS($m[1]).'$}'); } Markup('{$', '>[=', '/\\{\\$(.*?)\\$\\}/', MathJaxInlineCallback); function MathJaxEquationCallback($m) { return ProcessLatexEquation(PSS($m[1])); } Markup('{$$', '<{$', '/\\{\\$\\$(.*?)\\$\$\\}/s', MathJaxEquationCallback); # PmWiki rule for processing eqrefs. function MathJaxLatexeqrefCallback($m) { return ProcessEqref($m[1]); } Markup('latexeqref', '>{$$', '/\\\\eqref\\{([^\\}]+)\\}/', MathJaxLatexeqrefCallback);
RKzn 2016-12-04