I just wrote 6 paragraphs of a report without really looking at the screen, and when I did, all of my upper case letters were lower case, and vice-versa. I had left the caps lock on. Is there a one-button solution to changing that? Highlite the whole page and hit "Sitch upper/lower case? Or do you always just have to start over?
4 Answers
This is unrelated to TeX, if your (unspecified) editor can not do this, tools like tr can:
echo 'tHE WORDS ARE wrong!' | tr [:upper:][:lower:] [:lower:][:upper:]
produces
The words are WRONG!
Edit - cracked it, should now ignore commands.
**Edit 2 - now handles commands terminated by space, as well as those ending with }
.
In notepad++ (which I heartily recommend for editing .tex) I think you can do it using regex find&replace. Just replace:
(\\[a-zA-Z0-9_,\{]*[\}\ ])|([a-z])|([A-Z])
with
($1)\U($2)\L($3)
ensuring that "match case" is selected (and probably "within selection").
This should ignore commands now. If it still switches some, you may need to add more characters to the first set of brackets [character class] in the find regex.
If you've typed loads of text in with caps on, including commands, the regex is simpler - replace:
([a-z])|([A-Z])
with:
\U($1)\L($2)
Which will invert the case of all characters in the selection.
You can open your file with vim , select the text you want and press ~
on the keyboard while in normal mode. This will switch the case of all the letters.
V6j~
(vim).