[Mathjax Help]: How to make Mathjax stay within bounds of template?

Please see attached image (and don’t mind the nonsensical equations in the pic, I just double-pasted them to demonstrate my issue).

When equations get a bit longer, Mathjax often goes out of bounds of my template. This occurs on both desktop and mobile.

So I was wondering whether there any way to limit the width of Mathjax equation on a card automatically? Couldn’t find an answer by search, so I am posting here.

If you google “mathjax text wrapping” you’ll find some answers you can try, e.g. html - MathJax word wrap - Stack Overflow

Try something like this in your template (not tested):

<script>
MathJax.config["HTML-CSS"] = {
	linebreaks: { automatic: true, width: "container" }
}
if (typeof is_already_run == 'undefined') {
  is_already_run = true
  MathJax.startup.getComponents();
}
</script>

Reference: Customizing MathJax - Frequently Asked Questions

Thank you for your reply! Unfortunately I think that link is outdated, and your script did not work for me. I tried googling Mathjax text wrapping, but haven’t found a solution yet. I’d appreciate any help.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.