Templates
This feature is initially developed by yu-i-i/overleaf-cep, and modified and optimized by ayaka-notes/overleaf-pro.


Configuration
The Template Gallery feature is controlled using the following environment variables:
OVERLEAF_TEMPLATE_GALLERY: Set totrueto enable the Template Gallery.OVERLEAF_TEMPLATE_CATEGORIES: An optional whitespace-separated list of zero or more template category keys. Valid keys include:academic-journalbookpresentationpostercvhomeworkbibliographycalendarformal-letterreportthesisnewsletter
The special key
allis automatically appended. This key represents a category that includes all templates.For each category key, the following optional environment variables can be set:
TEMPLATE_<KEY>_NAME: The display name of the template category.TEMPLATE_<KEY>_DESCRIPTION: A short description of the category.
If a category key contains a hyphen (
-), replace it with an underscore (_) in the environment variable names.ENABLE_CONVERSIONS: Must be set totrueto enable thumbnail and preview generation for templates.OVERLEAF_NON_ADMIN_CAN_PUBLISH_TEMPLATES: Determines whether non-admin users can publish templates. Defaults tofalse.
Permissions for Publish
By default, admin in system will have access to publish templates. In the mean time, you can also set a non-admin user who is specifically responsible for publishing the curated list of templates that are visible on your local template gallery /templates.
To do this, you'll need to set the environment variable OVERLEAF_TEMPLATES_USER_ID in toolkit/config/variables.env to the ID of the user who will be responsible for template management within your instance, for example:
Publishing Templates
For each template you want to upload:
Create a project containing the template's source code and make sure it compiles.
In the editor's left-hand menu, choose Publish as Template.
In the form that appears, enter the template details:
The Title must be unique.
The Description field supports Markdown formatting.
The Author field accepts Markdown-formatted links.
After submission, template details can be edited, or the template can be deleted via the Template Gallery page. Users can manage their own templates; admins can manage any template.
Here is an example:
Transferring templates from overleaf.com
As Overleaf Pro has been architected to work offline, there isn't an automated way to integrate overleaf.com gallery templates into your on-premise installation, it is however possible to do this manually on a per template basis.
By default, Overleaf Pro is configured to use a basic scheme version of TeXLive for compiles. This basic version is lightweight and only contains a very limited subset of LaTeX packages which, will most likely result in missing package errors for your users when attempting to use templates from overleaf.com on your local on-premise instance.
Unfortunately, whilst there isn't an automatic way to install missing packages, we do have a configurable setting within Server Pro that will allow your users to compile projects with access to more packages, and in a more secure way. This feature is called Sandbox Compiles (also known as Sibling Containers).
To ensure that downloaded templates are compatible with your on-premise Server Pro instance, we highly recommend that you enable Sandbox Compiles as this feature will provide your users with access to the same TeX Live environment as that on overleaf.com. These images contain the most popular packages and fonts and have already been tested against our gallery templates.
You can find additional information about configuring what TeX Live versions users are able to choose from within their project along with setting the default TeX Live image version for new projects in the Changing the TeX Live Image section of our documentation.
Navigate to the Template Gallery on overleaf.com and locate the required template, for example IEEE Photonics Journal Paper Template - Example Submission
Click on the Open as Template button
Click on the project menu and choose Download Source
Next, log into the on-premise Server Pro account
Click the New Project button from the projects dashboard and choose Upload Project
Click the Select a .zip file button and choose the downloaded template zip file
The user can then use this newly uploaded template within their own account, or, as the templates user, you can publish it for other users to use.
Q&A
Can I delete the project after publishing the corresponding template?
Answer: Yes, but we do not recommend doing so. When you publish a template, we take a snapshot of the project and save the project as a zip file at the time of publication. This ensures that even if you delete the project corresponding to the template, the template will not be affected.
However, we will also record the ProjectID associated with this template, which makes it easy for you to update the template in the future.
If you delete the corresponding project, you will not see the "Admin: Source Project" button on the template details page (see image below).

For some projects, why is it that releasing a template takes such a long time?
Answer: When you publish the template, we save the project as a zip and a pdf file, which is usually quick. However, we also need to generate thumbnails for the PDF so they can be displayed in the template details.
Thumbnail generation time typically depends on the content of your PDF's first page. To balance bewteen display quality and convert time, we choose a middle one as width.
However, if the first page of the PDF contains a lot of text, converting the thumbnails may take 40 seconds or even more, please be patient. Here is an example of large poster, it will take longer time.

Last updated
Was this helpful?