2

I've got #+OPTIONS: tex:t and #+STARTUP: entitiespretty at the top of my org file, however, this seems to allow only a subset of Latex. For example, typing \rightarrow embeds upon the last keystroke a → just fine. But if I try a \vdash (⊢) I get nothing. \vdash just sits there.

So I looked around and found this, which seems to be an Emacs-wide solution (per buffer). (set-input-method 'TeX) in fact does recognize \vdash and converts it instantly to ⊢. Another curiosity is how I put \vdash inside an emacs-lisp code block -- while set-input-method is still active -- and it worked, and it saved it, and it exported to HTML just fine. Typically, being in a code block means Latex markup either won't display, or if it does, it won't export.

I then tried to use ⊢ as a symbol

(set-input-method 'TeX)
(setf ⊢ t)
(defun foo ()
  (if ⊢ 1 2))
(foo)
    => 1

I'm guessing this is utf-8 lore, and Emacs will work with a utf-8 "character" just as if it were old-school ascii. set-input-method seems to have permanently replaced the Latex markup code. Is this correct? Also, why is org mode incomplete at in-buffer Latex substitutions while set-input-method with TeX is more complete? Which is the better choice?

2

There's a couple questions you asked, but I'll cover what I can. Org translates some names beginning with \ into "prettified" versions, as defined in the variable org-entities, and org-entities-user. These define translations for html, latex, and other encodings. I would speculate that more options aren't included since either they aren't commonly used, or have no simple equivalent when exported without latex.

Second, the setting input method to 'TeX allows "LaTeX-like input method for many characters. These characters are from the charsets used by the utf-8' coding system, including many technical ones. Examples:\n \\'a -> á \\{a} -> à\n \pi -> π \int -> ∫ ^1 -> ¹" (As described in the variable input-method-alist.) So basically, this is an easy way to enter unicode characters using latex syntax. So, for example \frac12 = ½, but \frac79 doesn't have a unicode equivalent, so it doesn't work.

There's a third option in org-mode, you can use the usual $$ and [] symbols to set up a math environment, which allows full latex syntax, and will even render it as an image (or using mathjax) for html export.

So, to sum up, there are some special names in org-mode beginning with \ that are translated into an appropriate character for the exporter being used. If you need full latex syntax, use a math environment, and it will even be nicely formatted when exporting to non-latex formats. Lastly (set-input-method 'TeX) can be used anywhere to enter unicode characters using latex syntax.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.