Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/saadq/node-latex
๐งพ A utility for running LaTeX subprocesses in Node.
https://github.com/saadq/node-latex
javascript latex node-latex nodejs pdflatex wrapper xelatex
Last synced: 26 days ago
JSON representation
๐งพ A utility for running LaTeX subprocesses in Node.
- Host: GitHub
- URL: https://github.com/saadq/node-latex
- Owner: saadq
- License: mit
- Created: 2017-01-21T00:37:40.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-23T20:18:41.000Z (almost 2 years ago)
- Last Synced: 2024-12-24T21:43:14.900Z (28 days ago)
- Topics: javascript, latex, node-latex, nodejs, pdflatex, wrapper, xelatex
- Language: JavaScript
- Homepage:
- Size: 155 KB
- Stars: 59
- Watchers: 4
- Forks: 22
- Open Issues: 10
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
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](https://www.latex-project.org/get/).
## Install
```
npm install node-latex
```## Usage
```js
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](https://github.com/saadq/node-latex/tree/master/examples).
## 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