Take the 2-minute tour ×
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
add comment

4 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
add comment

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
add comment

For me, LaTeX source is, well, source. I got accustomed to cut lines at "logical points" (after punctuation, keep a phrase together on a line, ...). It helped me to catch errors like "an dog" or "a animal" or even "the the phrase". Splitting the text this way, and using indentation to reflect structure, makes longer text source much more readable. It also makes much editing of the text be shuffling lines around, and editors have good commands for that.

Later I came to use version control heavily, and there having changes be mostly lines added/deleted wholesale, not a full paragraph replaced just because a word was added to a line, becomes essential when the text (and its history) grow.

For the same reason you don't fill your C code, don't fill LaTeX.

share|improve this answer
    
You should clarify paragraph 2, only people using a VCS can make sthg out of it at present. –  Joce 7 hours ago
    
@Joce, sorry I don't see how to enhance it. Feel free to edit. OTOH, somebody who doesn't use VCS won't understand anyway... –  vonbrand 7 hours ago
1  
Well, let’s make it dead simple then: Changes are tracked on the line level. Without line breaks, any modification in a long paragraph would result in a needlessly large and confusing changeset. If it’s just one sentence per line, this problem can be avoided. –  Daniel B 6 hours ago
add comment

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
add comment

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.