5
$\begingroup$

How would I define, say < and >, or the left arrow key and right arrow key as keyboard shortcuts for moving forward and backward in slideshows?

$\endgroup$
6
$\begingroup$

Evaluate one line once inside the notebook (or creating a button) will do:

SetOptions[InputNotebook[], 
 NotebookEventActions :> {{"KeyDown", ">"} :> 
    FrontEndTokenExecute["ScrollPageNext"], {"KeyDown", "<"} :> 
    FrontEndTokenExecute["ScrollPagePrevious"]}]

or, using left and right arrows, but a bit more trickery to preserve normal arrow behaviour in the "Working" environment:

    SetOptions[EvaluationNotebook[], 
  NotebookEventActions :> {"RightArrowKeyDown" :> 
     If[CurrentValue[SelectedNotebook[], ScreenStyleEnvironment] =!= 
       "SlideShow", 
      SelectionMove[SelectedNotebook[], Next, Character], 
      FrontEndTokenExecute["ScrollPageNext"]], 
    "LeftArrowKeyDown" :> 
     If[CurrentValue[SelectedNotebook[], ScreenStyleEnvironment] =!= 
       "SlideShow", 
      SelectionMove[SelectedNotebook[], Previous, Character], 
      FrontEndTokenExecute["ScrollPagePrevious"]]}];

Interestingly enough the PageUp and PageDown keys always are already defined to navigate forward and backward, but one sometimes wants other keys in order to use a programmable (air)mouse.

$\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.