I want to highlight text regions in my Emacs/AUCTeX/LaTeX document in a "textmarker style". Furthermore, the highlighting should save permanently. These features are provided by highlight.el and enriched-mode, which works fine with plain text file.

However, this doesn't work for LaTeX files *.tex, where I could not select text properties any more.

How can I combine text highlighting with AUCTeX?


Using enriched-mode won't work since it actually saves the file in a different format—one that would prevent latex from working. Try M-xfind-file-literallyRETpath/to/enriched/mode/fileRET and you will see something like

Content-Type: text/enriched Text-Width: 70
<x-color><param>royalblue4</param>"Return the start and end of the
region as a list, smallest first.  If the region is empty or not
active, then bob and eob are used."</x-color>

If you want things highlighted systematically it can probably be done with font-lock-add-keywords, but if it's entirely arbitrary you would have to write a system that saves another file containing markers and then reads them in on file open and performs the highlighting. It's not impossible but as far as I know, noone has done it yet. See this stackoverflow question.

The question I think is really, what are you trying to accomplish. If it's drawing attention to an area that needs help for example then maybe adding a comment % TODO: description together with something like fic-mode (which I have never used) would be the best option. With a little more work you could even have it highlight the entire next sentence or something.


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.