Live data from Hacker News

Emacs as the Ultimate LaTeX Editor

piotrkazmierczak.com

1–10 of 41 posts

Re: Emacs as the Ultimate LaTeX Editor

#2
Anyone seriously considering Emacs for LaTeX editing should also take a look at the yasnippet package. The customizable autocompletion shortcuts make it really easy to insert commands using just keywords. In my case this has proved to be very helpful especially when inserting figures or inline equations. I can create a snippet so that when I type fig+ it inserts a \begin{figure}.. \end{figure}float and positions the cursor at the proper field saving me a lot of keystrokes.

Re: Emacs as the Ultimate LaTeX Editor

#4
post #2

Anyone seriously considering Emacs for LaTeX editing should also take a look at the yasnippet package. The customizable autocompletion shortcuts make it really easy to insert commands using just keywords. In my case this has proved to be very helpful especially when inserting figures or inline equations. I can create a snippet so that when I type fig + it inserts a \begin{figure}.. \end{figure}float and positions the…

I've stopped using yasnippet because I find it too resource-intensive. It's especially noticeable on emacs-startup, even of good machines, and I've found myself not using it very often. So I decided that it wasn't worth the time.

Just as a FYI to people on weaker hardware.

Re: Emacs as the Ultimate LaTeX Editor

#5
I hate the best editor debate because I think it's distracting from what's more important — what both editors can learn from each other and what both need to do to improve. I used Emacs for years, switched to Vim because of RSI, then recently switched back to emacs+evil. Frankly, for what I do most (R, R+knitr, C++ with clang autocomplete), no single editor is great. First, there's too little ability to switch between modes within a single buffer in both Vim and Emacs. The feature's entirely lacking in Vim AFAIK, and poly-mode in R uses a high level hack that (1) doesn't play well with other modes (including evil) and (2) has so thoroughly destroyed my documents in the past I refuse to use it now (mostly because it uses many buffers behind the scenes, which destroys undo history).

In general, if you want flawless R support in certain blocks of text (as in a .Rnw file) in between LaTeX blocks that are fully connected to AucTeX, well... you're out of luck. And Vim... Vim-R-Plugin is useful, but it's sort of a painful hack to use tmux just to get R and Vim to talk (and I'm saying this even though I love Tmux).

Vim has YouCompleteMe, which is smooth as silk compared to Emac's options (which are painful and poorly integrated, especially with clang). But some lower-level issue in Vim causes this constant error message in Vim whenever YouCompleteMe uses clang — bloody annoying. So overall, both editors have huge issues that would require serious overhauls or tedious bug fixing in various modes. Sure, Emacs does AucTeX better, but until it does everything better (or Vim does everything better) it's a flawed editor. Both are flawed editors. But sadly everyone thinks the best course of action is to start fresh — which usually creates a feature-poor flawed editor on a new shiny foundation, that fails to attract developers because it's feature poor. (apologies for ranting -- jetlag).

Re: Emacs as the Ultimate LaTeX Editor

#6
post #2

Anyone seriously considering Emacs for LaTeX editing should also take a look at the yasnippet package. The customizable autocompletion shortcuts make it really easy to insert commands using just keywords. In my case this has proved to be very helpful especially when inserting figures or inline equations. I can create a snippet so that when I type fig + it inserts a \begin{figure}.. \end{figure}float and positions the…

C-c C-e fig TAB RET

C-c C-e means "give me a new environment"

Re: Emacs as the Ultimate LaTeX Editor

#7
post #4
post #2

Anyone seriously considering Emacs for LaTeX editing should also take a look at the yasnippet package. The customizable autocompletion shortcuts make it really easy to insert commands using just keywords. In my case this has proved to be very helpful especially when inserting figures or inline equations. I can create a snippet so that when I type fig + it inserts a \begin{figure}.. \end{figure}float and positions the…

I've stopped using yasnippet because I find it too resource-intensive. It's especially noticeable on emacs-startup, even of good machines, and I've found myself not using it very often. So I decided that it wasn't worth the time. Just as a FYI to people on weaker hardware.

I never really investigated why, I think it's because I use melpa as my main package repository, but yasnippet loads lazily now. This is assuming the 'old' package didn't have this set up by default.

Re: Emacs as the Ultimate LaTeX Editor

#8
post #2

Anyone seriously considering Emacs for LaTeX editing should also take a look at the yasnippet package. The customizable autocompletion shortcuts make it really easy to insert commands using just keywords. In my case this has proved to be very helpful especially when inserting figures or inline equations. I can create a snippet so that when I type fig + it inserts a \begin{figure}.. \end{figure}float and positions the…

AUCTeX has the LaTeX-environment function (C-c C-e by default) that does even better than that (inserts the figure environment, offers to center, creates a label, a caption, etc.), and also handles all environments, plus there's no need to create the snippets.

Re: Emacs as the Ultimate LaTeX Editor

#9
post #6
post #2

Anyone seriously considering Emacs for LaTeX editing should also take a look at the yasnippet package. The customizable autocompletion shortcuts make it really easy to insert commands using just keywords. In my case this has proved to be very helpful especially when inserting figures or inline equations. I can create a snippet so that when I type fig + it inserts a \begin{figure}.. \end{figure}float and positions the…

C-c C-e fig TAB RET C-c C-e means "give me a new environment"

Sure Auctex does provides kb-shortcuts. But rather than using predefined keystrokes, I prefer to use my own. Besides, snippets can be used for commands/environments for which AucTex provides no shortcut or for things such as macros.

Re: Emacs as the Ultimate LaTeX Editor

#10
post #4
post #2

Anyone seriously considering Emacs for LaTeX editing should also take a look at the yasnippet package. The customizable autocompletion shortcuts make it really easy to insert commands using just keywords. In my case this has proved to be very helpful especially when inserting figures or inline equations. I can create a snippet so that when I type fig + it inserts a \begin{figure}.. \end{figure}float and positions the…

I've stopped using yasnippet because I find it too resource-intensive. It's especially noticeable on emacs-startup, even of good machines, and I've found myself not using it very often. So I decided that it wasn't worth the time. Just as a FYI to people on weaker hardware.

My main gripe with yasnippet is that its feature list is pretty lackluster compared to some advanced vim snippet plugins like xptemplate.[1]

xptemplate has a bazillion features, and yasnippet is primitive in comparison. Just a simple example is that in xptemplate (and probably any respectable snippet plugin in vim) you can type a part of a snippet name, hit TAB, and it will expand the snippet whose partial name you typed (assuming there's no exact match). In yasnippet, you have to type out the full snippet name before it can be expanded. This is pretty annoying, especially for long snippet names.

There are tons of other examples of far more advanced functionality, such as a variety of snippet repetition and embedding features.

This comparative lack of features in yasnippet is pretty surprising, because emacs extensions are usually very feature rich, and everyone seems to love yasnippet. But I think that's because most emacs users don't know what they're missing.

And before someone says it, yes, I know yasnippet gives you the ability to embed eLisp code in it, so I could potentially write all the functionality I need myself. But that's really beside the point. I'm talking about built-in features, not the ability to code up the features myself.

[1] https://github.com/drmingdrmer/xptemplate

Post reply on HN