Skip to main content
added 2 characters in body
Source Link
Sjoerd Smit
  • 24k
  • 46
  • 76
boxOpts = {BaseStyle -> {}, DefaultBaseStyle -> {}, 
   DisplayFunction -> (FrameBox[
       TagBox[GridBox[{{ItemBox[
            TemplateBox[{"\[ThickSpace]", #1, "\[ThickSpace]"}, 
             "RowDefault"], 
            Background -> GrayLevel[0.9333333333333333], 
            StripOnInput -> False], 
           ItemBox[TemplateBox[{"\[ThickSpace]", #2, "\[ThickSpace]"},
              "RowDefault"], Background -> GrayLevel[1], 
            StripOnInput -> False]}}, 
         GridBoxAlignment -> {"Columns" -> {{Center}}, 
           "Rows" -> {{Baseline}}}, AutoDelete -> False, 
         GridBoxDividers -> {"ColumnsIndexed" -> {2 -> GrayLevel[
              0.8352941176470589]}, "Rows" -> {{None}}}, 
         GridBoxItemSize -> {"Columns" -> {{All}}, 
           "Rows" -> {{1.45`}}}, 
         GridBoxSpacings -> {"Columns" -> {{0}}}, 
         BaselinePosition -> {{1, 1}, Baseline}], "Grid"], 
       RoundingRadius -> 4, 
       Background -> GrayLevel[0.9333333333333333], 
       FrameMargins -> {{0, 0}, {-1, -1}}, 
       FrameStyle -> {GrayLevel[0.8352941176470589], 
         AbsoluteThickness[1]}, BaselinePosition -> Baseline, 
       StripOnInput -> False] &), InterpretationFunction -> Automatic,
    CopyFunction -> Automatic, EditingHighlightStyle -> {}, 
   DefaultEditingHighlightStyle -> {}, 
   EditingHighlightArgumentStyle -> {}, 
   DefaultEditingHighlightArgumentStyle -> {}, 
   EditingHighlightBackgroundMargins -> Automatic, 
   EditingHighlightArgumentBackgroundMargins -> Automatic, 
   Editable -> Automatic, Selectable -> Automatic, 
   SyntaxForm -> Automatic, StripWrapperBoxes -> False, 
   Inactive -> False, InactiveStyle -> "InactiveStyle", 
   Tooltip -> None, TooltipStyle -> {}, 
   DefaultTooltipStyle -> "TooltipLabel", TooltipDelay -> 0.`};

TemplateBox[{"ctrl", "/"},
     "Key1",
     BaseStyle -> {"ExampleText", FontWeight -> "Plain", 
    FontFamily -> "Source Sans Pro"},
  boxOpts
  ] // RawBoxes
   DisplayFunction -> (FrameBox[
       TagBox[GridBox[{{ItemBox[
            TemplateBox[{"\[ThickSpace]", #1, "\[ThickSpace]"}, 
             "RowDefault"], 
            Background -> GrayLevel[0.9333333333333333], 
            StripOnInput -> False], 
           ItemBox[TemplateBox[{"\[ThickSpace]", #2, "\[ThickSpace]"},
              "RowDefault"], Background -> GrayLevel[1], 
            StripOnInput -> False]}}, 
         GridBoxAlignment -> {"Columns" -> {{Center}}, 
           "Rows" -> {{Baseline}}}, AutoDelete -> False, 
         GridBoxDividers -> {"ColumnsIndexed" -> {2 -> GrayLevel[
              0.8352941176470589]}, "Rows" -> {{None}}}, 
         GridBoxItemSize -> {"Columns" -> {{All}}, 
           "Rows" -> {{1.45`}}}, 
         GridBoxSpacings -> {"Columns" -> {{0}}}, 
         BaselinePosition -> {{1, 1}, Baseline}], "Grid"], 
       RoundingRadius -> 4, 
       Background -> GrayLevel[0.9333333333333333], 
       FrameMargins -> {{0, 0}, {-1, -1}}, 
       FrameStyle -> {GrayLevel[0.8352941176470589], 
         AbsoluteThickness[1]}, BaselinePosition -> Baseline, 
       StripOnInput -> False] &), InterpretationFunction -> Automatic,
    CopyFunction -> Automatic, EditingHighlightStyle -> {}, 
   DefaultEditingHighlightStyle -> {}, 
   EditingHighlightArgumentStyle -> {}, 
   DefaultEditingHighlightArgumentStyle -> {}, 
   EditingHighlightBackgroundMargins -> Automatic, 
   EditingHighlightArgumentBackgroundMargins -> Automatic, 
   Editable -> Automatic, Selectable -> Automatic, 
   SyntaxForm -> Automatic, StripWrapperBoxes -> False, 
   Inactive -> False, InactiveStyle -> "InactiveStyle", 
   Tooltip -> None, TooltipStyle -> {}, 
   DefaultTooltipStyle -> "TooltipLabel", TooltipDelay -> 0.`};

TemplateBox[{"ctrl", "/"},
     "Key1",
     BaseStyle -> {"ExampleText", FontWeight -> "Plain", 
    FontFamily -> "Source Sans Pro"},
  boxOpts
  ] // RawBoxes
boxOpts = {BaseStyle -> {}, DefaultBaseStyle -> {}, 
   DisplayFunction -> (FrameBox[
       TagBox[GridBox[{{ItemBox[
            TemplateBox[{"\[ThickSpace]", #1, "\[ThickSpace]"}, 
             "RowDefault"], 
            Background -> GrayLevel[0.9333333333333333], 
            StripOnInput -> False], 
           ItemBox[TemplateBox[{"\[ThickSpace]", #2, "\[ThickSpace]"},
              "RowDefault"], Background -> GrayLevel[1], 
            StripOnInput -> False]}}, 
         GridBoxAlignment -> {"Columns" -> {{Center}}, 
           "Rows" -> {{Baseline}}}, AutoDelete -> False, 
         GridBoxDividers -> {"ColumnsIndexed" -> {2 -> GrayLevel[
              0.8352941176470589]}, "Rows" -> {{None}}}, 
         GridBoxItemSize -> {"Columns" -> {{All}}, 
           "Rows" -> {{1.45`}}}, 
         GridBoxSpacings -> {"Columns" -> {{0}}}, 
         BaselinePosition -> {{1, 1}, Baseline}], "Grid"], 
       RoundingRadius -> 4, 
       Background -> GrayLevel[0.9333333333333333], 
       FrameMargins -> {{0, 0}, {-1, -1}}, 
       FrameStyle -> {GrayLevel[0.8352941176470589], 
         AbsoluteThickness[1]}, BaselinePosition -> Baseline, 
       StripOnInput -> False] &), InterpretationFunction -> Automatic,
    CopyFunction -> Automatic, EditingHighlightStyle -> {}, 
   DefaultEditingHighlightStyle -> {}, 
   EditingHighlightArgumentStyle -> {}, 
   DefaultEditingHighlightArgumentStyle -> {}, 
   EditingHighlightBackgroundMargins -> Automatic, 
   EditingHighlightArgumentBackgroundMargins -> Automatic, 
   Editable -> Automatic, Selectable -> Automatic, 
   SyntaxForm -> Automatic, StripWrapperBoxes -> False, 
   Inactive -> False, InactiveStyle -> "InactiveStyle", 
   Tooltip -> None, TooltipStyle -> {}, 
   DefaultTooltipStyle -> "TooltipLabel", TooltipDelay -> 0.`};

TemplateBox[{"ctrl", "/"},
     "Key1",
     BaseStyle -> {"ExampleText", FontWeight -> "Plain", 
    FontFamily -> "Source Sans Pro"},
  boxOpts
  ] // RawBoxes
added 2488 characters in body
Source Link
Sjoerd Smit
  • 24k
  • 46
  • 76

Edit

Ah, found it. If you go into a documentation notebook and evaluate:

CurrentValue[InputNotebook[], {StyleDefinitions, "Key1", TemplateBoxOptions}]

you get the display function for the "Key1" TemplateBox. You can copy-paste that to a normal notebook and assign it to a variable. You can then use these options in the TemplateBox expression from earlier:

   DisplayFunction -> (FrameBox[
       TagBox[GridBox[{{ItemBox[
            TemplateBox[{"\[ThickSpace]", #1, "\[ThickSpace]"}, 
             "RowDefault"], 
            Background -> GrayLevel[0.9333333333333333], 
            StripOnInput -> False], 
           ItemBox[TemplateBox[{"\[ThickSpace]", #2, "\[ThickSpace]"},
              "RowDefault"], Background -> GrayLevel[1], 
            StripOnInput -> False]}}, 
         GridBoxAlignment -> {"Columns" -> {{Center}}, 
           "Rows" -> {{Baseline}}}, AutoDelete -> False, 
         GridBoxDividers -> {"ColumnsIndexed" -> {2 -> GrayLevel[
              0.8352941176470589]}, "Rows" -> {{None}}}, 
         GridBoxItemSize -> {"Columns" -> {{All}}, 
           "Rows" -> {{1.45`}}}, 
         GridBoxSpacings -> {"Columns" -> {{0}}}, 
         BaselinePosition -> {{1, 1}, Baseline}], "Grid"], 
       RoundingRadius -> 4, 
       Background -> GrayLevel[0.9333333333333333], 
       FrameMargins -> {{0, 0}, {-1, -1}}, 
       FrameStyle -> {GrayLevel[0.8352941176470589], 
         AbsoluteThickness[1]}, BaselinePosition -> Baseline, 
       StripOnInput -> False] &), InterpretationFunction -> Automatic,
    CopyFunction -> Automatic, EditingHighlightStyle -> {}, 
   DefaultEditingHighlightStyle -> {}, 
   EditingHighlightArgumentStyle -> {}, 
   DefaultEditingHighlightArgumentStyle -> {}, 
   EditingHighlightBackgroundMargins -> Automatic, 
   EditingHighlightArgumentBackgroundMargins -> Automatic, 
   Editable -> Automatic, Selectable -> Automatic, 
   SyntaxForm -> Automatic, StripWrapperBoxes -> False, 
   Inactive -> False, InactiveStyle -> "InactiveStyle", 
   Tooltip -> None, TooltipStyle -> {}, 
   DefaultTooltipStyle -> "TooltipLabel", TooltipDelay -> 0.`};

TemplateBox[{"ctrl", "/"},
     "Key1",
     BaseStyle -> {"ExampleText", FontWeight -> "Plain", 
    FontFamily -> "Source Sans Pro"},
  boxOpts
  ] // RawBoxes

enter image description here

You should now be able to put different things in the first argument of the template box to get different shortcuts. You can copy-paste the output to put it where you need it.

Edit

Ah, found it. If you go into a documentation notebook and evaluate:

CurrentValue[InputNotebook[], {StyleDefinitions, "Key1", TemplateBoxOptions}]

you get the display function for the "Key1" TemplateBox. You can copy-paste that to a normal notebook and assign it to a variable. You can then use these options in the TemplateBox expression from earlier:

   DisplayFunction -> (FrameBox[
       TagBox[GridBox[{{ItemBox[
            TemplateBox[{"\[ThickSpace]", #1, "\[ThickSpace]"}, 
             "RowDefault"], 
            Background -> GrayLevel[0.9333333333333333], 
            StripOnInput -> False], 
           ItemBox[TemplateBox[{"\[ThickSpace]", #2, "\[ThickSpace]"},
              "RowDefault"], Background -> GrayLevel[1], 
            StripOnInput -> False]}}, 
         GridBoxAlignment -> {"Columns" -> {{Center}}, 
           "Rows" -> {{Baseline}}}, AutoDelete -> False, 
         GridBoxDividers -> {"ColumnsIndexed" -> {2 -> GrayLevel[
              0.8352941176470589]}, "Rows" -> {{None}}}, 
         GridBoxItemSize -> {"Columns" -> {{All}}, 
           "Rows" -> {{1.45`}}}, 
         GridBoxSpacings -> {"Columns" -> {{0}}}, 
         BaselinePosition -> {{1, 1}, Baseline}], "Grid"], 
       RoundingRadius -> 4, 
       Background -> GrayLevel[0.9333333333333333], 
       FrameMargins -> {{0, 0}, {-1, -1}}, 
       FrameStyle -> {GrayLevel[0.8352941176470589], 
         AbsoluteThickness[1]}, BaselinePosition -> Baseline, 
       StripOnInput -> False] &), InterpretationFunction -> Automatic,
    CopyFunction -> Automatic, EditingHighlightStyle -> {}, 
   DefaultEditingHighlightStyle -> {}, 
   EditingHighlightArgumentStyle -> {}, 
   DefaultEditingHighlightArgumentStyle -> {}, 
   EditingHighlightBackgroundMargins -> Automatic, 
   EditingHighlightArgumentBackgroundMargins -> Automatic, 
   Editable -> Automatic, Selectable -> Automatic, 
   SyntaxForm -> Automatic, StripWrapperBoxes -> False, 
   Inactive -> False, InactiveStyle -> "InactiveStyle", 
   Tooltip -> None, TooltipStyle -> {}, 
   DefaultTooltipStyle -> "TooltipLabel", TooltipDelay -> 0.`};

TemplateBox[{"ctrl", "/"},
     "Key1",
     BaseStyle -> {"ExampleText", FontWeight -> "Plain", 
    FontFamily -> "Source Sans Pro"},
  boxOpts
  ] // RawBoxes

enter image description here

You should now be able to put different things in the first argument of the template box to get different shortcuts. You can copy-paste the output to put it where you need it.

Source Link
Sjoerd Smit
  • 24k
  • 46
  • 76

The specific boxes you ask for are:

TemplateBox[{"ctrl", "/"}, "Key1", BaseStyle -> {"ExampleText", FontWeight -> "Plain", FontFamily -> "Source Sans Pro"}]

Unfortunately, it doesn't seem like the style definitions for this template box exists in a normal notebook:

enter image description here

If you evaluate the same code in a documentation notebook it does work:

enter image description here

I might be able to figure out what DisplayFunction is being used to achieve this typesetting.