# Can we get a $\LaTeX$ button?

I would like to propose the addition of a $\LaTeX$ button. It would be very similar to the "code" button that formats the highlighted text into code, the $\LaTeX$ button would surround the highlighted text in $....$. This would make life a lot easier when you are editing posts.

EDIT:

I am thinking about building a very small java application for the time being that will allow you to press, for example, CTRL +1 and it will surround the text in $..$. Will people be interested in using such an application?

• I'd go even further and request a nice keyboard shortcut as well. If it's not too much trouble to add to the system, of course... – J. M. isn't a mathematician May 19 '13 at 15:21
• @J.M. Yes, definitely. If this feature is implementable then a keyboard shortcut would also make a lot of sense. – Jeel Shah May 19 '13 at 15:28
• Shift + (4 4) - it's in my blood. – Git Gud May 19 '13 at 16:48
• Could this not be solved by a browser plug-in? (Which would, of course, be required to be written by someone. However, if what @75064 points out is true, that "this idea [won't get] any further than "Type: Enhancement | Status: New | Priority: Low" on the Pagedown issues list", then this seems like the only solution...) – user1729 May 20 '13 at 12:18
• @user1729 Browser plug-in ... That is a very good idea. I hadn't thought about that. Maybe if the answer suggested by 75054 doesn't get "chosen" then we can opt for that. – Jeel Shah May 20 '13 at 15:20
• This has an added benefit of alerting new users to the existence of $\LaTeX$. – apnorton May 21 '13 at 15:22
• I prefer typing the dollar signs explicitly. This doesn’t mean that it shouldn’t be done; it just means that I see no need for it and wouldn’t use it. – Brian M. Scott May 23 '13 at 22:54
• @J.M. I have one. MIDI Keyboard + Max/MSP or Bome's MIDI Translator. – Billy Rubina May 25 '13 at 15:05

I like the idea. When entering a long post with many formulas, the constant re-rendering of MathJax can be a drag on the browser; in such cases it is preferable to type formulas first and add  later. Having a button/shortcut for this would be handy. Ideally, it would loop between text, $text$, and $$text$$, like the current Ctrl+I shortcut loops between text and *text*.

Drawing in an extra button takes a designer's effort but is not a big obstacle: button images differ between sites already. For example:

Math.SE editor buttons

Travel.SE editor buttons

The bigger deal is the script that handles the button clicks and keyboard shortcuts, along with all Markdown processing. It currently stands at $2459$ lines of JavaScript code named wmd.js (not WMD). Officially called Pagedown, it is being developed by SE as an open-source project. At some point of its history, it was reverse-engineered from seemingly abandoned obfuscated code (the original author could never be contacted again). See:

The editor is the same on all SE sites; maintaining separate versions would be rather painful, I imagine. But there is no need for that; the script can determine if the site has MathJax enabled, and activate the button and shortcut in this case only:

if (StackExchange.mathjaxEditing) { enable $button and shortcut } Done! :) And it's now$2460\$ lines of code.

• That said, I'll be surprised if this idea gets any further than "Type: Enhancement | Status: New | Priority: Low" on the Pagedown issues list. – 75064 May 20 '13 at 6:52
• If that is the case then do you think there is a way to create some sort of plugin in Firefox/Chrome? – Jeel Shah May 21 '13 at 14:17