diff --git a/README.md b/README.md index ca427ca..1b39716 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ Turns the LaTeX expression `expr` into an image encoded as a stream. You can tw * `dpi`: Dots-per-inch determines the resolution of resulting image. Default: 300 * `format`: Resulting image format. Default `png` +* `displaystyle`: (boolean) Use display style for forulae, defaults to `false` (inline) * `packages`: A list of extra LaTeX packages to include. Default `["amsmath"]` * `macros`: A list of LaTeX preprocessor macros. Default `""` * `pdflatex_path`: A path the `pdflatex` executable. Default: `pdflatex` diff --git a/mathmode.js b/mathmode.js index 68b0c83..41764d8 100644 --- a/mathmode.js +++ b/mathmode.js @@ -15,6 +15,7 @@ module.exports = function(expr, options) { } var format = options.format || "png"; var size = options.dpi || 300; + var ds = options.displaystyle ? '\\displaystyle' : ''; var package_list = options.packages || [ "amsmath" ]; var packages = []; @@ -35,7 +36,7 @@ module.exports = function(expr, options) { "\\usepackage{transparent}", options.macros || "", "\\begin{document}", - "\\begin{preview} $", + "\\begin{preview} $"+ds, sanitize(expr), "$ \\end{preview}", "\\end{document}" @@ -60,4 +61,4 @@ module.exports = function(expr, options) { tex_stream.pipe(convert.stdin); return result; -} \ No newline at end of file +} diff --git a/script.js b/script.js new file mode 100644 index 0000000..f350388 --- /dev/null +++ b/script.js @@ -0,0 +1,3 @@ +require('./mathmode')('{\\Sigma = \\{0,\\dots, M\\}}', { + displaystyle: true +}).pipe(process.stdout);