nl
@benjamin-vanryseghem/node-latex
npm i @benjamin-vanryseghem/node-latex
nl

@benjamin-vanryseghem/node-latex

🧾 A utility for running LaTeX subprocesses in Node.

by Saad Quadri

2.6.3 (see all)License:MITTypeScript:Built-In
npm i @benjamin-vanryseghem/node-latex
Readme

node-latex

A small wrapper for generating PDFs with LaTeX in Node.

Requirements

LaTeX must be installed on your machine. You can download it here.

Install

npm install node-latex

Usage

const latex = require('node-latex')
const fs = require('fs')

const input = fs.createReadStream('input.tex')
const output = fs.createWriteStream('output.pdf')
const pdf = latex(input)

pdf.pipe(output)
pdf.on('error', err => console.error(err))
pdf.on('finish', () => console.log('PDF generated!'))

View more examples here.

API

latex(doc[, options])

doc [ReadableStream|String] Required - The (La)TeX document you want to use.

options.inputs [String|Array] - The path (or an array of paths) to the directory which contains the assets necessary for the doc.

options.precompiled [String|Array] - The path (or an array of paths) to the directory which contains the precompiled files necessary for the doc.

options.fonts [String|Array] - The path (or an array of paths) to the directory which contains the fonts necessary for the doc (you will most likely want to use this option if you're working with fontspec).

options.cmd [String] - The command to run for your document (pdflatex, xetex, etc). pdflatex is the default.

options.args [Array] - Arguments passed to cmd. Defaults to ['-halt-on-error'].

options.passes [Number] - The number of times to run options.cmd. Some documents require multiple passes. Only works when doc is a String. Defaults to 1.

options.errorLogs [String] - The path to the file where you want to save the contents of the error log to.

License

MIT

Downloads/wk

4

GitHub Stars

35

LAST COMMIT

6mos ago

MAINTAINERS

1

CONTRIBUTORS

11

OPEN ISSUES

4

OPEN PRs

1
VersionTagPublished
2.6.3
latest
2yrs ago
No alternatives found
No tutorials found
Add a tutorial