Adding Latex to questions

Solved4.78K viewsGeneral
0

Hello,

I would like to allow the user to enter Latex in their questions and answers

To get mathjax to compile Latex with the AskBug Theme, I’ve entered

function mathhead(){
echo <<<CSS
<script type=”text/x-mathjax-config”>
MathJax.Hub.Config({
tex2jax: {
inlineMath: [[”$”,”$”]]
}
});
</script>
<script type=”text/javascript”
src=”https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML-full”>
</script>
CSS;
}
add_action(‘wp_head’, ‘mathhead’);

in the functions.php file.

This works, but not all the way:

 

For some reason the character “\” is being removed when a user asks a question in the text editor. Why is this?

selected answer
1

Hello,

I made a fix to deal with this issue. But you cannot apply fix on your live site. I request you to manually remove

wp_unslash

from this line:

https://github.com/anspress/anspress/blob/b7559f3c6525b94d1cde6c3b88637e31892003c4/includes/ask-form.php#L340

from your local file.

Lemme know.

selected as best answer

Great! Problem Solved! Thanks

You are viewing 1 out of 1 answers, click here to view all answers.