templates - Adding Mathjax to a Joomla website - Joomla Stack Exchange
https://joomla.stackexchange.com/questions/399/adding-mathjax-to-a-joomla-website
As @Anibal answer, you can edit the template file. I'm improving the @Anibal answer to support your code $\frac{a}{b}$
...
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
</script>
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
</head>
<body id="shadow">
There are several ways:
A. At template level: Access your template, and add the Mathjax cdn line in the head area. E.g. In beez3 template:
templates/beez3/index.php, line 85
...
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
</head>
<body id="shadow">
....
B. With a Custom HTML module: You can add a couple of PHP source code lines in a custom scripting module. In this way you can assign the Mathjax cdn script to specific menus. For example, with NoNumber Sourcerer http://www.nonumber.nl/extensions/sourcerer
{source}
<?php
$doc = JFactory::getDocument();
$doc->addScript('http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML', 'text/javascript');
?>
{/source}
I have copied and pasted
<script type="application/javascript" src="https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
just before </head>
tag in the PHP template principal page file.
Then, it was enough for me to use MathJaX delimiters inside articles.
It just works, and in the usual nice way.
Addendum: I did not notice before today that, since the latest months, some changes occurred and must be considered by users who want to choose this simple way of implementation.
Switching https://c328740.ssl.cf1.rackcdn.com/
to https://cdn.mathjax.org/
in the link above would - I verified - keep this answer actual.
Δεν υπάρχουν σχόλια:
Δημοσίευση σχολίου