0

I am switching to AUCTeX as my LaTeX editor and need tab-aware automatic line wrapping. From this question on stackoverflow I gathered that adaptive-wrap is basically what I need.

How can I make adaptive-wrap aware of Tab-indentation?

On GitHub I already found this 'fork' of adaptive-wrap and this code to get Tab-awareness. Since I don't know any Elisp, I'm not sure these are safe to use with GNU Emacs 24.5.1.

Note that I cannot manually switch everything to space-indented code, as my current project is already very large.

  • 1
    you can automatically switch every file you edit to space-indented adding the following to your .emacs (add-hook 'LaTeX-mode-hook (lambda () (untabify (point-min) (point-max)))) – matteol Mar 10 '18 at 16:25
  • 1
    Can you please elaborate what you mean by tab-aware automatic line wrapping and add some code showing the starting point and the desired result? – Arash Esbati Mar 11 '18 at 8:03
  • It simply means I want adaptive-wrap to work with tab indentation, which it does not. Just open any tab indented piece of TeX code and enable visual-line-mode and adaptive-wrap-prefix-mode and you'll see. – Christoph90 Mar 11 '18 at 8:31
  • I actually followed @matteol's comment for converting tabs to spaces to circumvent the issue, which seems to be a safe operation. – Christoph90 Mar 11 '18 at 8:34
  • If it's about turning tabs into spaces, you can use the variable TeX-auto-untabify provided by AUCTeX and customize it to t. AUCTeX then converts all tabs in your buffer into spaces when save your file(s). – Arash Esbati Mar 11 '18 at 9:01

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.