4

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.

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

2 Answers 2

3

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)
0
3

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()
(interactive)
(progn (mark-paragraph) (replace-string "\n" "\n     " nil (point) (mark))))

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

11
  • No, indent-region does nothing in my selected region.
    – NVaughan
    Commented Nov 30, 2012 at 17:45
  • My mode-line reads: LaTeX/FMP Rel Fly vl Wrap.
    – NVaughan
    Commented Nov 30, 2012 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
    Commented Nov 30, 2012 at 18:15
  • A typical paragraph wouldn't normally be indent by much. Does it move if you give the prefix arguent? Commented Nov 30, 2012 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
    Commented Nov 30, 2012 at 19:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .