LaTeX Template icon

LaTeX Template

Fill LaTeX templates by replacing \newcommand variable definitions

Overview

This node processes LaTeX template files by filling in variables defined with \newcommand in the template. It reads a LaTeX template file, replaces the template variables with values mapped from workflow data, and outputs the filled template as a text file. This is useful for generating customized LaTeX documents such as invoices, reports, or letters based on dynamic data within an n8n workflow.

Use Case Examples

  1. Generating an invoice by filling an invoice template with customer and order details.
  2. Creating personalized letters by mapping user data to a LaTeX letter template.

Properties

Name Meaning
Template File Path Path to the LaTeX template file containing \newcommand definitions to be filled.
Template Variables Mapping of workflow data fields to the LaTeX template variables for replacement.
Output File Name File name for the filled template output. Supports expressions to dynamically name the file. If empty, defaults to the template name with '-filled' suffix.

Output

Binary

The filled LaTeX template file content as a binary data buffer with MIME type 'text/x-tex'.

JSON

  • success - Indicates if the template processing was successful.
  • templatePath - The path of the input LaTeX template file.
  • fileName - The name of the output filled template file.
  • templateVariables - List of variable names discovered in the template.
  • variablesReplaced - List of variable names that were replaced with values.
  • replacementCount - Number of variables replaced in the template.
  • outputSize - Size in characters of the filled template output content.
  • error - Error message if processing failed (present only if success is false).

Dependencies

  • Requires access to the file system to read the LaTeX template file.
  • Uses a LaTeX template processing utility to parse and replace variables.

Troubleshooting

  • Ensure the template file path is correct and accessible; file not found errors will occur otherwise.
  • Verify that the LaTeX template contains valid \newcommand definitions for variables to be replaced.
  • If variable mapping is incomplete or incorrect, some variables may not be replaced, resulting in partial output.
  • Errors during processing will throw exceptions unless 'Continue On Fail' is enabled, in which case errors are reported per item.

Discussion