MathJax and QuickTex options in editor

Is it possible to add to the text editor a MathJax text wrap for easy math equation writing?

For example, I’d like to be able to highlight text that should be in LaTex and then click on an icon in the text editor that would wrap the text with $latex and $ or [latex] and [\latex] to turn it into MathJax mode. Or, even better, use a keybord shortcut to enter $latex.

It is super time consuming to have to write $latex or [latex] for every math text when creating a math textbook.

If there is a way to do this before Pressbooks is able to act on it, can you share your wisdom? Please keep in mind I am not a coder and thus the lingo needs to be aimed at a peasant.

Hi Ana, that’s a great suggestion! I’ve created a feature idea and have added it to our backlog: Add LaTeX button to visual editor · Issue #383 · pressbooks/ideas · GitHub. Unfortunately, the only way to do it yourself would be with coding. Here’s how we added the ‘footnote’ button that this feature will likely be modeled on: pressbooks/footnote.js at dev · pressbooks/pressbooks · GitHub, in case that’s helpful?

1 Like

@Ana We added this feature to our latest release. You should be able to add [latex] [/latex] shortcodes to new or existing content by clicking the LaTeX button we’ve added to the visual editor, as shown in this short video: https://youtu.be/8Du4ilDjcYY. Thanks for the suggestion!

Thank you and for such a speedy action, too! This has been working fabulously, it is saving me a ton of time.

Do you know if there is a way I can make a keyboard shortcut for the LaTex button (as Ctrl+b is for bold, say)?

@Ana these custom buttons don’t have default keyboard shortcuts, unfortunately. I’m not sure if/how they can be added, but we’ll look into it! I’m really glad the new button has at least been a time saver for you.

That’s fine! What I was asking was for a cherry on top, but can live without it, for sure :smiley:

1 Like

@ana We created a new issue to track and hopefully fix this for you in future release. You can follow its progress here: https://github.com/pressbooks/pressbooks/issues/2384