# node-latex

> A small wrapper for LaTeX.

Latest version **3.1.0** (published 2021-11-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-latex
pnpm add node-latex
yarn add node-latex
bun add node-latex
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.1.0 |
| Published | 2021-11-25 |
| First published | 2017-01-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 10.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 63 |
| Author | Saad Quadri |
| Maintainers | saadq |
| Keywords | latex, pdflatex, xetex, pdf |

## Links

- npm: https://www.npmjs.com/package/node-latex
- Repository: https://github.com/saadq/node-latex
- Homepage: https://github.com/saadq/node-latex#readme
- Issues: https://github.com/saadq/node-latex/issues
- npm.io page: https://npm.io/package/node-latex

## Dependencies (5)

- [temp](https://npm.io/package/temp.md) ^0.8.3
- [fs-extra](https://npm.io/package/fs-extra.md) ^2.0.0
- [through2](https://npm.io/package/through2.md) ^2.0.3
- [@types/node](https://npm.io/package/@types/node.md) ^11.12.0
- [string-to-stream](https://npm.io/package/string-to-stream.md) ^1.1.0

## Alternatives

- [@cantoo/pdf-lib](https://npm.io/package/@cantoo/pdf-lib.md) — 297.9K weekly downloads
- [datatables.net-buttons](https://npm.io/package/datatables.net-buttons.md) — 200.1K weekly downloads
- [@ckeditor/ckeditor5-export-pdf](https://npm.io/package/@ckeditor/ckeditor5-export-pdf.md) — 167.0K weekly downloads
- [scanbot-web-sdk](https://npm.io/package/scanbot-web-sdk.md) — 15.0K weekly downloads
- [@syncfusion/ej2-angular-pdfviewer](https://npm.io/package/@syncfusion/ej2-angular-pdfviewer.md) — 8.8K weekly downloads

## Recent versions

- 3.1.0 (latest) — 2021-11-25
- 2.6.0-dev.0 (dev) — 2019-05-06
- 2.6.4 — 2021-11-25
- 3.0.0 — 2020-06-30
- 2.6.3 — 2019-12-13
- 2.6.2 — 2019-08-17
- 2.6.1 — 2019-08-10
- 2.6.0 — 2019-03-28
- 2.4.7 — 2019-03-28
- 2.4.6 — 2019-03-28
- 2.4.4 — 2017-12-23
- 2.4.3 — 2017-11-19
- 2.4.2 — 2017-11-09
- 2.5.0 — 2017-09-29
- 2.4.1 — 2017-05-17
- … 10 more at https://npm.io/package/node-latex/versions

## 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<String>\] - The path (or an array of paths) to the directory which contains the assets necessary for the doc.

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

**options.fonts** \[String|Array<String>\] - 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<String>\] - 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

---
_Source: https://npm.io/package/node-latex · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
