Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

generator-latex-template Tests npm version

Generates latextemplates (e.g., for thesis, workshops, conferences, IEEEtran, LNCS, ...) out of "micro-templates"

See the talk about the generator for an overview on the aims and the general concept.

Background information

There are many latex templates out there. All of them make use of certain packages such as hyperref, listings, or minted. The packages have to be a) included in the .tex file somehow and b) configured. Moreover, some packages offer interfaces (such as new commands or new environments) to users. Minimal examples help to understand how a package works.

The aim of the repository is to provide for each common latex package

  1. Configuration
  2. Usage example

and a generation into templates:

  1. Support for ACM, IEEE, LNCS, KOMA-Script
  2. Support for separate documents which require --shell-escape and not.
  3. Support for integrated pdflatex and lualatex documents



One has to install Node.js version 14 to get this generator running. On Windows, one can just run choco install nodejs-lts to get the right version of Node.js.

On Linux, one can start using the generator directly using the node execution wrapper npx:

npx -p yo -p generator-latex-template -c 'yo latex-template'

Installing generator-latex-template

In case one wants to have the generator installed permanently or npx does work as exepcted, one can install generator-latex-template using following command:

npm install -g generator-latex-template

Using the generator

One can run the generator by invoking this command on a command prompt:

yo latex-template

How to update the document

⚠️ The template generator overwrites main.tex on each run. This will destroy your work. ⚠️

You can use the magic of git to prevent that:

  1. After repository initialization:

    • git commit to save your work
    • git checkout -b template - to create a branch with initial template (required for updating)
    • git checkout main switch back to your thesis
  2. Work on the main branch

  3. In case an update comes in, update the template branch

    • git checkout template - switch to the template branch
    • yo latex-template - generate new template
    • git commit - save the new template
    • git checkout main - switch to your work
    • git merge template - merge in the template changes
    • resolve conflicts ^^ (Hint: IntelliJ Community Edition has a great conflict resolving tool)


Development roadmap

In the long run, the contents of the paper.tex (and similar) files in repositories of the latextemplates organization should be generated automatically.

Development hints

  • Templating language:
  • Conditional questions:
  • Types of prompts:
  • Add a new question
    • Also adapt __tests__/app.js
    • Execute tests with npx jest
  • Test locally
    • Create empty directory ("target directory")
    • Change to the target directory
    • Run npx yo <path-to-git-repository>
      • Windows: npx yo c:\git-repositories\latextemplates\generator-latex-template
    • Parameters can be set using command line
      • Windows: npx yo c:\git-repositories\latextemplates\generator-latex-template --texlive=tl2021 --documentclass=scientific-thesis --latexcompiler=lualatex --bibtextool=biblatex --language=en --font=arial --listings=listings --cleveref=true --enquotes=csquotes --tweak_outerquote=babel --todo=pdfcomment --examples=true --howtotext=true
      • Windows automatic generation of a LNCS template (with pdflatex and bibtex): npx yo c:\git-repositories\latextemplates\generator-latex-template --documentclass=lncs --latexcompiler=pdflatex --bibtextool=bibtex --texlive=tl2021 --language=en --font=default --listings=listings --cleveref=true --enquotes=csquotes --tweak_outerquote=babel --todo=pdfcomment --examples=true --howtotext=true
    • Run latexmk to build the PDF
  • Update npm dependencies
  • When one encounters Cannot find module 'yeoman-generator', please update the npm dependencies. That error ocurred when using version 4.13.0 and 5.4.2 was available.
  • Check GitHub actions

Useful snippets

<% if (howtotext) { -%>
<% } else { -%>
<% } -%>
<% switch (documentclass) { case "lncs": -%>
<% break; case "ieee": -%>
<% break; default: -%>
<% break; } -%>
<% if (cleveref) { %>\cref<% } else if (documentclass == 'lncs') { %>Sect.~<% } else { %>Section~<% } %>{sec:relatedwork}


A launch.json configured for Windows and Visual Studio Code is included. Just press F5 and the generator should run in debug mode.

ejslint.cmd c:\git-repositories\latextemplates\generator-latex-template\generators\app\templates\main.en.tex

Releasing a new version

  1. Update

  2. Update package.json, publish to npmjs, create GitHub release. Use release-it (do not create a release on GitHub) and github-release-from-changelog.

    • npx release-it
    • npx github-release-from-changelog


The code is licensed 0BSD, the snippets (both LaTeX and text) 0BSD, too. See benbalter/talks#15, for a reasoning, why CC0 cannot be used.


Generates latextemplates (e.g., for thesis, workshops, conferences, IEEEtran, LNCS, ...)





No packages published