Dear All, I have a problem that I'd been thinking about for some time.
I don't think it can be done. Nevertheless, I'll post it. When such problems have been posted in the past, they have generated brisk exchanges and much corrosive sarcasm. OTOH, if a solution is found, it could be very useful... I've been given a text document, to be set in LaTeX. I use vi as an editing language. There are a lot of sections in it. The section headings take up one line only. I'd like a command that would put in the section command and capitalize the leading letters of all words in a line that are *not* of one, two or three letters. However, the first word in the line, regardless of the number of letters *must* have a leading capital. For example, the line:--- A quick armadillo and a dead goat becomes \section{A Quick Armadillo and a Dead Goat} (I do not wish to know that words shouldn't be capitalized thus for a heading: my orders come From Above.) A (very) partial solution would be:--- :.,.s/^\(.\)\(.*)/\\section{\U\1\2}/ which, in bits, is:--- :.,. command, for this line s/^\(.\) remember the first character for later substitution \(.*\) remember also the rest of the line for later substitution /\\section{ begin the substitution with \section{ (\\ because the backslash is a magic) \U\1 the uppercase version of the first character \2}/ followed by the rest of the line and a curly bracket. As I said, very partial. The one, two and three letter words are what's the matter. My own thinking would be not to specify them, but to specify four and above with the first letter remembered: something like \<\(.\)...*\> Can anyone improve on this? Regards, Bill Bennett. -- SLUG - Sydney Linux User's Group - http://slug.org.au/ More Info: http://lists.slug.org.au/listinfo/slug