# What are templates?

We separate templates into two classes: editor templates and document templates. Editor templates are small LaTeX-code pieces, that can be inserted into the document (hence making the writing process a bit easier and faster.) These templates consist of a fixed part (that the writer does not need to change when inserting the template) and variables, which point out the parts of the template that the writer should change. Document templates are entire LaTeX documents, which serve as a starting point for writing new documents.

## Editor templates

Two different sets of templates are provided with TeXlipse: LaTeX and BibTeX templates. The former can be used when editing LaTeX files (*.tex, *.ltx) and the latter one with BibTeX files (*.bib).

### Using editor templates

Use them the same way as command completions, just hit `ctrl + space` (or what your content assist activation key is bound to) and list of available templates shows up. The available templates are determined based on text just before the cursor — only templates whose beginning match that text are shown (which could be none). If there is whitespace (i.e. spaces, tabs and linebreaks) before the cursor, all templates are shown.

After you have chosen the template, you need to fill in the template's variables: you can edit the currently selected variable, and you can rotate between variables with TAB. After you are ready with the template, hit ENTER to finish the template.

### Sounds nice, can I define my own templates?

Yes you can. Go to the Window > Preferences and further to Texlipse > Editor > Templates or Texlipse > BibTeX Editor > Templates. The editor templates are managed trough these pages (add, remove, modify, disable or enable).

When creating templates, use "${variablename}" to insert variables into templates. If the same variable value needs to be used more than once, just use the same variable name. You can use the ${cursor} variable to determine the place where the cursor should be after the template is finished.

An example:

    \begin{${environment}}
      ${cursor}
    \end{${environment}}

## Document templates

There are two different types of document templates, system and user-defined templates. The difference is that you need to have administrative rights to Eclipse to change the system templates (which are available to everyone). The user defined templates are instead personal templates visible only to the corresponding user.

### How are document templates used?

Document templates can be used when a new LaTeX project is created. The first lines of the document templates are read and the lines starting with "%%" are considered to be descriptions of the templates. (Reading the templates ends immediately after a line that does not start with "%%" is encountered.) So if you define your own templates (see the following sections), it might be useful to add few "%%" lines containing a description in the beginning of the templates.

### Managing user defined templates

To add your own document templates, right click the editor area and select "Save As Template". To manage (remove) older user defined templates go to Windows > preferences and further to Texlipse > Project Templates.

### Managing system templates

The system templates are located in the templates -directory under the <texlipse plugin directory>: all .tex files in that directory are considered to be document templates. By adding files there, system administrators can add templates that are available to all users.