npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

generator-latex-template

v2025.2.14

Published

Generates a latex template to be used as start for writing scientific works (papers, articles, theses)

Downloads

490

Readme

LaTeX Template Generator npm version

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

Talks and papers

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

Precondition for the generator

One has to install Node.js version 18 (or later) to get this generator running. For simple installation, just head to https://nodejs.org/ and follow the installation instructions.

Using the generator

One can start using the generator directly using the node execution wrapper npx:

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

Permanent installation (and simpler command line usage)

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

npm install -g generator-latex-template

Then, one can invoke the generator as follows:

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)

Resources

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: https://ejs.co/
  • Conditional questions: https://stackoverflow.com/a/18706640/873282.
  • Types of prompts: https://github.com/SBoudrias/Inquirer.js#prompt-types
  • Add a new question
    • Also adapt __tests__/app.js
    • Execute tests with npx jest
  • Update NPM dependencies
  • When one encounters Cannot find module 'yeoman-generator', please update the npm dependencies. That error occurred when using version 4.13.0 and 5.4.2 was available.
  • In case of the error "Error: EACCES, permission denied '/root/.config/configstore/insight-yo.json'", one needs to execute chmod g+rwx /root /root/.config /root/.config/configstore
  • Check GitHub actions
  • When adding a new package use DEPP (see above) or execute following steps:
    1. execute npx with --generatereitzig (in a clean directory)
    2. run pdflatex
    3. run {repository-root}/generate-texlivefile.sh
    4. copy Texlivefile to the root of the {repository-root}/generators/app/templates
    5. adapt Texlivefile as required
  • When issues with the template occur: npx ejs-lint main.en.tex
  • Cancel workflows:
    • gh run list -L 100 --json databaseId -s queued -R latextemplates/generator-latex-template | jq -r '.[] | .databaseId' | awk '{gsub(/\\r\\n/,RS)} 1' | while read -r run_id; do gh run cancel "$run_id" -R latextemplates/generator-latex-template || true; done
    • gh run list -L 100 --json databaseId -s in_progress -R latextemplates/generator-latex-template | jq -r '.[] | .databaseId' | awk '{gsub(/\\r\\n/,RS)} 1' | while read -r run_id; do gh run cancel "$run_id" -R latextemplates/generator-latex-template || true; done
  • Update submodule of "derived" templates (LNCS, ...): [ -z "$(git status --porcelain)" ] && cd generator-latex-template/ && git pull && cd .. && git add . && git commit -m"Update LTG" && git pull --rebase && git push

Testing

  • All workflows test overleaf=no - and (nearly) all possible combinations.
  • All *-refined repositories test with overleaf=true - and only the typical settings for the template.
  • refine-ltg is the development branch for the template generator; only a small set of workflows enabled there due to load during testing.
  • update-ltg is the development branch at each *-refined template.

Test locally

  • Create empty directory ("target directory")
  • Change to the target directory
  • Run npx yo <path-to-git-repository>/generators/app/index.js. Background: Starting from 5.0.0 on, one needs to specify the full path to index.js.
  • Windows: npx yo c:\git-repositories\latextemplates\generator-latex-template\generators\app\index.js

Linux

Parameters can be set using command line

  • lncs: npx yo /tmp/repo/generators/app/index.js --documentclass=lncs --papersize=a4 --latexcompiler=pdflatex --bibtextool=bibtex --texlive=2024 --docker=false --lang=en --font=default --listings=listings --enquotes=csquotes --tweakouterquote=babel --todo=pdfcomment --examples=true --howtotext=true

Windows

Parameters can be set using command line

  • IEEE template (with pdflatex and bibtex): npx yo c:\git-repositories\latextemplates\generator-latex-template\generators\app\index.js --overleaf=false --documentclass=ieee --ieeevariant=conference --papersize=a4 --latexcompiler=pdflatex --bibtextool=bibtex --texlive=2024 --docker=reitzig --lang=en --font=default --listings=listings --enquotes=csquotes --tweakouterquote=babel --todo=pdfcomment --examples=true --howtotext=true
  • LNCS template (with pdflatex and bibtex): npx yo c:\git-repositories\latextemplates\generator-latex-template\generators\app\index.js --overleaf=false --documentclass=lncs ---papersize=a4 --latexcompiler=pdflatex --bibtextool=bibtex --texlive=2024 --docker=false --lang=en --font=default --listings=listings --enquotes=csquotes --tweakouterquote=babel --todo=pdfcomment --examples=true --howtotext=true
  • Scientific Thesis template: npx yo c:\git-repositories\latextemplates\generator-latex-template\generators\app\index.js --overleaf=false --documentclass=scientific-thesis --papersize=a4 --latexcompiler=pdflatex --bibtextool=bibtex --texlive=2024 --lang=en --font=default --listings=listings --enquotes=csquotes --tweakouterquote=babel --todo=pdfcomment --examples=true --howtotext=true
  • USTUTT template: npx yo c:\git-repositories\latextemplates\generator-latex-template\generators\app\index.js --overleaf=false --documentclass=ustutt --papersize=a5 --latexcompiler=lualatex --bibtextool=biblatex --texlive=2024 --lang=en --font=default --listings=listings --enquotes=csquotes --tweakouterquote=babel --todo=todonotes --examples=true --howtotext=true -- todonotes is the preferred TODO package here.
  • Run latexmk to build the PDF
Using DEPP

To fire up a TeX Live installation and use the Dependency Printer for TeX Live to refine Texlivefile, execute following steps:

docker run -it --rm -v c:\temp\ltg:/ltg registry.gitlab.com/islandoftex/images/texlive:latest
cd /tmp
git clone https://gitlab.com/islandoftex/texmf/depp.git
cd depp
l3build install
cd /ltg
# edit paper.tex and add `\RequirePackage[dependency-file=Texlivefile]{depp}`
lualatex/pdflatex paper
Running reitzig
  1. docker build --progress=plain -t reitzig -f Dockerfile .
  2. docker run -it --rm -v c:\temp\ltg:/work/src -v c:\temp\ltg-out:/work/out reitzig work latexmk

Useful snippets

<% if (howtotext) { -%>
<% } else { -%>
<% } -%>
<% switch (documentclass) { case "lncs": -%>
<% break; case "ieee": -%>
<% break; default: -%>
<% break; } -%>

Debugging

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 CHANGELOG.md (change h2 heading etc.)

  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

License

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.

  • generators/app/templates/splncs04nat.bst is taken from tpavlic/splncs04nat and is MIT-licensed.
  • generators/app/templates/logos/: This directory contains logos, which have special licenses.