PDA

View Full Version : LaTex addon for vb5?


dmiyares
12-30-2015, 05:52 PM
Hello:

I've just spun up a new forum for fluid power engineers and right out of the box two users have asked if they can use LaTex with the system. On vB4 there was an addon... wondering if there is such an animal for vB5...

Thank you.

MarkFL
12-30-2015, 06:11 PM
You can add LaTeX powered by MathJax to your forum by adding their script to your header or headinclude template (I don't use vB5 so I'm not sure which is applicable).

These are the scripts I use:

<script type="text/x-mathjax-config">
MathJax.Hub.Config(
{
TeX:
{
extensions: ["autoload-all.js"],
noErrors:
{
style: {"display": "block !important",
"margin": "1em 0em 1em 2em",
"border": "none",
"text-decoration": "underline"
}
},
Macros:
{
pd: ["{\\frac{\\partial#1}{\\partial#2}}",2],
d: ["{\\frac{d#1}{d#2}}",2],
E: ["\\times 10^{#1}",1],
csch: ["\\mathop{\\rm csch}\\nolimits"],
arccsc: ["\\mathop{\\rm arccsc}\\nolimits"],
arcsec: ["\\mathop{\\rm arcsec}\\nolimits"],
arccot: ["\\mathop{\\rm arccot}\\nolimits"],
sech: ["\\mathop{\\rm sech}\\nolimits"],
arsinh: ["\\mathop{\\rm arsinh}\\nolimits"],
arcosh: ["\\mathop{\\rm arcosh}\\nolimits"],
artanh: ["\\mathop{\\rm artanh}\\nolimits"],
arcsch: ["\\mathop{\\rm arcsch}\\nolimits"],
arsech: ["\\mathop{\\rm arsech}\\nolimits"],
arcoth: ["\\mathop{\\rm arcoth}\\nolimits"],
}
},
extensions: ["tex2jax.js"],
jax: ["input/TeX", "output/HTML-CSS"],

"HTML-CSS": {linebreaks: {automatic: true, width: "90% container"}},
"SVG": {linebreaks: {automatic: true, width: "90% container"}},

displayAlign: "left", displayIndent: "2em", displayErrorAlign: "left",
tex2jax:
{
inlineMath: [['$','$'], ['\\(','\\)']],
displayMath: [['$$','$$'], ['\\\[','\\\]']],
processEscapes: true
}
});

MathJax.Hub.Register.StartupHook("TeX Jax Ready",function ()
{
MathJax.InputJax.TeX.prefilterHooks.Add(function (data)
{
if (data.display)
{
var next = data.script.nextSibling;
while (next && next.nodeName.toLowerCase() === "#text")
{
next = next.nextSibling
}
if (next && next.nodeName.toLowerCase() === "br")
{
next.parentNode.removeChild(next)
}
}
});
});
</script>

<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML-full"></script>


Once you have that added, then instruct your users to enclose their math expressions in dollar signs (single for inline math and double for displaymode math), or alternately they can use \(\) for inline math and \[\] for displaymode math.

If you want help getting it up and running on your site, send me a PM with login credentials to a temporary admin account, and I will be able to set it up for you. :)

dmiyares
12-30-2015, 08:28 PM
Wow! Thanks for the super fast response. One of the engineers had mentioned mathjax!

-Dave