Hacker News new | ask | show | jobs
by hyperpallium 2949 days ago
OK, so the whole system is: type in latex, becomes unicode text, finally rendered as symbols (e.g. in a pdf). Except that with that atom package, you needn't type the whole latex, because it autocompletes.

BTW what is that kind of completion called (i.e. where it doesn't just complete, but also replaces it with something else); and is something like that available for vim - or for rlwrap? (I searched, but "completion" brings up all the standard vim completion modes). EDIT vim has "abbreviations", but the no built-in automcomplete mode for them (though you could also put them in a file, and have completion scan that file - or write your own).

A "desugarTeX" could transform an existing latex doc into a unicode version, which could still be used as a source document, via sugarTeX. Arguably, this desugarTeX is kinda sorta like an output format of latex (like pdf or dvi), except that it's also machine readable as latex input.

4 comments

Not really. With that package you can type in LaTeX. But it's inherited behavior.

I myself prefer type `\^:` to get vector superscript symbol, type `\^->` to get another vector superscript symbol. Type:.\rot`to get matrix superscript symbol. Type `\-->` to get long arrow.

But yes, type `\\` to get broken vertical bar that's a new newline symbol, type `\&` to get small sing below that later again converts to `&`.

I think you started with something simple, but quickly found you needed to add features for it to work properly for you - and I'd guess it is more-or-less complete for your use-case now. The documentation is a reference for all the features. But it's difficult for a newcomer, to see the full complexity of the end-product, first.

Echoing the root of this thread, I think a tutorial would help, covering the simplest and most common features first (and the ones that work most neatly and elegantly). I'd suggest, for every example, have three parts, in the order a user would experience them:

  1. user-entered shortcut  e=mc\^2
  2. unicode appearing      e=mc²
  3. an image of pdf
I'd omit the actual latex from this tute, because the user never actually sees it...
Yep, this initially started as Pandoc filter that iterates over math elements and applies regex replacing. Then I switched to Panflute to iterate over math easier. And eventually added {, } counter with left, right and center regex patterns for binary math operators.
Snippets perhaps? Something like https://github.com/SirVer/ultisnips may be useful here. It's got completion and replaces with templates (with some other powerful things too)
I'd better call it 'TeX-Sugarer', though. And yes it's possible to create it to import LaTeX to SugarTeX.

SugarTeX completions is forked from latex-completions Atom package. I haven't seen something like this before.

It's very cool, especially combined with your sugarTeX idea. I believe your abbreviations are faster for an expert; but using widely-known latex makes it more accessible to new adopters. They can shift to your expert shortcuts later!
Yep, such examples are needed...

BTW: `mc\^2` gives mc²