Ok, it seems there’s a bug in ubuntu 9.10 (and maybe earlier) with the apple macbook keyboard. The goal should be to map the right command (apple) key as ALT-GR.
A simple workaround is getting to System->Preferences->Keyboard. Select the Layout tab and layout options. Then select the key to choose 3rd level and enter on keypad. Now you can use the enter key (just beside the right apple key) as ALT-GR.