Org-mode has a magical org-src-fontify-natively setting. With this on, org highlights each code snippet using the corresponding mode's font-locking support.

Can I use this in LaTeX-mode? It would make editing small snippets in lstlistings environments much nicer! By default, AucTeX highlights code snippets uniformly.

  • There are a number of solutions to achieve this kind of local fontification, more or less easy to adapt to your settings. This question addresses the same problem for web mode, maybe it contains pointers: stackoverflow.com/q/4462393/1083706 Personnally I resorted to using \lstinputlistings. – T. Verron Oct 12 '16 at 8:06

Your Answer

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

Browse other questions tagged or ask your own question.