From 2521bab254c892b716a2e10becef8bcf59a97151 Mon Sep 17 00:00:00 2001 From: "William J. Bowman" Date: Sun, 19 Jul 2020 23:04:16 -0700 Subject: [PATCH 1/9] Added support for tex2svg --- dollar.rkt | 57 ++++++++++++++++++++++++++++++++- info.rkt | 2 +- scribblings/scribble-math.scrbl | 51 +++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+), 2 deletions(-) diff --git a/dollar.rkt b/dollar.rkt index 607113f3b..c8458223a 100644 --- a/dollar.rkt +++ b/dollar.rkt @@ -9,7 +9,11 @@ setup/collects "katex-convert-unicode.rkt" "mathjax-convert-unicode.rkt" - racket/list) + racket/list + (only-in xml cdata) + (only-in racket/match match) + (only-in racket/system process) + (only-in racket/port port->string)) (provide $ $$ @@ -19,8 +23,12 @@ $$-katex $-mathjax $$-mathjax + $-tex2svg + $$-tex2svg use-katex use-mathjax + use-tex2svg + current-tex2svg-path with-html5) ;; KaTeX does not work well with the HTML 4.01 Transitional loose DTD, @@ -293,6 +301,41 @@ EOTEX (elem #:style math-inline-style-katex (map (λ (s) (katex-convert-unicode s #t)) (flatten strs)))) +(define current-tex2svg-path (make-parameter #f)) + +(define (find-tex2svg) + (define paths + (list + "./node_modules/.bin/" + "/usr/local/lib/node_modules/mathjax-node-cli/bin/" + "/usr/lib/node_modules/mathjax-node-cli/bin/" + "/usr/local/bin/" + "/usr/local/sbin/" + "/usr/bin/" + "/usr/sbin/")) + (for/or ([path paths]) + (file-exists? (format "~a/tex2svg" path)))) + +(define tex2svg + (let ([tex2svg-path (find-tex2svg)]) + (lambda (#:inline [inline #f] strs) + (if (or (current-tex2svg-path) tex2svg-path) + (match (process (format + "tex2svg ~a'~a'" + (if inline "--inline " "") + (apply string-append strs))) + [`(,stdout . ,_) + (port->string stdout)]) + (error 'tex2svg "Cannot find tex2svg in path or common places; set path manually with current-tex2svg-path."))))) + + +(define ($-tex2svg strs) + (elem #:style (style #f + (list + (xexpr-property + (cdata #f #f (tex2svg #:inline #t (flatten strs))) + (cdata #f #f "")))))) + (define ($$-mathjax strs) (elem #:style math-display-style-mathjax strs)) @@ -300,6 +343,13 @@ EOTEX (elem #:style math-display-style-katex (map (λ (s) (katex-convert-unicode s #t)) (flatten strs)))) +(define ($$-tex2svg strs) + (elem #:style (style #f + (list + (xexpr-property + (cdata #f #f (tex2svg (flatten strs))) + (cdata #f #f "")))))) + (define $-html-handler (make-parameter $-katex)) (define $$-html-handler (make-parameter $$-katex)) @@ -313,6 +363,11 @@ EOTEX ($$-html-handler $$-mathjax) (void)) +(define (use-tex2svg) + ($-html-handler $-tex2svg) + ($$-html-handler $$-tex2svg) + (void)) + (define ($ . strs) (let ([$- ($-html-handler)]) (cond-element diff --git a/info.rkt b/info.rkt index 9fa461e60..3be25c5cd 100644 --- a/info.rkt +++ b/info.rkt @@ -11,6 +11,6 @@ (define test-omit-paths '("MathJax" "katex")) (define scribblings '(("scribblings/scribble-math.scrbl" ()))) (define pkg-desc "Typesetting math and Asymptote figures in Scribble documents") -(define version "0.9") +(define version "0.10") (define pkg-authors '(|Georges Dupéron| |Jens Axel Søgaard|)) diff --git a/scribblings/scribble-math.scrbl b/scribblings/scribble-math.scrbl index 94738d1b2..ce0807bef 100644 --- a/scribblings/scribble-math.scrbl +++ b/scribblings/scribble-math.scrbl @@ -164,6 +164,24 @@ details see the documentation of @racket[with-html5]. that when the page is loaded into a browser, MathJax can recognise it and render it in @tech{display mode}.} +@defproc[($-tex2svg [math (listof? string?)]) element?]{ + Produces an @racket[element?] renders an HTML SVG literal. + It is rendered in @tech{inline mode} math using @tt{tex2svg}. + More precisely, the resulting element uses the @racket[xexpr-property] to + render the SVG directly to the HTML document. + This means no new scripts or stylesheets are added to the document. + It also has no style, so its style cannot be customized. + } + +@defproc[($$-tex2svg [math (listof? string?)]) element?]{ +Produces an @racket[element?] renders an HTML SVG literal. +It is rendered in @tech{display mode} math using @tt{tex2svg}. +More precisely, the resulting element uses the @racket[xexpr-property] to +render the SVG directly to the HTML document. +This means no new scripts or stylesheets are added to the document. +It also has no style, so its style cannot be customized. +} + @defproc[(use-katex) void?]{ This shorthand calls @racket[($-html-handler $-katex)] and @racket[($$-html-handler $$-katex)]. The mathematical @@ -194,6 +212,35 @@ details see the documentation of @racket[with-html5]. page if the user changes the default before typesetting any math.} +@defproc[(use-tex2svg) void?]{ + This shorthand calls @racket[($-html-handler $-tex2svg)] and + @racket[($$-html-handler $$-tex2svg)]. The mathematical forumulas passed to + @racket[$] and @racket[$$] which appear later in the document will therefore be + typeset using @tt{tex2svg}. + + No new CSS or JavaScript libraries will be added to the document. Instead, the + generated HTML document have the math embedded directly an @tt{svg}. + + This requires that @tt{tex2svg} is installed on the system. You can install it + globally via @tt{sudo npm install --global mathjax-node-cli} or locally with + @tt{npm install mathjax-node-cli}. The backend will attempt to find the + @tt{tex2svg}, preferring local sources. You can set the path manually with + the parameter @racket[current-tex2svg-path]. + + @tt{tex2svg} will only be used when rendering an HTML document, and only if it + uses @racket[$] or @racket[$$] to render math. It is therefore safe to call + this function in libraries to change the default handler. +} + +@defparam[current-tex2svg-path path path? #:value #f]{ +A parameter whose value is the path to the @tt{tex2svg} binary. +This binary is used to transform math code into HTML when using the @tt{tex2svg} +backend. +The functions @racket[$] and @racket[$$] use this parameter only when rendering +the document as HTML. +} + + @;@$${\sum_{i=0}ⁿ xᵢ³} When using MathJax, @racket[$] and @racket[$$] wrap their @@ -204,6 +251,10 @@ process elements with this class, so it is safe to use @tt{$} signs in the source document. For example, the text $\sum x^3$ is typeset as-is, like the rest of the text. +When using @tt{tex2svg}, no additional JavaScript processing is done on the +page, so it is safe to use @tt{$} signs in the source document. For example, the +text $\sum x^3$ is typeset as-is, like the rest of the text. + @section{Drawing figures with Asymptote} @defmodule[scribble-math/asymptote] From cb0c2b623a8d7fea366dd2ca8c75d530db407996 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Thu, 23 Jul 2020 19:22:50 +0100 Subject: [PATCH 2/9] Apply suggestions from code review --- scribblings/scribble-math.scrbl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scribblings/scribble-math.scrbl b/scribblings/scribble-math.scrbl index ce0807bef..ee5ddf193 100644 --- a/scribblings/scribble-math.scrbl +++ b/scribblings/scribble-math.scrbl @@ -165,7 +165,8 @@ details see the documentation of @racket[with-html5]. recognise it and render it in @tech{display mode}.} @defproc[($-tex2svg [math (listof? string?)]) element?]{ - Produces an @racket[element?] renders an HTML SVG literal. + Produces an @racket[element?] which contains the given + @racket[math] rendered as an HTML SVG literal. It is rendered in @tech{inline mode} math using @tt{tex2svg}. More precisely, the resulting element uses the @racket[xexpr-property] to render the SVG directly to the HTML document. @@ -174,7 +175,8 @@ details see the documentation of @racket[with-html5]. } @defproc[($$-tex2svg [math (listof? string?)]) element?]{ -Produces an @racket[element?] renders an HTML SVG literal. +Produces an @racket[element?] which contains the given +@racket[math] rendered as an HTML SVG literal. It is rendered in @tech{display mode} math using @tt{tex2svg}. More precisely, the resulting element uses the @racket[xexpr-property] to render the SVG directly to the HTML document. @@ -236,8 +238,8 @@ It also has no style, so its style cannot be customized. A parameter whose value is the path to the @tt{tex2svg} binary. This binary is used to transform math code into HTML when using the @tt{tex2svg} backend. -The functions @racket[$] and @racket[$$] use this parameter only when rendering -the document as HTML. +The functions @racket[$-tex2svg] and @racket[$$-tex2svg] use this parameter only +when rendering the document as HTML. } @@ -317,4 +319,4 @@ text $\sum x^3$ is typeset as-is, like the rest of the text. draw(root, (0,0)); shipout(scale(2)*currentpicture.fit()); } -} \ No newline at end of file +} From 52423aca0d0ff3375add8c65100e3721262e817a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Thu, 23 Jul 2020 21:26:38 +0100 Subject: [PATCH 3/9] Use version-case to enable tex2svg on Racket 6.12 and above (previous versions lack `xexpr-property`). Will add the dependency on version-case in `info.rkt` as a separate commit, since you can't make code suggestions for lines which are too far from the diff, see https://github.com/isaacs/github/issues/284) --- dollar.rkt | 87 ++++++++++++++++++--------------- scribblings/scribble-math.scrbl | 37 ++++++++------ 2 files changed, 68 insertions(+), 56 deletions(-) diff --git a/dollar.rkt b/dollar.rkt index c8458223a..785b61e2d 100644 --- a/dollar.rkt +++ b/dollar.rkt @@ -10,6 +10,7 @@ "katex-convert-unicode.rkt" "mathjax-convert-unicode.rkt" racket/list + version-case (only-in xml cdata) (only-in racket/match match) (only-in racket/system process) @@ -301,40 +302,42 @@ EOTEX (elem #:style math-inline-style-katex (map (λ (s) (katex-convert-unicode s #t)) (flatten strs)))) -(define current-tex2svg-path (make-parameter #f)) +(version-case + [(version>= (version) "6.11.0.900"] + (define current-tex2svg-path (make-parameter #f)) -(define (find-tex2svg) - (define paths - (list - "./node_modules/.bin/" - "/usr/local/lib/node_modules/mathjax-node-cli/bin/" - "/usr/lib/node_modules/mathjax-node-cli/bin/" - "/usr/local/bin/" - "/usr/local/sbin/" - "/usr/bin/" - "/usr/sbin/")) - (for/or ([path paths]) - (file-exists? (format "~a/tex2svg" path)))) + (define (find-tex2svg) + (define paths + (list + "./node_modules/.bin/" + "/usr/local/lib/node_modules/mathjax-node-cli/bin/" + "/usr/lib/node_modules/mathjax-node-cli/bin/" + "/usr/local/bin/" + "/usr/local/sbin/" + "/usr/bin/" + "/usr/sbin/")) + (for/or ([path paths]) + (file-exists? (format "~a/tex2svg" path)))) -(define tex2svg - (let ([tex2svg-path (find-tex2svg)]) - (lambda (#:inline [inline #f] strs) - (if (or (current-tex2svg-path) tex2svg-path) - (match (process (format - "tex2svg ~a'~a'" - (if inline "--inline " "") - (apply string-append strs))) - [`(,stdout . ,_) - (port->string stdout)]) - (error 'tex2svg "Cannot find tex2svg in path or common places; set path manually with current-tex2svg-path."))))) + (define tex2svg + (let ([tex2svg-path (find-tex2svg)]) + (lambda (#:inline [inline #f] strs) + (if (or (current-tex2svg-path) tex2svg-path) + (match (process (format + "tex2svg ~a'~a'" + (if inline "--inline " "") + (apply string-append strs))) + [`(,stdout . ,_) + (port->string stdout)]) + (error 'tex2svg "Cannot find tex2svg in path or common places; set path manually with current-tex2svg-path."))))) -(define ($-tex2svg strs) - (elem #:style (style #f - (list - (xexpr-property - (cdata #f #f (tex2svg #:inline #t (flatten strs))) - (cdata #f #f "")))))) + (define ($-tex2svg strs) + (elem #:style (style #f + (list + (xexpr-property + (cdata #f #f (tex2svg #:inline #t (flatten strs))) + (cdata #f #f ""))))))]) (define ($$-mathjax strs) (elem #:style math-display-style-mathjax strs)) @@ -343,12 +346,14 @@ EOTEX (elem #:style math-display-style-katex (map (λ (s) (katex-convert-unicode s #t)) (flatten strs)))) -(define ($$-tex2svg strs) - (elem #:style (style #f - (list - (xexpr-property - (cdata #f #f (tex2svg (flatten strs))) - (cdata #f #f "")))))) +(version-case + [(version>= (version) "6.11.0.900"] + (define ($$-tex2svg strs) + (elem #:style (style #f + (list + (xexpr-property + (cdata #f #f (tex2svg (flatten strs))) + (cdata #f #f ""))))))]) (define $-html-handler (make-parameter $-katex)) (define $$-html-handler (make-parameter $$-katex)) @@ -363,10 +368,12 @@ EOTEX ($$-html-handler $$-mathjax) (void)) -(define (use-tex2svg) - ($-html-handler $-tex2svg) - ($$-html-handler $$-tex2svg) - (void)) +(version-case + [(version>= (version) "6.11.0.900"] + (define (use-tex2svg) + ($-html-handler $-tex2svg) + ($$-html-handler $$-tex2svg) + (void))]) (define ($ . strs) (let ([$- ($-html-handler)]) diff --git a/scribblings/scribble-math.scrbl b/scribblings/scribble-math.scrbl index ee5ddf193..2dc1e2b43 100644 --- a/scribblings/scribble-math.scrbl +++ b/scribblings/scribble-math.scrbl @@ -172,17 +172,19 @@ details see the documentation of @racket[with-html5]. render the SVG directly to the HTML document. This means no new scripts or stylesheets are added to the document. It also has no style, so its style cannot be customized. - } + + This procedure requires Racket 6.12 or later.} @defproc[($$-tex2svg [math (listof? string?)]) element?]{ -Produces an @racket[element?] which contains the given -@racket[math] rendered as an HTML SVG literal. -It is rendered in @tech{display mode} math using @tt{tex2svg}. -More precisely, the resulting element uses the @racket[xexpr-property] to -render the SVG directly to the HTML document. -This means no new scripts or stylesheets are added to the document. -It also has no style, so its style cannot be customized. -} + Produces an @racket[element?] which contains the given + @racket[math] rendered as an HTML SVG literal. + It is rendered in @tech{display mode} math using @tt{tex2svg}. + More precisely, the resulting element uses the @racket[xexpr-property] to + render the SVG directly to the HTML document. + This means no new scripts or stylesheets are added to the document. + It also has no style, so its style cannot be customized. + + This procedure requires Racket 6.12 or later.} @defproc[(use-katex) void?]{ This shorthand calls @racket[($-html-handler $-katex)] @@ -232,15 +234,18 @@ It also has no style, so its style cannot be customized. @tt{tex2svg} will only be used when rendering an HTML document, and only if it uses @racket[$] or @racket[$$] to render math. It is therefore safe to call this function in libraries to change the default handler. -} + + This procedure requires Racket 6.12 or later.} @defparam[current-tex2svg-path path path? #:value #f]{ -A parameter whose value is the path to the @tt{tex2svg} binary. -This binary is used to transform math code into HTML when using the @tt{tex2svg} -backend. -The functions @racket[$-tex2svg] and @racket[$$-tex2svg] use this parameter only -when rendering the document as HTML. -} + A parameter whose value is the path to the @tt{tex2svg} binary. + This binary is used to transform math code into HTML when using the @tt{tex2svg} + backend. + + The functions @racket[$-tex2svg] and @racket[$$-tex2svg] use this parameter only + when rendering the document as HTML. + + This parameter requires Racket 6.12 or later.} @;@$${\sum_{i=0}ⁿ xᵢ³} From 746d58b4266b5811e14a9646d4488ba513bf2297 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Thu, 23 Jul 2020 21:28:03 +0100 Subject: [PATCH 4/9] Use version-case to enable tex2svg on Racket 6.12 and above (previous versions lack `xexpr-property`). --- info.rkt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/info.rkt b/info.rkt index 3be25c5cd..22001dd6e 100644 --- a/info.rkt +++ b/info.rkt @@ -2,7 +2,8 @@ (define collection "scribble-math") (define deps '("base" "rackunit-lib" - "scribble-lib")) + "scribble-lib" + "version-case")) (define build-deps '("scribble-lib" "racket-doc" "at-exp-lib" From 7a4b5139bb464078957f0c9c310ef737b12932d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Thu, 23 Jul 2020 22:00:27 +0100 Subject: [PATCH 5/9] Don't use version-case, it is not compatible with Racket 6.1 --- dollar.rkt | 22 ++++++++++++---------- info.rkt | 3 +-- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/dollar.rkt b/dollar.rkt index 785b61e2d..294212184 100644 --- a/dollar.rkt +++ b/dollar.rkt @@ -10,7 +10,6 @@ "katex-convert-unicode.rkt" "mathjax-convert-unicode.rkt" racket/list - version-case (only-in xml cdata) (only-in racket/match match) (only-in racket/system process) @@ -32,6 +31,12 @@ current-tex2svg-path with-html5) +(define-syntax (if-version≥6.12 stx) + (syntax-case stx () + [(_ . rest) + (if (version>= (version) "6.11.0.900") + #'(begin . rest) + #'(begin))])) ;; KaTeX does not work well with the HTML 4.01 Transitional loose DTD, ;; so we define a style modifier which replaces the prefix for HTML rendering. (define (with-html5 doc-style) @@ -302,8 +307,7 @@ EOTEX (elem #:style math-inline-style-katex (map (λ (s) (katex-convert-unicode s #t)) (flatten strs)))) -(version-case - [(version>= (version) "6.11.0.900"] +(if-version≥6.12 (define current-tex2svg-path (make-parameter #f)) (define (find-tex2svg) @@ -337,7 +341,7 @@ EOTEX (list (xexpr-property (cdata #f #f (tex2svg #:inline #t (flatten strs))) - (cdata #f #f ""))))))]) + (cdata #f #f ""))))))) (define ($$-mathjax strs) (elem #:style math-display-style-mathjax strs)) @@ -346,14 +350,13 @@ EOTEX (elem #:style math-display-style-katex (map (λ (s) (katex-convert-unicode s #t)) (flatten strs)))) -(version-case - [(version>= (version) "6.11.0.900"] +(if-version≥6.12 (define ($$-tex2svg strs) (elem #:style (style #f (list (xexpr-property (cdata #f #f (tex2svg (flatten strs))) - (cdata #f #f ""))))))]) + (cdata #f #f ""))))))) (define $-html-handler (make-parameter $-katex)) (define $$-html-handler (make-parameter $$-katex)) @@ -368,12 +371,11 @@ EOTEX ($$-html-handler $$-mathjax) (void)) -(version-case - [(version>= (version) "6.11.0.900"] +(if-version≥6.12 (define (use-tex2svg) ($-html-handler $-tex2svg) ($$-html-handler $$-tex2svg) - (void))]) + (void))) (define ($ . strs) (let ([$- ($-html-handler)]) diff --git a/info.rkt b/info.rkt index 22001dd6e..3be25c5cd 100644 --- a/info.rkt +++ b/info.rkt @@ -2,8 +2,7 @@ (define collection "scribble-math") (define deps '("base" "rackunit-lib" - "scribble-lib" - "version-case")) + "scribble-lib")) (define build-deps '("scribble-lib" "racket-doc" "at-exp-lib" From a2467d16829ec6cbc0b1f50d524e02163522ec1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Thu, 23 Jul 2020 22:04:21 +0100 Subject: [PATCH 6/9] Need racket/base at the macro level. --- dollar.rkt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dollar.rkt b/dollar.rkt index 294212184..be6613375 100644 --- a/dollar.rkt +++ b/dollar.rkt @@ -13,7 +13,8 @@ (only-in xml cdata) (only-in racket/match match) (only-in racket/system process) - (only-in racket/port port->string)) + (only-in racket/port port->string) + (for-syntax racket/base)) (provide $ $$ From 6094bbc572867f09d56d9da06ade05d11f7f25df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Thu, 23 Jul 2020 22:24:38 +0100 Subject: [PATCH 7/9] Update dollar.rkt --- dollar.rkt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dollar.rkt b/dollar.rkt index be6613375..c78280159 100644 --- a/dollar.rkt +++ b/dollar.rkt @@ -35,9 +35,11 @@ (define-syntax (if-version≥6.12 stx) (syntax-case stx () [(_ . rest) - (if (version>= (version) "6.11.0.900") - #'(begin . rest) - #'(begin))])) + (if (and (not (regexp-match #px"^6\.11\.0\.900$" (version))) + (or (regexp-match #px"^6(\\.([0123456789]|10|11)(\\..*|)|)$" (version)) + (regexp-match #px"^[123245]\\..*$" (version)))) + #'(begin) + #'(begin . rest))])) ;; KaTeX does not work well with the HTML 4.01 Transitional loose DTD, ;; so we define a style modifier which replaces the prefix for HTML rendering. (define (with-html5 doc-style) From 11600d212eb5ab66cfc3e4caee28494e86c09141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Thu, 23 Jul 2020 23:10:05 +0100 Subject: [PATCH 8/9] Fix escape sequence in regexp --- dollar.rkt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dollar.rkt b/dollar.rkt index c78280159..43ad44c77 100644 --- a/dollar.rkt +++ b/dollar.rkt @@ -35,7 +35,7 @@ (define-syntax (if-version≥6.12 stx) (syntax-case stx () [(_ . rest) - (if (and (not (regexp-match #px"^6\.11\.0\.900$" (version))) + (if (and (not (regexp-match #px"^6\\.11\\.0\\.900$" (version))) (or (regexp-match #px"^6(\\.([0123456789]|10|11)(\\..*|)|)$" (version)) (regexp-match #px"^[123245]\\..*$" (version)))) #'(begin) From f6b388b4629d37664de061371c92c81eca91b993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Sat, 25 Jul 2020 04:36:31 +0100 Subject: [PATCH 9/9] Don't export identifiers which are not implemented before Racket 6.12 --- dollar.rkt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dollar.rkt b/dollar.rkt index 43ad44c77..7afd062db 100644 --- a/dollar.rkt +++ b/dollar.rkt @@ -24,12 +24,8 @@ $$-katex $-mathjax $$-mathjax - $-tex2svg - $$-tex2svg use-katex use-mathjax - use-tex2svg - current-tex2svg-path with-html5) (define-syntax (if-version≥6.12 stx) @@ -40,6 +36,12 @@ (regexp-match #px"^[123245]\\..*$" (version)))) #'(begin) #'(begin . rest))])) + +(if-version≥6.12 + (provide $-tex2svg + $$-tex2svg + use-tex2svg + current-tex2svg-path)) ;; KaTeX does not work well with the HTML 4.01 Transitional loose DTD, ;; so we define a style modifier which replaces the prefix for HTML rendering. (define (with-html5 doc-style)