Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/saadq/latrex
A small library for running LaTeX child processes in Deno.
https://github.com/saadq/latrex
child-process deno latex tex
Last synced: 2 months ago
JSON representation
A small library for running LaTeX child processes in Deno.
- Host: GitHub
- URL: https://github.com/saadq/latrex
- Owner: saadq
- License: mit
- Created: 2021-11-02T09:58:17.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-12-09T02:01:33.000Z (about 3 years ago)
- Last Synced: 2024-11-15T10:28:55.374Z (2 months ago)
- Topics: child-process, deno, latex, tex
- Language: TypeScript
- Homepage: https://doc.deno.land/https://deno.land/x/[email protected]/mod.ts
- Size: 10.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# latrex
> A small library for running LaTeX child processes in Deno.
## Docs
https://doc.deno.land/https://deno.land/x/[email protected]/mod.ts
## Requirements
LaTeX must be installed on your machine. You can download it [here](https://www.latex-project.org/get/).
## Usage
### TeX file
```ts
import { latrex } from "https://deno.land/x/[email protected]/mod.ts";const document = await Deno.readFile("./document.tex");
const pdf = await latrex(document);
await Deno.writeFile("./output.pdf", pdf);
```### TeX string
```ts
import { latrex } from "https://deno.land/x/[email protected]/mod.ts";const document = `
\\documentclass{article}
\\begin{document}
hello world
\\end{document}
`const pdf = await latrex(document);
await Deno.writeFile("./output.pdf", pdf);
```### With all options
```ts
const pdf = await latrex(document, {
command: 'xelatex',
args: ['-no-file-line-error', '-no-pdf'],
inputs: ['./styles', './fonts'],
passes: 3,
errorLogsPath: './my-tex-errors.log'
});
```### Options
| **Option** | **Type** | **Default** | **Description** |
| --------------- | ---------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `command` | `string` | `'pdflatex'` | The command to run for your compiling your LaTeX document (pdflatex, xetex, /user/bin/custom-tex, etc). |
| `args` | `string[]` | `['-halt-on-error']` | Arguments passed to the command. |
| `passes` | `number` | `1` | The number of times to run `options.command`. Some documents require multiple passes. Only works when doc is a string. |
| `inputs` | `string[]` | N/A | A list of absolute paths to the directory which contains the assets necessary for the doc (such as fonts or cls files, etc). |
| `errorLogsPath` | `string` | N/A | The path to the file where you want to save the contents of the error log to. |