Using templates in Inkscape

Using templates in Inkscape

The FAQ flavored series of Inkscape tutorials continues. Another popular question I keep hearing is in the lines of "Um, how exactly do I set a default page size?". Welcome to the world of templates.

A template in Inkscape is a regular SVG document such as you create every time launch it. What actually happens when you start Inkscape is that it looks for a file called default.svg in your local Inkscape directory and loads it. If it can't find it, it takes a system-wide available default.svg file, copies it to your local Inkscape directory and uses the newly saved default.svg file.

The same thing happens when you press Ctrl+N or use "File > New > Default" menu item:

Creating new default document

Local directory? System-wide directory? Ugh?

A local Inkscape directory is the one that is created per user in a system. The location depends on your operating system:

  • For Linux and Mac it is ~/.config/inkscape
  • For Windows it is %APPDATA%\\Inkscape (just use it in Explorer as is)

So if you want to have default documents with e.g. a different page size, all you need is to create a new document, change page size and save this document as default.svg inside templates folder of your local Inkscape folder. Here is a step by step guide:

1. Start Inkscape and use "File > Document Properties" menu item (or press Ctrl+Shift+D) to open a dialog where you set various properties of a document.

2. On the first tab called Page choose a new page size from presets or define your own page size. You can also arbitrarily switch between units such as px, mm and pt.

Size settings

3. Close the dialog, use "File > Save" menu item or press Ctrl+S for saving. In the newly opened dialog go to your local Inkscape folder (see above), then further inside go to the templates folder and save as default.svg, overwriting the existing document. The screenshot below illustrates that for Linux:

Saving default document

4. Restart Inkscape to check that default document has a new size.

That's all, really. But can other things be default? Yes.

Defaulting

Here is the list of most useful things that can be made default for a document:

1. Units. If you don't work on display graphics, you probably want either metric (mm) or royal (in) system. Or maybe you want points (pt) or picas (pc). On the Page tab of the Document Properties dialog choose default units:

Default units

This will affect both ruler and Selector's options in the tool's options toolbar. Most extensions will keep using pixels as units though.

2. Guides and grids. You can set your own color for guides, or e.g. set axonometric grid as default grid and tweak its many options. Just open the Document Properties dialog, go to Grids tab, choose type of a grid and click New button to the right from the list of possible grid types.

Grid options

Now every time you press # or use "View > Grid" menu item, the grid you defined will show up. You can even use multiple grids, which can be useful when you work on e.g. pixel art. Just add a new rectangular grid in the same dialog.

3. Metadata. Use "File > Document Metadata" menu item to open a dialog where you can define various information about a document. The minimum is setting your name as creator of every document created by default, as well as default license, but you can save much more than that.

Metadata dialog

By default Inkscape doesn't write any information about creator and sets Proprietary license. For example if you intend to contribute to Open Clip Art Library, you definitely want setting Public Domain for a document instead, as well as adding keywords.

4. Snapping. The topic of snapping deserves a dedicated tutorial. For now let's just say that on the document's level you can define behavior, which is on the Snap tab of the Document Properties dialog, and what snaps to what, which is in the Snapping toolbar (vertical toolbar on the right side of Inkscape's window). Just click on the buttons to decide what snaps by default, then save default.svg file.

5. Zoom level, window size, position and mode. When you save your document, Inkscape writes information about current zoom level of a document, as well as about size, position and mode (maximized or not) of the window that contains this document. E.g. if you want Inkscape to always open default window maximized, just maximize the window before saving.

More templates?

Now, one question you might be asking yourself is whether you can save more templates than the default one. The answer is "Yes, of course!". All you need is setting all the things you want and saving a new SVG file to local Inkscape's templates folder. After restarting Inkscape you will see the templates you added in the list in the "File > New" submenu.

In the example given above regarding Open Clip Art Library you definitely want setting Public Domain license for a new, non-default template, otherwise you end up licensing all your new work as public domain which is commendable, but probably not what you intended to do.

And because, once again, we are talking about regular SVG images, your templates can have custom background or some pre-added graphics. For example, when I was working on a screencast demonstrating new GIMP's slider for tablet users, I created a new document that is 1280×720px large (a video frame size), disabled visibility of page border, added a vignetted background, several layers with predefined names and saved the document as a template, so that I could easily create new documents for the screencast on top of it.

GIMP screencast bg template

Of course this can be used just as well for things like corporate publications, branding packages, website design and so on and so forth. It's entirely up to you what you want to be a template.

The final note is regarding deletion and renaming of templates. The GTK+ dialog doesn't allow either of them, so you have to do it from file manager. Mac users will have to access ~/.config/inkscape from Finder which is done via top menubar: just choose 'Go > Go to Folder…' (⇧⌘G) and enter this path. Linux users can use same path in Nautilus or Dolphin or what is it they they used intead of them. Windows users can input  %APPDATA%\\Inkscape\\templates in the address bar in in Explorer as is.

The future

The existing templates system is probably not very discoverable, especially when you are accustomed to e.g. Adobe Illustrator where you define page size when you create a new document. And surely we could do with a better way to browse templates.

Chances are that one of future versions will have a new dialog where you can preview templates and create new documents based on some rules. A blueprint for that dialog has already been written, work on it started a while ago, but there's no promise regarding which version of Inkscape will feature it.

Any further questions? Some more tutorials on particular Inkscape features in demand? Just leave a comment.

Was it useful? There's more:

13 Comments

Leave a comment
  1. Here’s a link to an earlier comment in the “unofficial Inkscape forum” detailing the steps to save custom user templates on Mac OS X: Re: inkscape on mac os x

    **Note: in that comment I wrote «(do not resize the page or change the page orientation for a file you want to use as template!)» - of course you can do it, but then I recommend to remove the ‘transform’ attribute of the (empty) top-level layer (using ‘Edit > XML Editor…’ ) before saving it as new template because that attribute can trigger several known bugs with tiled clones and some extensions. For a template file such a transformation is superfluous as long as the layer is empty (detailed instructions here).

  2. prokoudine wrote on February 18 2011:

    - For Windows it is C:\Documents and Settings\[Your user name]\Application Data\Inkscape\

    It depends on the Windows version: the general path is ‘%APPDATA%\Inkscape’ (the string “%APPDATA%” can be entered literally into the address bar of the Explorer to quickly access that folder, or look it up here). See also [1], [2].

  3. @su-v Many thanks as usual! That sounds like a call for a new section called “How to work around bugs” :)

  4. I would love to see a Scribus tutorial that explains how I can take a list of “words” and put one on each card. I know it was a bit cryptic, so let me explain it better.

    I am setting up a wireless system with something called a captive portal. This means that a user will be directed to a webpage where they will have to enter a code before they can access internet.

    These codes are generated as a .csv file and can contain up to 1000 codes in a batch.

    I would love to design a small card with a little bit of information, my logo and one code in the center of the card. The cards could be the size of a businesscard so that I get several cards on the same page. BTW - I am in metric land, so I am using A4 :-)

    A tutorial like this would be great as it would explain how to format the page with repeating information and then import the data from the file and put one unique code on each card a kind of merge.

    Would this mean I would have to use the size of the card as my “page” and just place several pages in one when printing it? Or are there other ways to think about this?

  5. I would also love to see a tutorial on how to use Scribus to make a calendar. Have wanted to make calendars with my own pictures for some time, and know there are a lot of programs out there that can do it almost automatically, but would like more control over the design process.

  6. The best Linux tool for that is glabels, check it out :) A tutorial on it is actually one of those things that piled up since last Xmas. I’ll see if I can push it up in the queue. For Scribus’s there a simple script available.

    As for calendar, Scribus ships with a script to automate part of the task.

  7. Thank you for the tip about glabels. Looks very much like the tool I need for the job :-)

    Regarding the script in Scribus - yeah, that is exactly what I was talking about when I said I want more control over the process. I would like to use the calendar ceation to learn how to use the tools in Scribus as well as possible and at the same time have complete control over every aspect of making a calendar. I don’t want the calendar to be just another one from a template, I want it to be unique. The point is, of course that I need to learn all the parts of Scribus that is needed in the process. You could also say that making a calendar is just a specific exercise in how to learn things.

  8. Hmmm… Calendar as an exercise is an interesting idea… :)

  9. It is better to have a plug-in to manage template…

  10. Alexandre Prokoudine 06 October 2011 at 7:38 am

    @lililjlj

    Sure. In fact I wrote a blueprint for such a thing few years ago, and another person starting writing actual code. Unfortunately, it was never finished.

  11. Note that if you have a locale set up, the template that it looks for is default.<countrycode>.svg, for example default.nl.svg in my case. Appearantly this will change (that is, the user-provided default.svg will override the system-provided default.code.svg) but for now you need to use the country code in there.

  12. Re “localized default templates”:

    tracked in Bug #503712 “Personal default template not used”
    <https://bugs.launchpad.net/inkscape/+bug/503712>

  13. would be nice if inkscape would allow for a folder structure in the template folder, instead of having a linear list which tends to get very long if you have a lot of different templates.

Tell us what you think

Submit the word you see below: