pasteTemplates

circle-info

This feature is initially developed by yu-i-i/overleaf-ceparrow-up-right, and modified and optimized by ayaka-notes/overleaf-proarrow-up-right.

Configuration

The Template Gallery feature is controlled using the following environment variables:

  • OVERLEAF_TEMPLATE_GALLERY: Set to true to enable the Template Gallery.

  • OVERLEAF_TEMPLATE_CATEGORIES: An optional whitespace-separated list of zero or more template category keys. Valid keys include:

    • academic-journal

    • book

    • presentation

    • poster

    • cv

    • homework

    • bibliography

    • calendar

    • formal-letter

    • report

    • thesis

    • newsletter

    The special key all is 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 to true to enable thumbnail and preview generation for templates.

  • OVERLEAF_NON_ADMIN_CAN_PUBLISH_TEMPLATES: Determines whether non-admin users can publish templates. Defaults to false.

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:

  1. Create a project containing the template's source code and make sure it compiles.

  2. In the editor's left-hand menu, choose Publish as Template.

  3. 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.comarrow-up-right 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.comarrow-up-right 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 Compilesarrow-up-right (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 Compilesarrow-up-right as this feature will provide your users with access to the same TeX Live environment as that on overleaf.comarrow-up-right. 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 Imagearrow-up-right section of our documentation.

  1. Click on the Open as Template button

  2. Click on the project menu and choose Download Source

  3. Next, log into the on-premise Server Pro account

  4. Click the New Project button from the projects dashboard and choose Upload Project

  5. 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

chevron-rightCan I delete the project after publishing the corresponding template?hashtag

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).

chevron-rightFor some projects, why is it that releasing a template takes such a long time?hashtag

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.

A large poster

Last updated

Was this helpful?