Commit 0feefc8a authored by Curtis Adam's avatar Curtis Adam

Add the custom markdeep mathjax definitions to the app

parent f97b4e9d
let customMathJaxDefinitions = [
"{\\n}{\\hat{n}}",
"{\\thetai}{\\theta_\\mathrm{i}}",
"{\\thetao}{\\theta_\\mathrm{o}}",
"{\\d}[1]{\\mathrm{d}#1}",
"{\\w}{\\hat{\\omega}}",
"{\\wi}{\\w_\\mathrm{i}}",
"{\\wo}{\\w_\\mathrm{o}}",
"{\\wh}{\\w_\\mathrm{h}}",
"{\\Li}{L_\\mathrm{i}}",
"{\\Lo}{L_\\mathrm{o}}",
"{\\Le}{L_\\mathrm{e}}",
"{\\Lr}{L_\\mathrm{r}}",
"{\\Lt}{L_\\mathrm{t}}",
"{\\O}{\\mathrm{O}}",
"{\\degrees}{{^{\\large\\circ}}}",
"{\\T}{\\mathsf{T}}",
"{\\mathset}[1]{\\mathbb{#1}}",
"{\\Real}{\\mathset{R}}",
"{\\Integer}{\\mathset{Z}}",
"{\\Boolean}{\\mathset{B}}",
"{\\Complex}{\\mathset{C}}",
"{\\un}[1]{\\,\\mathrm{#1}}"
];
/** Wraps image files inside a lightbox-img class
* @param {string} content - Text that contains the image
* @returns {string} - The wrapped text
......@@ -29,6 +54,14 @@ export function adjustIframe(content) {
return $('<div/>').append(element).html();
}
export function addCustomMathJax() {
let mathJaxJoinString = '\\newcommand';
let mathJaxCostumCommands = '<span style="display:none">$$';
mathJaxCostumCommands += (mathJaxJoinString + customMathJaxDefinitions.join(mathJaxJoinString));
return (mathJaxCostumCommands + '$$\n</span>\n');
}
export function displayMediaControls(content) {
let element = $(content);
$(element).find('video').each(function () {
......
......@@ -18,6 +18,7 @@ import {UserPermissions} from "../../api/permissions";
import {Bonus} from "../../api/bonus";
import {Profile} from "../../api/profile";
import {BonusForm} from "../../api/bonusForm";
Meteor.subscribe("collegesCourses");
Template.registerHelper('isSelectingCardsetToLearn', function () {
......@@ -706,7 +707,9 @@ const helper = new MeteorMathJax.Helper({
x = lib.displayMediaControls(x);
x = lib.adjustIframe(x);
CardVisuals.setTextZoom();
return lib.setLinkTarget(x);
x = lib.setLinkTarget(x);
x += lib.addCustomMathJax();
return x;
}
});
......@@ -714,10 +717,10 @@ Template.registerHelper('mathjax', helper.getTemplate());
MeteorMathJax.sourceUrl = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS_SVG';
MeteorMathJax.defaultConfig = {
TeX: {equationNumbers: {autoNumber: "AMS"}},
menuSettings: {
zoom: "Hover",
zscale: "250%",
locale: "de"
}
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment