I rarely find myself asking questions since about everything has already been answered somewhere; not this one though.

I use Emacs 25.3.2 with AucTeX 12.1.1 on Ubuntu 16.04 and for a while now, whenever I enable TeX-Folding (invoking TeX-fold-buffer), the display string for folded elements (citations, refs and, footnotes) are followed by visual newlines (see screenshot link).

This also affects my custom display strings, which do not contain newline chars;

the problem is therefore not due to the string containing new line chars, but to some quirk in how folding is applied.

I have no clues how to investigate this any further… any ideas?

Many thanks and all the best!

screenshot here: http://www.phylax-computerkunst.de/download/auctex_folding_error.png


This is a known issue in AUCTeX and was fixed here. Please follow the advice in this message and see if it works for you. If it solves the issue, you can put something like this in your init file until the next release of AUCTeX:

(with-eval-after-load "tex-fold"
(defun TeX-fold-overfull-p (ov-start ov-end display-string)
  "Return t if an overfull line will result after adding an overlay.
The overlay extends from OV-START to OV-END and will display the
     (goto-char ov-end)
     (search-backward "\n" ov-start t))
   (not (string-match "\n" display-string))
   (> (+ (- ov-start
              (goto-char ov-start)
         (length display-string)
         (- (save-excursion
              (goto-char ov-end)
  • Thanks for pointing me to that solution… don't know why didn't come across that in my initial research… Anyway, some redundancy on the web is not necessarily a bad thing. Everything works as it should know, so thanks again! – Phylax Jun 26 '18 at 22:03

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.