Supplemental code related to IMathAS
This is used by the "Convert to Word" print version option in IMathAS.
Note:
- pandoc needs to be installed on the server. Ideally the most recent version. Check the code to update the path if needed.
- the imgs subdirectory needs to be writable by the web server.
- the ../datatmp/ directory needs to be writable by the web server.
- you do not need uniconvertor. That was an experiment that didn't work.
This sets up a websocket server to enable the LivePoll feature in IMathAS.
- Create a directory and copy into it index.js and package.json
- Go into the directory and run
npm install - Create a
certssubdirectory
The code is set up to run on SSL, so you'll need to put your SSL keys in the directory indicated in the code. Also change the livepollpassword value.
To setup the SSL
- Follow the instructions on the Certbot website on how to get a certificate. Note that this will require having a regular (Apache, etc) webserver running as well.
- Copy
livepoll.shinto/etc/letsencrypt/renewal-hooks/deploy/, and edit it so thelivepoll_cert_rootis the path to thecertsdirectory you created earlier. Make sure tochmod a+x livepoll.sh. - You may have to manually copy and chmod the certificates into the directory the first time. The script above should handle updating it when the certs renew.
To keep the server running in the background, you'll need to set up some kind of autostart config.
- Copy
livepoll.serviceto/lib/systemd/system/, editing theExecStartpath as needed. - Start the server using
sudo systemctl start livepoll
Once set up, put $CFG['GEN']['livepollserver'] = 'your.server.com' and
$CFG['GEN']['livepollpassword'] = 'yourpassword' in your IMathAS config.php.
Note that the livepoll server runs on port 3000, so make sure your server is set to allow connections on port 3000.
This sets up a node server that can render tex to svg images. This can be used as an endpoint for $mathimgurl instead of a mimetex server.
There are two versions here: mathsvg which uses mathjax 3, and mathsvg4 which
uses mathjax 4. Either will work.
- Create a directory and copy into it index.js and package.json
- Go into the directory and run
npm install
To keep the server running in the background, you'll need to set up some kind of autostart config.
- Copy
mathsvg.serviceto/lib/systemd/system/, editing theExecStartpath as needed. - Start the server using
sudo systemctl start mathsvg
The code is set up to run without SSL, with the intent of using an existing Apache setup on the server as a SSL proxy. You can enable proxy on the server
a2enmod proxy
a2enmod proxy_http
a2enmod ssl
a2enmod headers
systemctl reload apache2
then edit your .conf file for apache and add
ProxyPreserveHost On
ProxyRequests Off
ProxyPass /mathsvg/ http://127.0.0.1:3001/
ProxyPassReverse /mathsvg/ http://127.0.0.1:3001/
then systemctl reload apache2
This script will attempt to convert all the <math> tags in an HTML document
to Wordpress-style latex tags using an xsl transform