Templates

Contents

Use templates to give your elements your favorite look

A template in SuperMemo is a definition of an element's appearance. Templates are used to create many similarly looking elements, e.g. with a given color, image, font, etc. The first thing to do with templates is to create a template (i.e. the "common look"). You can do it by first composing an element that looks the way you want other elements to look. This element will contain all components that are common to all elements that will be created with the use of the template (e.g. two text fields and one picture component, etc.). All components should have their properties set in the way as in the "common look" (e.g. color, position on the screen, font, etc.). You set the properties of components by using the component menu.

After creating the element with the desired look, you can use Template : Save as template on the element menu (this menu opens with Alt+F10 or with a right-click over the navigation bar).

Saving templates with Save as template makes it possible to keep a "gallery of looks" for future use. This gallery is called the template registry. You can save any element as a template. If you want particular texts, sounds or pictures to be associated with the template, use Template : Save with objects. Save as template does not save objects associated with components. For example, it will save the position and color of a text component, but it will not save the text (e.g. "US Constitution").

The template registry (i.e. the gallery of templates) can be viewed with Search : Templates on the main menu.

If you want a template to be used by default each time you choose Add new (or when you add topics with Alt+N or Ctrl+N), use Template : Save as default. Save as default will save the template in the same way as Save as template but will also make this template the default one for the currently used concept group. Only elements of the same type will be affected. This means that if you save an item template, new items will change their appearance, but the appearance of topics will remain the same. The appearance of previously added items or topics will not be affected (unless you save the new default template under an already used name).

To give an element a selected look, apply the appropriate template to this element. Any template can be selected from the template registry and applied to any element with Template : Apply template (Shift+Ctrl+M). After you choose a template in the registry], click the Accept button at the bottom of the template registry window (or press Enter). Applying a template does not overwrite the "old look". You can remove the applied template by choosing Template : Detach template.

Using fonts with a template

To associate a font with a text component in a template, use Text : Font : New font, Text : Font : Link font (Shift+Ctrl+F) or Text : Font : Edit font on the component menu (see more: Font options). If you want to change fonts globally in a set of existing items, you need to use plain text components. This comes from a difference between plain text components and HTML text components in the way they interpret the font associated with the template:

Concept templates help you switch fast between different templates for different learning subjects

If you want to associate a template with a given subject, e.g. Chemistry, you can use concept templates. You will need the following before you begin:

  1. Define a template as described above (e.g. by reworking an existing template and saving it with Template : Save as default)
  2. Create a new concept or redefine an existing one. When you create a new collection, you begin with a single concept whose name is the same as the name of the collection (see: Using concepts)

To define a concept template do as follows:

  1. Choose Search : Concepts on the main menu (if you are not at the Professional level, switch the level, e.g. with Ctrl+Alt+F12)
  2. Select the concept (e.g. by typing its name at the top of the concept registry window)
  3. Click the Item/Topic template button
  4. Choose the template from the template registry (e.g. by typing its name at the top of the template registry window)
  5. Click Accept (at the bottom of the template registry window)
  6. Close the concept registry window

The above will make sure that your template is used each time you choose Add new or press Alt+A as long as your concept group is selected as the current one in the navigation bar.

You can apply a template to many elements at once

You can change the look of many elements at the same time. If your elements use a given template, go to one of these elements and simply redefine the template. If your elements use different templates or use no template at all, you can apply a template to all of them by choosing File : Process collection> : Template : Apply template from the main menu, Process branch> : Template : Apply template in the Contents window, or Process browser> : Template : Apply template in the browser.

Template operations reference

Here is the summary of template operations on the Template submenu of the element menu (use Alt+F10 to open this menu or right-click over the empty element area or over the navigation bar):

Advanced template operations

Adding components to a group of existing elements

If you want to add new components to a group of elements, use Add template on the main menu, in the Contents window or in the browser. This will retain the old components and add new components from the added template. Add to template is similar to Apply template but the contents of the new template is simply superimposed over the old template

Transferring templates between collections

If you want to transfer templates (or single elements) between different collections, use Template : Save to file and Template : Load from file. You can also use Edit : Copy element with Edit : Paste template and Edit : Paste element to transfer templates and elements within a collection or between different collections using the clipboard

Further reading

FAQ: Templates in SuperMemo