I have created an initialization cell with options. I would like to create a template, which already contains these cells, when I open a new notebook.
Is there any opportunity to create such a template file?
Thank you for your answers in advance!
I have created an initialization cell with options. I would like to create a template, which already contains these cells, when I open a new notebook.
Is there any opportunity to create such a template file?
Thank you for your answers in advance!
Sure you can do this. Indeed, I find it a great way of standardising workflows.
The image below is an example of a notebook that is automagically generated from a palette.
Everything in the notebook, including the image at the base (a hyperlink to my employer's website), the signature which is a mailto: hyperlink and the dynamic dropdown header is generated from the palette. It's displayed at 75% magnification to get it all onscreen, but I generate it at 100%. The stylesheet employs corporate colors and is custom.
It's essentially combination of TextCell[] within CreateDocument[]:
CreateDocument[{
TextCell["Title", "Title", CellTags -> {"Title"}],
TextCell["Subtitle", "Subtitle", CellTags -> {"Subtitle"}],
TextCell["Abstract", "Abstract", CellTags -> {"Abstract"}],
(* more of the same *)}, (* with options ...*)]
NotebookWrite[EvaluationNotebook[], Cell[...]]) insideNotebookDynamicExpressionoption ofStyleData["Notebook"]. Do save your work before trying anything evolvingNotebookDynamicExpression! Wrong code can crash the FrontEnd easily! – Silvia Apr 07 '20 at 15:23InputAliasthat inserts this by usingNotebookReadto get theCellexpression and then you can this alias to either theDefault.nbstylesheet or make your own. Then when you want this template you just have to typeEsc-template-Escor something and it will insert itself. – b3m2a1 Apr 08 '20 at 03:21