This project brings SciGen to JavaScript, both for Node and for the browser.
Try it here!
Usage
Node
import { scigen, scigenSave } from 'scigen'
const files = scigen(
['Jeremy Stribling', 'Max Krohn', 'Dan Aguayo'],
false)
console.log(files['paper.tex'])
scigenSave(
'mydir',
undefined,
true)
CLI
$ git clone git@github.com:davidpomerenke/scigen.js && cd scigen
$ node lib/cli.js --help
Usage: node cli.js --save [<directory>] [--authors "<author1>, <author2>, ..."] [--bibinlatex] [--silent]
directory all files (.tex, .eps, .cls, .bib, ...) will be saved here
authors list of the authors in the paper
bibinlatex avoids dependency on BibTex (useful especially for texlive.js)
silent skip info logging
$ node cli.js --save tmp --authors "Jeremy Stribling, Max Krohn, Dan Aguayo" --silent
$ cd tmp
$ pdflatex -interaction=nonstopmode paper.tex
$ bibtex paper.aux
$ pdflatex -interaction=nonstopmode paper.tex
$ pdflatex -interaction=nonstopmode paper.tex
$ xdg-open paper.pdf
Browser
$ git clone git@github.com:davidpomerenke/scigen.js && cd scigen
$ npx webpack
$ python -m http.server -d docs
$ xdg-open http://localhost:8000
See also the TexLive.js Wiki.
Rule Compilation
The almost original rule files from the original SciGen project are found in rules/rules-original
. They can be compiled to JSON by running perl rules/compile-rules.pl
. The JSON files are required for running the module. They are already included in the module and only need to be re-compiled for applying changes in the original .in
rule files.
Limitations
- Bibtex is not available for the browser (cf. here). An almost perfect workaround is implemented for the parameter
--bibinlatex
(or setting the second/third function parameter to true
in Node, see the above examples). - Rendering diagrams and figures requires Ghostscript in the original SciGen project. Ghostscript is not available for the browser. A workaround would probably involve rewriting the original EPS rules in some format which is supported by TexLive.js (maybe SVG or TIKZ). As this module is aimed at the browser, the diagram and figure code production is not yet implemented in the JavaScript code. For locally producing TEX and PDF files with figures and diagrams, use the original SciGen project with this unmerged fix.
- Works in Firefox but not in Chromium.
Motivation
The server-side code at the original SciGen website appears to be broken. The aim of this project is therefore to provide a more server-independent implementation.