Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

In the system resource file MiscStrings.tr there is a template:

@@resource PackageTemplate
    RowBox[{"BeginPackage", "[", "\"\<\[Placeholder]`\>\"", "]"}]], "Code"],
    RowBox[{"Begin", "[", "\"\<`Private`\>\"", "]"}]], "Code"],
    RowBox[{"End", "[", "]"}]], "Code"],
    RowBox[{"EndPackage", "[", "]"}]], "Code"]

I suppose there is also an automatic way to insert or use this template. What is it?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

You can get the template using FrontEndResource:

 (* Notebook[
  {Cell[BoxData[RowBox[{"BeginPackage", "[", "\"\[Placeholder]`\"", "]"}]], "Code"], 
   Cell[BoxData[RowBox[{"Begin", "[", "\"`Private`\"", "]"}]], "Code"],
   Cell[BoxData[RowBox[{"End", "[", "]"}]], "Code"], 
   Cell[BoxData[RowBox[{"EndPackage", "[", "]"}]], "Code"]}] *)

Usage example:


enter image description here

share|improve this answer
I thought I must be missing something; thanks. Is FrontEndResource documented somewhere? –  Mr.Wizard Aug 13 '12 at 14:08
@Mr.Wizard, I have not come across anything in the docs; but, as you must have noticed, text resource files have several example uses such as the piece FrontEndExecute[FrontEnd`NotebookPut[FEPrivate`FrontEndResource["FEExpressions"‌​, "SlideshowTemplate"]]] in MenuSetup.tr. Finding the right syntax took several "trial-and-crash" attempts. –  kguler Aug 13 '12 at 14:35
@Mr.Wizard This is not your first encounter with FrontEndResource. See your answer here. –  Sjoerd C. de Vries Aug 13 '12 at 19:59
@Sjoerd More evidence of my failing memory. ::sigh:: –  Mr.Wizard Aug 14 '12 at 0:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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