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 🙏

© 2026 – Pkg Stats / Ryan Hefner

n8n-nodes-latex-template

v0.2.0

Published

n8n Node to fill LaTeX Templates

Readme

n8n-nodes-latex-template

This node fills LaTeX templates by replacing \newcommand variable definitions with data from n8n workflows.

n8n is a fair-code licensed workflow automation platform.

Installation
How It Works
Template Format
Usage
Node Properties
Output
Workflow Example
Compatibility
Resources

Installation

Follow the installation guide in the n8n community nodes documentation.

How It Works

The LaTeX Template node reads a LaTeX template file from the file system, extracts variable definitions in the format \newcommand{\varname}{value}, and replaces their values with data from the workflow. The filled template is returned as binary data.

The node uses n8n's resource mapper to auto-discover variables in the template, allowing visual mapping between workflow data and template variables.

Template Format

Templates must use \newcommand for variable definitions:

% Invoice template example
\documentclass{article}

% Company information
\newcommand{\companyName}{Default Company Name}
\newcommand{\companyAddress}{Default Address}

% Invoice data
\newcommand{\invoiceNumber}{000}
\newcommand{\invoiceDate}{2024-01-01}
\newcommand{\totalAmount}{0.00}

% Client information
\newcommand{\clientName}{Default Client}
\newcommand{\clientAddress}{Default Client Address}

\begin{document}
\textbf{Invoice \invoiceNumber{}}

From: \companyName{}, \companyAddress{}
To: \clientName{}, \clientAddress{}

Date: \invoiceDate{}
Amount: \totalAmount{}
\end{document}

The node extracts variable names (companyName, invoiceNumber, etc.) and displays them in the UI for mapping.

Usage

Basic Workflow

  1. Prepare template file - Create a .tex file with \newcommand definitions on the file system
  2. Add LaTeX Template node - Configure template path
  3. Map variables - Drag workflow data to template variables (auto-discovered)
  4. Add Write Binary File node - Save the filled template to disk

Variable Mapping

Variables are mapped using n8n's resource mapper:

  • Auto-discovery: Enter template path, variables appear automatically
  • Drag-and-drop: Map workflow data to template variables visually
  • Expressions: Use n8n expressions like {{$json.fieldName}}
  • Auto-map: Click "Match by Field Name" to auto-map matching field names

Variable Behavior

  • Variables in template but not mapped: Remain unchanged with their original values
  • Variables mapped but not in template: Ignored
  • Multiple \newcommand definitions with same variable name: All replaced

Node Properties

Template File Path

Required

Path to the LaTeX template file containing \newcommand definitions. The file must be accessible from the n8n instance's file system.

Example: /home/user/templates/invoice-template.tex

Template Variables

Required

Resource mapper that auto-discovers variables from the template file. Map workflow data to template variables using drag-and-drop or expressions.

Example mappings:

  • invoiceNumber{{$json.number}}
  • totalAmount{{$json.amount}}
  • clientName{{$json.client.name}}

Output File Name

Optional

File name for the filled template in binary output. Supports n8n expressions.

Default behavior: If empty, generates filename as {template-name}-filled.tex

Examples:

  • invoice-{{$json.invoiceNumber}}.tex
  • contract-{{$json.clientId}}-{{$now}}.tex

Output

The node returns binary data containing the filled template and metadata in JSON format.

Binary Output

Binary property data contains the filled LaTeX template. Use the Write Binary File node to save it to disk.

JSON Output

{
  "success": true,
  "templatePath": "/tmp/invoice-template.tex",
  "fileName": "invoice-filled.tex",
  "templateVariables": ["companyName", "invoiceNumber", "totalAmount", "clientName"],
  "variablesReplaced": ["companyName", "invoiceNumber", "totalAmount"],
  "replacementCount": 3,
  "outputSize": 2048
}

Fields:

  • success: Processing status (boolean)
  • templatePath: Path to source template
  • fileName: Generated output filename
  • templateVariables: All variables found in template
  • variablesReplaced: Variables that were mapped and replaced
  • replacementCount: Number of variables replaced
  • outputSize: Size of filled template in bytes

Workflow Example

Input Data (Set Node)

{
  "company": "ACME Corporation",
  "invoiceId": "INV-2024-001",
  "amount": "1500.00",
  "clientName": "Wayne Enterprises"
}

LaTeX Template Node Configuration

  • Template Path: /home/user/invoice-template.tex
  • Variable Mappings:
    • companyName{{$json.company}}
    • invoiceNumber{{$json.invoiceId}}
    • totalAmount{{$json.amount}}
    • clientName{{$json.clientName}}

Write Binary File Node

  • File Path: /tmp/invoices/{{$json.invoiceId}}.tex
  • Binary Property: data

Result

File created at /tmp/invoices/INV-2024-001.tex with:

\newcommand{\companyName}{ACME Corporation}
\newcommand{\invoiceNumber}{INV-2024-001}
\newcommand{\totalAmount}{1500.00}
\newcommand{\clientName}{Wayne Enterprises}

Compatibility

Requires n8n version 1.0.0 or later.

Tested with:

  • n8n 1.x
  • Node.js 18.x, 20.x

This is a self-hosted node that requires file system access. It is not compatible with n8n Cloud.

Resources

License

MIT