7
$\begingroup$

There are several keyboard shortcuts that do not seem to work for me. I am using a German keyboard. I think this only happens when I have to use a modifier key that does not have to be used in case of a US keyboard.

Example: One can comment/uncomment code by pressing the shortcut "Alt+/". However, on the German keyboard, the "/" sign is on the 7-key and reached by pressing "shift-7". So, I will have to press "Alt-Shift-7", which Mathematica does not recognize as Alt-/.

There are other examples where a certain symbol needs Shift or Alt-Gr to be reached; in each case the shortcut does not work.

Any ideas to make all this work also for the German keyboard layout, short of changing the actual shortcuts?

$\endgroup$
  • $\begingroup$ Any particular reason you eliminate changing the actual shortcuts as a solution? $\endgroup$ – Mr.Wizard Feb 13 '15 at 20:38
  • $\begingroup$ @Mr.Wizard I guess it would require changing the KeyTranslations File, and I would actually have to think about which shortcut I want to choose... However, there might be a ready-to-use version? Then it would be fine. $\endgroup$ – Thomas Feb 13 '15 at 20:56
  • 1
    $\begingroup$ The same happens with Brazilian Keyboard. I haven't problem because I use Mac. But my team has problem to comment code. They created some strange windows macros to make it works. It would be nice to have a more standard solution. $\endgroup$ – Murta Feb 13 '15 at 21:14
3
$\begingroup$

In Windows one solution is to use the key combo

Alt + E + O

This effectively accesses the Edit menu and the Un/Comment command. However, this does not work in full screen mode.

If this bothers you, then the best option is probably to write an AutoHotkey script.

Here is the script that I have been using

#IfWinActive, ahk_class NotebookFrame 

!c::
    ClipSaved := ClipboardAll
    Clipboard = 
    Send ^c
    Clipwait, 1
    StringLeft, OutputVar, Clipboard, 2 

    if(OutputVar = "(*") ; If commented we uncomment
    {
        StringTrimLeft, OutputVar, Clipboard, 2  
        StringTrimRight, OutputVar, OutputVar, 2
        Clipboard := OutputVar
    }
    else ; Else we comment it
    {
        Clipboard := "(*" . Clipboard . "*)"
    }

    Send ^v
    Clipboard := ClipSaved
return
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.