Thursday, May 24, 2007

Two minor editor enhancements

Only for BibTeX and NEdit users: you probably know that the bibliography style often lowercases your texts for titles. This is not what you want in the following case:
An hllc riemann solver for magneto-hydrodynamics
You need to put braces around parts that should not be changed, i.e., in BibTeX form:
An {HLLC} {R}iemann solver for magneto-hydrodynamics
Put the following piece of code in your ~/.nedit/nedit.rc configuration file for NEdit.
nedit.macroCommands: \
...many built-in macros...
      }\n\
      BibTeX capitalise:Shift+Ctrl+U:c:R: {\n\
              replace_in_selection("([A-Z]+)", "\\\\{\\\\1\\\\}", "regex")\n\
      }\n
nedit.bgMenuCommands: \
After typing a title, just select it and press [Ctrl]+[Shift]+[U]. It will enclose all uppercase parts inside braces. Not much special about it, but handy it is. Oh, and whilst you have your configuration file open, also add this:
        Comments>% Comment@LaTeX:Shift+Ctrl+C:c:R: {\n\
                replace_in_selection("^.*$", "%&", "regex")\n\
        }\n\
        Comments>% Uncomment@LaTeX:Shift+Ctrl+Alt+C:u:R: {\n\
                replace_in_selection("(^[ \\\\t]*%)(.*)$", "\\\\2", "regex")\n\
        }\n\
When editing a LaTeX file, select some complete lines, press [Shift]+[Ctrl]+[C] and you'll have the entire block commented by % characters. Include the [Alt]-key to uncomment.