DiCy

A JavaScript/TypeScript based builder for LaTeX, knitr, Literate Agda, Literate Haskell, and Pweave that automatically builds dependencies. It parses and filters output logs and error messages generated during build and can build projects that utilize the following programs to process files.

Installation

DiCy can be accessed via a library, via a JSON-RPC server or via the command line. The packages that implement these interfaces are listed below. In general to install a package use a command like npm install @dicy/core. Whereas to install for command line access use npm install -g @dicy/cli.

Package Description
@dicy/core JavaScript/TypeScript library interface
@dicy/client JavaScript/TypeScript library interface using JSON-RPC server
@dicy/cli Command line interface
@dicy/server JSON-RPC server interface

Documentation

Basic usage of the Command Line interface and library can be found below. For more detailed documentation please see the following pages.

Command Line Usage

The command line interface is generally called via

dicy [command] [options] [inputs...]

where the following commands are available (--help will enumerate options):

Command Alias Description
build b Build the inputs.
clean c Clean up after a previous build.
log l Report messages from any logs.
graph g Create a dependency graph from a previous build.
scrub s Clean all generated files from a previous build.
build,clean bc Build the inputs and then clean up.
build,log bl Build the inputs and report messages from any logs.
build,log,clean blc Build the inputs, report messages from any logs, and then clean up.

The options that can be specified are generally the same options accessible via the library interface.

Library Usage

The primary class in @dicy/core and @dicy/client is the DiCy class. For instance, to build foo.tex and report any log messages:

const dicy = new DiCy()

dicy.on('log', (filePath, messages) => {
  for (const message of messages) {
    const nameText = event.name ? `[${event.name}] ` : ''
    const typeText = event.category ? `${event.category}: ` : ''
    const text = `${event.severity} ${nameText}${typeText}${event.text.replace('\n', ' ')}`

    console.log(text)
  }
})

await dicy.setInstanceOptions('foo.tex', { synctex: true })
await dicy.run('foo.tex', ['load', 'build', 'log', 'save'])

Any sequence of commands listed below may be used, but the first and last commands should always be load and save, respectively.

Command Description
build Build the input file
clean Clean up after a build
graph Graph dependencies using GraphViz
log Report log messages generated

For more details regarding library usage please see the API documentation.