定制Mathematica快捷键

34

我可以在哪里查看/更改全局快捷键选项,例如 Command + 9 (转换为输入样式)?

特别是,我需要一种更快的方法来创建项目符号列表。 它是单元格上下文菜单中的“项目”样式,没有自己的快捷键。

2个回答

34

这里有一篇不错的文章。

另外,从这里开始(未经检查):

问题: 如何修改前端以添加新的键盘快捷键? 答案: (mathgroup 2005年5月,trevor baca:)

最近我一直在 KeyEventTranslations.tr 中设置键盘快捷键,学到了前端令牌很酷的东西。这个 Wolfram 页面提供了很好的文档。

无论如何,这里有三个我不得不花费一点时间才能运行的东西(总是得到 mathgroup 的很好帮助)。

  • 对于退出内核键盘快捷键,请将以下内容添加到 KeyEventTranslations.tr:
       Item[KeyEvent["q", Modifiers -> {Control, Option}],
               FrontEndExecute[
                       FrontEndToken[
                                SelectedNotebook[ ],
                                "EvaluatorQuit",
                                Automatic
                       ]
               ]
       ]  

  • 对于初始化单元格切换键盘快捷键(从上一个线程中重复),请将以下内容添加到 KeyEventTranslations.tr:
      Item[KeyEvent["i", Modifiers -> {Command, Control}],
               FrontEndExecute[
                       FrontEndToken[
                               SelectedNotebook[ ],
                               "InitializationCell",
                               "Toggle"
                       ]
               ]
       ]  
  • 对于另存为包键盘快捷键,请将以下内容添加到 KeyEventTranslations.tr:
       Item[KeyEvent["k", Modifiers -> {Control, Option}], 
           SaveRenameSpecial["Package"]]

编辑

我发现了一个(未记录的)前端令牌完整列表。希望你能理解这些都是不受支持的!

{"AllWindowsFront", "BackgroundDialog", "Balance", "BringToFront",
"CellContextDialog", "CellGroup", "CellLabelsToTags", "CellMerge",
"CellSplit", "CellTagsEditDialog", "CellTagsEmpty", "CellTagsFind",
"CellUngroup", "Clear", "ClearCellOptions", "ClearNoAutoScroll",
"Close", "CloseAll", "CloseMain", "ColorSelectorDialog",
"ColorsPanel", "CompleteSelection", "Copy", "CopyCell",
"CopySpecial", "CreateCounterBoxDialog", "CreateGridBoxDialog",
"CreateHyperlinkDialog", "CreateInlineCell", "CreateValueBoxDialog",
"Cut", "CycleNotebooksBackward", "CycleNotebooksForward",
"DebuggerAbort", "DebuggerClearAllBreakpoints", "DebuggerContinue",
"DebuggerContinueToSelection", "DebuggerFinish",
"DebuggerResetProfile", "DebuggerShowProfile", "DebuggerStep",
"DebuggerStepIn", "DebuggerStepInBody", "DebuggerStepOut",
"DebuggerToggleBreakpoint", "DebuggerToggleWatchpoint",
"DeleteGeneratedCells", "DeleteIndent", "DeleteInvisible",
"DuplicatePreviousInput", "DuplicatePreviousOutput",
"EditStyleDefinitions", "EnterSubsession", "Evaluate",
"EvaluateCells", "EvaluateInitialization", "EvaluateNextCell",
"EvaluateNotebook", "EvaluatorAbort", "EvaluatorHalt",
"EvaluatorInterrupt", "EvaluatorQuit", "EvaluatorStart",
"ExitSubsession", "ExpirationDialog", "ExplainBeepDialog",
"ExplainColoringDialog", "ExpressionLinewrap", "FileNameDialog",
"FindDialog", "FindEvaluatingCell", "FindNextMisspelling",
"FindNextWarningColor", "FinishNesting", "FixCellHeight",
"FixCellWidth", "FontColorDialog", "FontFamilyB", "FontPanel",
"FontSizeDialog", "FrontEndHide", "FrontEndQuit",
"FrontEndQuitNonInteractive", "GenerateImageCaches",
"GenerateNotebook", "GeneratePalette", "GraphicsAlign",
"GraphicsCoordinatesDialog", "GraphicsOriginalSize",
"GraphicsPlotRangeAll", "GraphicsPlotRangeAutomatic",
"GraphicsPlotRangeFixed", "GraphicsRender", "Group",
"HandleShiftReturn", "HeadersFootersDialog", "HelpDialog",
"HyperlinkGo", "HyperlinkGoBack", "HyperlinkGoForward", "Import",
"ImportPictures", "ImportStyleDefinitions", "Indent",
"InsertClipPlane", "InsertMatchingBraces", "InsertMatchingBrackets",
"InsertMatchingParentheses", "InsertNewGraphic", "InsertObject",
"InsertRawExpression", "InsertSoftReturn", "LicAuthFailureDialog",
"MacintoshOpenDeskAccessory", "MenuListBoxFormFormatTypes",
"MenuListCellEvaluators", "MenuListCellTags",
"MenuListCommonDefaultFormatTypesInput",
"MenuListCommonDefaultFormatTypesInputInline",
"MenuListCommonDefaultFormatTypesOutput",
"MenuListCommonDefaultFormatTypesOutputInline",
"MenuListCommonDefaultFormatTypesText",
"MenuListCommonDefaultFormatTypesTextInline",
"MenuListConvertFormatTypes", "MenuListDisplayAsFormatTypes",
"MenuListExportClipboardSpecial", "MenuListFonts",
"MenuListFontSubstitutions", "MenuListGlobalEvaluators",
"MenuListHelpWindows", "MenuListNotebookEvaluators",
"MenuListNotebooksMenu", "MenuListPackageWindows",
"MenuListPalettesMenu", "MenuListPaletteWindows",
"MenuListPlayerWindows", "MenuListPlugInCommands",
"MenuListPrintingStyleEnvironments", "MenuListQuitEvaluators",
"MenuListRelatedFilesMenu", "MenuListSaveClipboardSpecial",
"MenuListScreenStyleEnvironments", "MenuListStartEvaluators",
"MenuListStyleDefinitions", "MenuListStyles",
"MenuListStylesheetWindows", "MenuListTextWindows",
"MenuListWindows", "ModifyBoxFormFormatTypes",
"ModifyDefaultFontProperties", "ModifyEvaluatorNames",
"ModifyFontSubstitutions", "ModifyNotebooksMenu",
"ModifyRelatedFiles", "MoveBackward", "MoveForward", "MoveToBack",
"MoveToFront", "New", "NewPackage", "NewText",
"NextFunctionTemplate", "NotebookMail", "NotebookMailSelection",
"NotebookOneNote", "NotebookOneNoteSelection",
"NotebookStatisticsDialog", "Open", "OpenCloseGroup",
"OpenFromNotebooksMenu", "OpenFromNotebooksMenuEmpty",
"OpenFromPalettesMenu", "OpenFromRelatedFilesMenu", "OpenHelpLink",
"OpenSelection", "OpenSelectionParents", "OpenURL", "OptionsDialog",
"PasswordDialog", "Paste", "PasteApply", "PasteApplyNoAutoScroll",
"PasteDiscard", "PasteDiscardNoAutoScroll", "PasteSpecial",
"PlainFont", "PreferencesDialog", "PreviousFunctionTemplate",
"PrintDialog", "PrintOptionsDialog", "PrintSelectionDialog",
"PublishToPlayer", "RebuildHelpIndex", "RecordSoundDialog",
"RefreshDynamicObjects", "RelatedFilesMenu",
"RemoveFromEvaluationQueue", "Replace", "ReplaceAll", "ReplaceFind",
"ReplaceParent", "Revert", "RunColorDialog", "RunEdgeColorDialog",
"RunFaceColorDialog", "Save", "SaveRename", "SaveRenameSpecial",
"ScrollLineDown", "ScrollLineUp", "ScrollNotebookEnd",
"ScrollNotebookStart", "ScrollPageBottom", "ScrollPageDown",
"ScrollPageFirst", "ScrollPageLast", "ScrollPageNext",
"ScrollPagePrevious", "ScrollPageTop", "ScrollPageUp",
"SelectGeneratedCells", "SelectionAnimate", "SelectionBrace",
"SelectionBracket", "SelectionCloseAllGroups",
"SelectionCloseUnselectedCells", "SelectionConvert",
"SelectionConvertB", "SelectionDisplayAs", "SelectionDisplayAsB",
"SelectionHelpDialog", "SelectionOpenAllGroups",
"SelectionParenthesize", "SelectionSaveSpecial", "SelectionScroll",
"SelectionSetFind", "SelectionSpeak", "SelectionSpeakSummary",
"SelectionUnbracket", "SelectNotebookWindow", "SetDefaultGraphic",
"SimilarCellBelow", "SoundPlay", "SpellCheckerDialog",
"StackWindows", "Style", "StyleDefinitionsOther", "StyleOther",
"SubsessionEvaluateCells", "SystemPrintOptionsDialog",
"TemplateSelection", "TestEvaluateNotebook", "TileWindowsTall",
"TileWindowsWide", "ToggleDebugFlag", "ToggleDynamicUpdating",
"ToggleGrayBox", "ToggleOptionListElement", "ToggleShowExpression",
"ToggleTestingFlag", "TrustNotebook", "Undo", "Ungroup",
"WindowMiniaturize", "XInfoDialog", "ZoomWindow"}

7
+10 表示内核退出!!!我多年来一直渴望这一刻,但我从未真正想过它是可能的 :) - Janus
啊,黑 KeyEventTranslations.tr 让我想起了在 Linux 上尝试让 Mathematica 3 正常工作的日子…… 那真是美好的时光。 - Timo
也许问题是与另一个操作冲突了。在 Mac 上使用 CTRL+OPTION+Q 已经类似于“检查余额”的操作。然而,这不在 .tr 文件中,在 .tr 文件中我也找不到其他显示在编辑菜单中的 Shorcut。 - Yaroslav Bulatov
@Yaro 为了让它在Win上运行,我从{Control,Option}中删除了“Option”,所以Ctrl+q可以退出内核。 - Dr. belisarius
1
此回复中的前两个链接已经失效。这可能是其中一个的修复方法:https://web.archive.org/web/20080608124549/http://www.lamberta.org/blog/mathematica-keybindings/ - gdelfino
显示剩余3条评论

7
不同类型单元格的快捷方式存储在样式表中。 选择您想要的样式并更改MenuKeyCommand MenuCommandKey值。 选项检查器中的下拉选项只允许使用1-9,但我测试过"`"和"=",它们也可以正常工作。有时使用显示表达式(Ctrl-Shift-E)修改样式表比使用选项检查器更容易。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接