area / language-latex

Syntax highlighting for LaTeX for Atom.
Other
79 stars 47 forks source link

Feature request: auto-close math environments opened with \( or \[ #174

Closed phlippieb closed 6 years ago

phlippieb commented 6 years ago

Don't know if this necessary falls within the scope of this package, but here goes. As someone writing a document with many mathematical formulas, I would love it if, when I type \( or \[, atom would add \) or \] after my cursor, similarly to how a simple ( is often auto-closed with a ) after the cursor in other languages.

Aerijo commented 6 years ago

No, that's not something done by this package.

I believe latex-autocomplete might do it though.

phlippieb commented 6 years ago

Cool, thanks for the lead. I have latex-autocomplete installed and it does not currently do that, but I'll see if they'd be interested in adding it.

Aerijo commented 6 years ago

@phlippieb If you don't mind a manually activated autocomplete, my own autocomplete-latex offers custom completions and some common default ones. Using it, you could type $ + tab to expand to \(\), with the cursor between the brackets. Alternatively, you could define your own prefix to do this.

phlippieb commented 6 years ago

Alright, I'll give a shot. Thanks!

phlippieb commented 6 years ago

That actually works very nicely!

Aerijo commented 6 years ago

You can also override what it expands into (e.g., you might want to add spaces like this: \( \) to make the contents easier to read). Same goes for any other default completion.