From 376c0f5f935944f1b4f1b61e9fc4567169861bff Mon Sep 17 00:00:00 2001 From: Alexander Date: Tue, 1 Jul 2025 19:25:02 -0400 Subject: [PATCH] initial switch to latexmlmath, per #5 --- .gitignore | 3 ++- acl.cool/math_wrapper.sh | 1 + build.sh | 2 +- css/fonts.css | 2 +- css/looks.css | 2 +- math_wrapper.sh | 11 +++++++++++ soupault.toml | 4 ++-- ytheleus.org/math_wrapper.sh | 1 + 8 files changed, 20 insertions(+), 6 deletions(-) create mode 120000 acl.cool/math_wrapper.sh create mode 100755 math_wrapper.sh create mode 120000 ytheleus.org/math_wrapper.sh diff --git a/.gitignore b/.gitignore index 78623cd..30560b6 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ all_chars.txt woff2/ **/serve_* /lexers.out -fonts/*trial \ No newline at end of file +fonts/*trial +**/*.log diff --git a/acl.cool/math_wrapper.sh b/acl.cool/math_wrapper.sh new file mode 120000 index 0000000..f40564e --- /dev/null +++ b/acl.cool/math_wrapper.sh @@ -0,0 +1 @@ +../math_wrapper.sh \ No newline at end of file diff --git a/build.sh b/build.sh index 7499ae4..9a3d098 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,6 @@ #! /usr/bin/env nix-shell #! nix-shell --pure -i bash -#! nix-shell --pure -p nodejs_24 bash harfbuzz soupault woff2 jotdown python3 recode nodePackages_latest.katex minify +#! nix-shell --pure -p nodejs_24 bash harfbuzz soupault woff2 jotdown python3 recode perl538Packages.LaTeXML minify if ! [[ -d pgvv/ ]]; then python3 -m venv pgvv diff --git a/css/fonts.css b/css/fonts.css index aa31541..35a1487 100644 --- a/css/fonts.css +++ b/css/fonts.css @@ -245,8 +245,8 @@ code, pre code { font-size: calc(0.84 * var(--base-font-size)); } +/* for STIX 2 */ math { - color: black; font-family: "Math"; font-size: calc(0.96 * var(--base-font-size)); } \ No newline at end of file diff --git a/css/looks.css b/css/looks.css index 43dd9c5..b59acd5 100644 --- a/css/looks.css +++ b/css/looks.css @@ -189,7 +189,7 @@ math[display="block"] { position: relative; left: 0; right: auto; - text-align: left; + text-align: center; } footer { diff --git a/math_wrapper.sh b/math_wrapper.sh new file mode 100755 index 0000000..b3b99c2 --- /dev/null +++ b/math_wrapper.sh @@ -0,0 +1,11 @@ +#! /usr/bin/env sh + +if [ $# -lt 1 ]; then + echo -n 'BLOCK MATH ERROR' +elif [[ "$1" == "display" ]]; then + echo -n '

' + latexmlmath --preload=amsmath.sty --preload=amssymb.sty - + echo -n '

' +else + latexmlmath --preload=amsmath.sty --preload=amssymb.sty - +fi \ No newline at end of file diff --git a/soupault.toml b/soupault.toml index 100a915..7d8e4e3 100644 --- a/soupault.toml +++ b/soupault.toml @@ -132,11 +132,11 @@ command = "./syntax_wrapper.sh ${ATTR_CLASS##*-}" [widgets.math-inline] widget = "preprocess_element" selector = "span.math.inline" -command = "sed -E 's/^\\\\\\((.*)\\\\\\)$/\\1/' | katex --format mathml" +command = "./math_wrapper.sh inline" action = "replace_element" [widgets.math-display] widget = "preprocess_element" selector = "span.math.display" -command = "sed -E 's/^\\\\\\[(.*)\\\\\\]$/\\1/' | katex -d --fleqn --format mathml | awk '{print \"

\" $0 \"

\"}'" +command = "./math_wrapper.sh display" action = "replace_element" \ No newline at end of file diff --git a/ytheleus.org/math_wrapper.sh b/ytheleus.org/math_wrapper.sh new file mode 120000 index 0000000..f40564e --- /dev/null +++ b/ytheleus.org/math_wrapper.sh @@ -0,0 +1 @@ +../math_wrapper.sh \ No newline at end of file -- 2.47.1