From 148266a6d5203f272c5ce0e88656b08248bef32e Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Sat, 18 May 2024 15:22:07 +0700 Subject: [PATCH] sidebar: ai: fix latex --- .config/ags/modules/sideleft/apis/ai_chatmessage.js | 3 ++- scriptdata/installers | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.config/ags/modules/sideleft/apis/ai_chatmessage.js b/.config/ags/modules/sideleft/apis/ai_chatmessage.js index 2d8a3f351..cedda4e4d 100644 --- a/.config/ags/modules/sideleft/apis/ai_chatmessage.js +++ b/.config/ags/modules/sideleft/apis/ai_chatmessage.js @@ -102,7 +102,8 @@ const Latex = (content = '') => { // You can add this line in the middle for debugging: echo "$text" > ${filePath}.tmp const renderScript = `#!/usr/bin/env bash text=$(cat ${filePath} | sed 's/$/ \\\\\\\\/g' | sed 's/&=/=/g') -LaTeX -headless -input="$text" -output=${outFilePath} -textsize=${fontSize * 1.1} -padding=0 -maxwidth=${latexViewArea.get_allocated_width() * 0.85} +cd "$(dirname $(command -v LaTeX))" +./LaTeX -headless -input="$text" -output=${outFilePath} -textsize=${fontSize * 1.1} -padding=0 -maxwidth=${latexViewArea.get_allocated_width() * 0.85} > /dev/null 2>&1 sed -i 's/fill="rgb(0%, 0%, 0%)"/style="fill:#000000"/g' ${outFilePath} sed -i 's/stroke="rgb(0%, 0%, 0%)"/stroke="${darkMode.value ? '#ffffff' : '#000000'}"/g' ${outFilePath} `; diff --git a/scriptdata/installers b/scriptdata/installers index ba9800e1e..c248e7d79 100644 --- a/scriptdata/installers +++ b/scriptdata/installers @@ -99,5 +99,6 @@ install-MicroTeX (){ x make -j32 x sudo mkdir -p /usr/local/bin x sudo cp ./LaTeX /usr/local/bin/ + x sudo cp -r ./res /usr/local/bin/ x cd $base }