Is there a way to block indent whole paragraphs in emacs + auctex? I'm thinking in that functionality in such editors as WinEdt.

I've search in different fora, and in the available documentation, but what I've found doesn't seem to work in LaTeX mode.

  • Do you mean indented in the LaTeX source or in the rendered document? – Erik P. Nov 30 '12 at 15:59
  • The source, of course.... – NVaughan Nov 30 '12 at 17:24

Here's my assessment based on the other comments etc. Based your screen shots you have the entire paragraph as one long line and you are using visual-line-mode. That's perfectly fine except that visual-line-mode doesn't know how far to indent the wrapped lines. To do that you have to use something like adaptive-wrap-prefix-mode which is available from the GNU ELPA. Adding that to the appropriate hook should work.

The following isn't exactly how I invoke it, but I think it should work okay.

(add-hook 'text-mode-hook 'adaptive-wrap-prefix-mode)

Assuming you mean indent the source rather than indent the output,

There is indent-region (C-M-\) which will indent the region to what the mode thinks is the correct place relative to the previous line. If you want to force it you can give it a prefix argument so C-u 9 C-M-\ would indent the region to column 9.

failing that there's always

(defun foo()
(progn (mark-paragraph) (replace-string "\n" "\n     " nil (point) (mark))))

then M-x foo should indent the current para...

  • No, indent-region does nothing in my selected region. – NVaughan Nov 30 '12 at 17:45
  • My mode-line reads: LaTeX/FMP Rel Fly vl Wrap. – NVaughan Nov 30 '12 at 17:55
  • Without knowing what your selected region looks like, it's hard to know why indent-region isn't helping. You might try tabbing the first line of the paragraph over manually, then using M-q (bound to fill-paragraph) to indent and fill it to that manually-selected indentation. – Ben Lerner Nov 30 '12 at 18:15
  • A typical paragraph wouldn't normally be indent by much. Does it move if you give the prefix arguent? – David Carlisle Nov 30 '12 at 18:31
  • Only the first line of the paragraph gets indented. I was hoping the whole paragraph gets indented also (like a shift of the left margin). – NVaughan Nov 30 '12 at 19:19

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.