From a774495d5fafa087c99dc9e579dfaf0ae51d567a Mon Sep 17 00:00:00 2001 From: Abraham Toriz Cruz Date: Sat, 20 Aug 2016 22:38:53 -0500 Subject: [PATCH 1/3] add displaystyle option --- mathmode.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 +} From 35937239e1f3c36f4e53009839a98d5682566031 Mon Sep 17 00:00:00 2001 From: Abraham Toriz Cruz Date: Sat, 20 Aug 2016 23:18:45 -0500 Subject: [PATCH 2/3] add new `displaystyle` option to README (closes #6) --- README.md | 1 + 1 file changed, 1 insertion(+) 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` From edd53d297943a64e74e5e5f6df59a845672a0d8d Mon Sep 17 00:00:00 2001 From: Abraham Toriz Cruz Date: Sat, 8 Jul 2017 17:40:51 -0500 Subject: [PATCH 3/3] sample script --- script.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 script.js 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);