Here's the guide I used to map the Alt-GR key for my Danish keyboard.
First of all you should understand which keycode is assigned to which key. To do this:
# xev... and press the key you want to modify. You'll see something like "keycode XXX". For example I wan to remap "apple" as "AltGr". So I give:
# xmodmap -e "keycode 115 = Mode_switch"... that modifies things temporarily and try my setting. If everything works fine, I create in the home directories a .Xmodmap file in which I write:
keycode 115 = Mode_switch... and since I use gdm I create a file named /etc/X11/Xsession.options in which I write:
allow-user-xmodmapI save and reboot: everything works, mission accomplished.
This HOWTO was written by Frederik Heurlin Aidt, Copenhagen, Denmark