[OS X TeX] customizing menu shortcut keys in TeXShop
Charles Chapman Pugh
pugh at Math.Berkeley.EDU
Wed Jun 8 14:01:50 EDT 2005
Hello.
In the help files for TeXShop 2.03, there are directions for
customizing the menu shortcut keys. You go the file
KeyEquivalents.plist whose location is
~/Library/TeXShop/Menus/KeyEquivalents.plist
and then you modify it, save the result, and that should do it. An
example is given in the KeyEquivalents.plist file, which is indeed
located as it should be. The example is commented out because it is
a "crazy redefinition," which among other things removes the keyboard
command Apple-W from the close operation in the file menu.
Well, after trying to emulate the example file, I got no change in
the menus or shortcuts, so, as an experiment, I duplicated the crazy
part and removed its commenting-out brackets, saved the result, quit
TexShop for good measure, started it back up, opened a file, and the
menus were unchanged. Apple-W still closed things up.
What am I missing?
Best, Charles Pugh
Here is what the KeyEquivalents.plist file looks like after the
changes I made.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://
www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<!--
Advanced users can replace TeXShop's default keyboard menu
shortcuts with their
own customized versions using this file. This file must be named
"KeyEquivalents.plsit"
and live in the folder ~/Library/TeXShop/Menus.
The structure of this file is as follows. At the top level, we
list the items
in the main TeXShop menu: TeXShop, File, Edit, Format, etc. We
need only list
menus containing items whose key equivalents we want to change.
Below each
top level menu is a dictionary containing items in this menu
whose key equivalents
are to be changed. Again, we need only list items to be changed.
If such an item is a submenu, then the item is followed by a
dictionary listing
the items in the submenu. Otherwise, the item is followed by an
array to be described
in the next paragraph. TeXShop has no submenus of depth larger
than one.
The first element of the array is the character giving the key
equivalent
of the menu item. This character can be a lower case or upper
case character. For instance, it
could be "c" or "C". (On the menu display, it will be
capitalized, and an extra shift character
will appear for capitol letters.) The next array element is
"true" if the option key
should be down and "false" otherwise. The final array element is
"true" if the control
key should be down and "false" otherwise.
In this file, menu items can be identified by a string
containing the menu contents,
or by a string with an integer listing the menu location. For
example, the "Open" item
in the "File" menu can be identified as <key>Open</key> or as
<key>6</key>. Notice that
the first item in a menu is numbered "1" rather than "0".
Similarly the main
menus across the top of the screen can be listed by name or
number. The Apple menu does
not count, so "TeXShop" is <key>TeXShop</key> or <key>1</key>,
"File" is <key>File</key>
or <key>2</key>, etc.
The advantage of names is that they are easier to read. However,
the names refer to
whatever localized version is running when the program starts,
so if TeXShop has
modified menu key equivalents in German, these equivalents will
not remain when
it is run in English.
The advantage of numbers is that the configuration then works in
all languages.
However, if a new version of TeXShop appears with menu items in
different locations,
this file will need to be modified.
If a key command is added to a menu item but it is already being
used elsewhere, the
command will not "take." In that case, the other command must be
removed or changed.
To remove a command, write the first array element as <string></
string>. The order
of these operations does not matter, so a key command can be
assigned to a new
menu item at one spot in this file, and later removed from its
original item.
Below is an example to show how this works. The example
implements a crazy redefinition:
the key equivalent W is removed from the Close menu, and
Comment, Uncomment, Indent,
and Unindent items are assigned X, Y, Z, W with various
combinations of option and
control keys. Since nobody would actually want to do this, the
example is commented out;
use it as a guide and add similar definitions which are not
bracketed inside the
comment symbols <!-- and -->
-->
<!--
<dict>
<key>File</key>
<dict>
<key>6</key> <!-- Close -->
<array>
<string></string>
<true/>
<true/>
</array>
<key>10</key> <!-- Revert To Saved -->
<array>
<string></string>
<false/>
<false/>
</array>
</dict>
<key>Edit</key>
<dict>
<key>Find</key>
<dict>
<key>1</key> <!-- Find... -->
<array>
<string>u</string>
<false/>
<false/>
</array>
</dict>
</dict>
<key>4</key> <!-- Format -->
<dict>
<key>Comment</key>
<array>
<string>X</string>
<true/>
<false/>
</array>
<key>Indent</key>
<array>
<string>Z</string>
<false/>
<true/>
</array>
<key>Uncomment</key>
<array>
<string>y</string>
<true/>
<true/>
</array>
<key>Unindent</key>
<array>
<string>w</string>
<false/>
<false/>
</array>
</dict>
</dict>
</plist>
-->
<dict>
<key>File</key>
<dict>
<key>6</key> <!-- Close -->
<array>
<string></string>
<true/>
<true/>
</array>
<key>10</key> <!-- Revert To Saved -->
<array>
<string></string>
<false/>
<false/>
</array>
</dict>
<key>Edit</key>
<dict>
<key>Find</key>
<dict>
<key>1</key> <!-- Find... -->
<array>
<string>u</string>
<false/>
<false/>
</array>
</dict>
</dict>
<key>4</key> <!-- Format -->
<dict>
<key>Comment</key>
<array>
<string>X</string>
<true/>
<false/>
</array>
<key>Indent</key>
<array>
<string>Z</string>
<false/>
<true/>
</array>
<key>Uncomment</key>
<array>
<string>y</string>
<true/>
<true/>
</array>
<key>Unindent</key>
<array>
<string>w</string>
<false/>
<false/>
</array>
</dict>
</dict>
</plist>
--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
& FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>
More information about the MacOSX-TeX
mailing list