TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am absolutely new to Emacs and lisp, but I am considering a possibility to start using it for LaTeX code editing.

What I have learned about Emacs (and it fascinated me) is that it has almost unlimited possibilities to modify it according to your needs. Before jumping into learning progress I need to clarify few things. One of the most important features that I need for my editor is possibility to create advanced highlighting schemes. Part of my work is rewriting LaTeX code to make it suitable for certain type of conversion to HTML. Visual emphasis of some parts in the code makes my work much easier. So the questions are:

  1. Is it possible in Emacs, to highlight certain commands only if they are in some kind of environment?
  2. Can I define highlighting priorities in case they overlap.
  3. Can I tell Emacs to highlight certain phrases only if they follow after some set (containing symbols or words)?
  4. Can I define different highlighting modes for math and text modes?
share|improve this question
Without reading the question I am sure the answer is yes to all. – percusse Nov 3 '12 at 11:50
Take a look at AUCTeX, maybe you should swing by emacswiki.org and take a look – Munken Nov 3 '12 at 12:49
The first two comments to your question answer it pretty well. 1. Yes (or at least probably) all these things are possible with some use of Elisp. 2. Definately investigate AUCTeX. – verdammelt Nov 3 '12 at 19:50
I agree with all the comments above. Emacs and Lisp are a pathway to many abilities some consider to be... ekhm... unnatural. – mbork Dec 17 '12 at 13:15

I tend to answer in the way radio Yerevan used to answer:

Yes, this seems perfectly possible. You just have to learn elisp (500 pages manual...). Besides that, if you give Emacs a try, write your functions in a way that does not interfere with AUCTeX.

Ok, my message is: What can be done by coding elisp, is possible.

share|improve this answer
Joking aside, this shouldn't also be that difficult. Depending on your programming background, you might want/need to read the "An Introduction to Programming in Emacs Lisp" or not (which is rather a light read), and then follow with elisp manual, reading through .el source code files (installing all of them is a must!) and asking on stackoverflow or elsewhere. A good advice I got some time ago is to start with emacs mode or command doing something similar to what you want to achieve, and tinker with it. You will be addicted before you can notice it;). – mbork Dec 17 '12 at 13:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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