gulp-mathmode

Turns LaTeX math expressions into images.

Usage no npm install needed!

<script type="module">
  import gulpMathmode from 'https://cdn.skypack.dev/gulp-mathmode';
</script>

README

gulp-mathmode

Turn LaTeX math expressions into images.

Based on mathmode.

Install

Install with npm.

npm install --save-dev gulp-mathmode

LaTeX math expressions

List of possible math

Usage Examples

Turns list of tex-files into png-images with the same names.

var srcPath = 'src/**/*.tex';
var buildPath = 'build/**/*.tex';

gulp.task('clean', function () {
    var clean = require('gulp-clean');
    return gulp.src(buildPath + '/*.png', {read: false})
        .pipe(clean());
});

gulp.task('math', ['clean'], function () {
    var math = require('gulp-mathmode'),
        rename = require("gulp-rename");
    gulp.src(srcPath)
        .pipe(math({
            format: format,
            dpi: 300
        }))
        .pipe(rename({extname: '.' + format}))
        .pipe(gulp.dest(buildPath));
});

Configuration

Look at mathmode configs.

require('gulp-mathmode')({
    format: 'png',
    dpi: 300,
    packages: ["amsmath"],
    macros: "",
    pdflatex_path: "pdflatex",
    imagemagick_path: "convert"
}