Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

So, maybe I missed something completely when I started using Latex, but I have a difficult managing newlines in the Latex source. I have to put hard returns at the end of lines because even powerful editors like Emacs or Vim don't seem to manage that (at least out of the box).

For example, if I have the following paragraph in my Latex file:

So, maybe I missed something completely when I started using Latex,[\n]
but I have a difficult managing newlines in the Latex source. I have[\n]
to put hard returns at the end of lines because even powerful editors[\n]
like Emacs or Vim don't seem to manage that (at least out of the box).[\n]

But then I want to add a the parenthetical "but, not newlines in the Latex output" to the second line so then I get something like this:

So, maybe I missed something completely when I started using Latex, [\n]
but I have a difficult managing newlines in the Latex source (but, not newlines in the Latex output). I have [\n]
to put hard returns at the end of lines because even powerful editors [\n]
like Emacs or Vim don't seem to manage that (at least out of the box).[\n]

Assuming that before I insert the phrase, the lines we at the 80 character boundary, I get rather unmanageable soft line wraps. When this happens, the act of pushing the 'down' arrow brings me to the same column in the next line, completely ignoring the soft line breaks.

What am I missing?

share|improve this question

3 Answers

up vote 2 down vote accepted

I'm not certain I understand what you are asking, but it is possible that longlines-mode in emacs will gve you the behavior that you want.

share|improve this answer
Ah. Yeah that's it. LongLines of AutoFillMode. Thanks. I'm somewhat new to emacs, and I don't have any emacs wizards I can just walk up and ask anymore :\ – Jeremy Powell Nov 18 '09 at 2:46

If I read your question right, this has nothing to do with LaTeX other than you happen to be editing LaTeX source?

If you want to tell vim to wrap lines at, say, 78 characters:

:set tw=78

If you want to do this for all .tex files, add the following command to your .vimrc:

autocmd BufRead *.tex set tw=78
share|improve this answer
yeah. that's pretty much what I need; I wasn't really thinking that there's a more global solution. I guess its been a longer day than I thought.. – Jeremy Powell Nov 18 '09 at 2:47

In emacs, with Autofill mode M-x auto-fill-mode, you can M-q and emacs formats the text as you want it.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.