Open l4v3nx opened 1 month ago
latex rendering is possible but not perfect
it won't be detected inline like that. you gotta tell it to put in a code block with language set to tex or latex
when you type this you should get a latex block
I thought it should be working because here init message says answer should be formatted in latex if there's maths in answer https://github.com/end-4/dots-hyprland/blob/a10d45883ce8a447177cb5b6ac27762308f6ef29/.config/ags/services/gpt.js#L60
and that answer also follows the format i pointed out above
there's huge error spaming (i guess more that 50 or even 100 such messages) when i tried to make ai put its output to latex code block
(com.github.Aylur.ags:9158): Gjs-CRITICAL **: 14:04:10.292: Object .Ags_Box (0x5c721c43e960), has been already disposed — impossible to access it. This might be caused by the object having been destroyed from C code using something such as destroy(), dispose(), or remove() vfuncs.
== Stack trace for context 0x5c721938b9a0 ==
#0 7ffe16598f00 b resource:///com/github/Aylur/ags/widgets/box.js:40 (2cbf0e4c1e70 @ 193)
#1 7ffe16599710 b resource:///com/github/Aylur/ags/widgets/box.js:25 (2cbf0e4c1dd0 @ 23)
#2 7ffe16599f10 b file:///home/old4ever/.config/ags/modules/sideleft/apis/ai_chatmessage.js:117 (3266370dca10 @ 169)
#3 7ffe16599fb0 b resource:///com/github/Aylur/ags/utils/timeout.js:14 (2cbf0e4b1150 @ 6)
#4 5c72194574c8 i resource:///org/gnome/gjs/modules/core/overrides/GLib.js:266 (2cbf0e47d560 @ 139)
do you get a properly rendered latex block when you run the /test
command
no
Gio.IOErrorEnum: Error opening file “/home/old4ever/.cache/ags/media/latex/1717067353520.tex”: No such file or directory
Gio.IOErrorEnum: Error opening file “/home/old4ever/.cache/ags/media/latex/1717067353520-render.sh”: No such file or directory
Same Issue for me:
Running Latex from the commandline and rendering tan(x) logs following error:
FILE: /home/janik/dots-hyprland/cache/MicroTeX/src/fonts/fonts.cpp, LINE: 188, FUNCTION: getChar, MSG: { char: t, font id: 2, path: res/fonts/base/cmmi10.ttf } FILE: /home/janik/dots-hyprland/cache/MicroTeX/src/platform/cairo/graphic_cairo.cpp, LINE: 47, FUNCTION: loadFont, MSG: Load font: res/fonts/base/cmmi10.ttf, count: 2045967900 Null pattern FILE: /home/janik/dots-hyprland/cache/MicroTeX/src/platform/cairo/graphic_cairo.cpp, LINE: 54, FUNCTION: loadFont, MSG: Load res/fonts/base/cmmi10.ttf failed fish: Job 1, 'LaTeX' terminated by signal SIGSEGV (Address boundary error)
And why does it use dots-hyprland as a path. Is LaTeX specifically made for your dots?
@H0mire LaTeX binary didn't move to /usr/local/bin at the installation (or didn't get built at all)
@l4v3nx "which LaTeX" prints following:
/usr/local/bin/LaTeX
And I checked visually if it exists with Nautilus File Manager.
Or what do you mean?
@H0mire where did you get this log from? ags or journalctl?
@l4v3nx I ran LaTeX from terminal and crashed after pressing render button, so i checked logging in the fish terminal window where the errors as provided were printed.
can confirm that gui crashes again
though the sidebar works for me
@H0mire yea, same issue
And why does it use dots-hyprland as a path. Is LaTeX specifically made for your dots?
we build microtex inside repo's folder and its source code remains there
oh i remember why that doesn't work that now
that thing hard codes the font path relative to the workdir. the generated script to render stuff cd
s to the binary's folder to make sure font file detection works
@l4v3nx Yeah i just figured out it is MicroTex. I guess its not like that the source code remains there, but more like that MicroText has the the original paths encoded in its binary.
@l4v3nx can you show what's in your ~/.cache/ags/media/latex
folder after runnning that /test
command?
there's not even latex folder created
-> % ls .cache/ags/media/
1b3333efde4c64e0c80231cd483db0500f40840f
1b3333efde4c64e0c80231cd483db0500f40840f_colorscheme.css
1b3333efde4c64e0c80231cd483db0500f40840f_colorscheme.css.map
waifus
there's not even latex folder created
Same here
oh i remember why that doesn't work that now that thing hard codes the font path relative to the workdir. the generated script to render stuff
cd
s to the binary's folder to make sure font file detection works
didn't install script copy res/ folder to /usr/local/bin/? and here
binary would use res/ folder as the script moves to directory where LaTeX is (/usr/local/bin). i guess it should be working
yeah i mean it won't work if you just run LaTeX in terminal without cd ing there first
After manually creating a latex folder in media following files are avaliable:
But latex is still not correctly visualized
And there is no error in the logs of ags
some more info (inside /usr/local/bin/):
-> % ./LaTeX -headless "-input=f(x)={\frac{k}{x}}+a" -output=boba.svg
block of char: 40 is 0
block of char: 41 is 0
block of char: 61 is 0
block of char: 43 is 0
FILE: /home/old4ever/dots-hyprland/cache/MicroTeX/src/fonts/fonts.cpp, LINE: 188, FUNCTION: getChar, MSG: { char: f, font id: 2, path: res//fonts/base/cmmi10.ttf }
FILE: /home/old4ever/dots-hyprland/cache/MicroTeX/src/platform/cairo/graphic_cairo.cpp, LINE: 47, FUNCTION: loadFont, MSG: Load font: res//fonts/base/cmmi10.ttf, count: 1
Pattern has 28 elts (size 32)
family: "cmmi10"(s)
familylang: "en"(s)
style: "Medium"(s)
stylelang: "en"(s)
fullname: "cmmi10"(s)
fullnamelang: "en"(s)
slant: 100(i)(s)
weight: 100(f)(s)
width: 100(f)(s)
foundry: "PfEd"(s)
file: "res//fonts/base/cmmi10.ttf"(s)
index: 0(i)(s)
outline: True(s)
scalable: True(s)
charset:
0000: 00000000 ffffffff ffffffff 7fffffff 00000000 ffffcfff 0000001f 00000000
0022: 02000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
(s)
lang: fj|ho|ia|io|nr|om|so|ss|st|sw|ts|uz|xh|zu|kj|kwm|ms|ng|rn|rw|sn|za|bem(s)
fontversion: 66191(i)(s)
capability: "otlayout:latn"(s)
fontformat: "TrueType"(s)
decorative: False(s)
postscriptname: "cmmi10"(s)
color: False(s)
symbol: False(s)
variable: False(s)
fonthashint: False(s)
order: 0(i)(s)
namedinstance: False(s)
fontwrapper: "SFNT"(s)
FILE: /home/old4ever/dots-hyprland/cache/MicroTeX/src/fonts/fonts.cpp, LINE: 188, FUNCTION: getChar, MSG: { char: (, font id: 18, path: res//fonts/latin/cmr10.ttf }
FILE: /home/old4ever/dots-hyprland/cache/MicroTeX/src/platform/cairo/graphic_cairo.cpp, LINE: 47, FUNCTION: loadFont, MSG: Load font: res//fonts/latin/cmr10.ttf, count: 1
Pattern has 28 elts (size 32)
family: "cmr10"(s)
familylang: "en"(s)
style: "Medium"(s)
stylelang: "en"(s)
fullname: "cmr10"(s)
fullnamelang: "en"(s)
slant: 0(i)(s)
weight: 100(f)(s)
width: 100(f)(s)
foundry: "PfEd"(s)
file: "res//fonts/latin/cmr10.ttf"(s)
index: 0(i)(s)
outline: True(s)
scalable: True(s)
charset:
0000: 00000000 ffffffff ffffffff 7fffffff 00000000 ffffcfff 0008003f 00080000
0001: 030000f0 00000000 0c00001e 1e000000 00000000 00000000 00000000 00000000
0022: 02000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
(s)
lang: fj|ho|ia|io|nr|om|pl|so|ss|st|sw|ts|uz|xh|zu|kj|kwm|ms|ng|rn|rw|sn|za|bem(s)
fontversion: 66191(i)(s)
capability: "otlayout:latn"(s)
fontformat: "TrueType"(s)
decorative: False(s)
postscriptname: "cmr10"(s)
color: False(s)
symbol: False(s)
variable: False(s)
fonthashint: False(s)
order: 0(i)(s)
namedinstance: False(s)
fontwrapper: "SFNT"(s)
FILE: /home/old4ever/dots-hyprland/cache/MicroTeX/src/fonts/fonts.cpp, LINE: 188, FUNCTION: getChar, MSG: { char: f, font id: 2, path: res//fonts/base/cmmi10.ttf }
FILE: /home/old4ever/dots-hyprland/cache/MicroTeX/src/fonts/fonts.cpp, LINE: 188, FUNCTION: getChar, MSG: { char: (, font id: 18, path: res//fonts/latin/cmr10.ttf }
FILE: /home/old4ever/dots-hyprland/cache/MicroTeX/src/fonts/fonts.cpp, LINE: 188, FUNCTION: getChar, MSG: { char: x, font id: 2, path: res//fonts/base/cmmi10.ttf }
FILE: /home/old4ever/dots-hyprland/cache/MicroTeX/src/fonts/fonts.cpp, LINE: 188, FUNCTION: getChar, MSG: { char: ), font id: 18, path: res//fonts/latin/cmr10.ttf }
FILE: /home/old4ever/dots-hyprland/cache/MicroTeX/src/fonts/fonts.cpp, LINE: 188, FUNCTION: getChar, MSG: { char: x, font id: 2, path: res//fonts/base/cmmi10.ttf }
FILE: /home/old4ever/dots-hyprland/cache/MicroTeX/src/fonts/fonts.cpp, LINE: 188, FUNCTION: getChar, MSG: { char: ), font id: 18, path: res//fonts/latin/cmr10.ttf }
FILE: /home/old4ever/dots-hyprland/cache/MicroTeX/src/fonts/fonts.cpp, LINE: 188, FUNCTION: getChar, MSG: { char: =, font id: 18, path: res//fonts/latin/cmr10.ttf }
FILE: /home/old4ever/dots-hyprland/cache/MicroTeX/src/fonts/fonts.cpp, LINE: 188, FUNCTION: getChar, MSG: { char: k, font id: 2, path: res//fonts/base/cmmi10.ttf }
FILE: /home/old4ever/dots-hyprland/cache/MicroTeX/src/fonts/fonts.cpp, LINE: 188, FUNCTION: getChar, MSG: { char: x, font id: 2, path: res//fonts/base/cmmi10.ttf }
FILE: /home/old4ever/dots-hyprland/cache/MicroTeX/src/fonts/fonts.cpp, LINE: 188, FUNCTION: getChar, MSG: { char: +, font id: 18, path: res//fonts/latin/cmr10.ttf }
FILE: /home/old4ever/dots-hyprland/cache/MicroTeX/src/fonts/fonts.cpp, LINE: 188, FUNCTION: getChar, MSG: { char: a, font id: 2, path: res//fonts/base/cmmi10.ttf }
[BOX TREE]:
0 HBox
1 ├── CharBox
1 ├── GlueBox
1 ├── CharBox
1 ├── GlueBox
1 ├── CharBox
1 ├── GlueBox
1 ├── CharBox
1 ├── GlueBox
1 ├── CharBox
1 ├── GlueBox
1 ├── HBox
2 │ ├── StrutBox
2 │ ├── VBox
3 │ │ ├── HBox
4 │ │ │ ├── StrutBox
4 │ │ │ ├── CharBox
4 │ │ │ └── StrutBox
3 │ │ ├── StrutBox
3 │ │ ├── RuleBox
3 │ │ ├── StrutBox
3 │ │ └── CharBox
2 │ └── StrutBox
1 ├── GlueBox
1 ├── CharBox
1 ├── GlueBox
1 └── CharBox
FILE: /home/old4ever/dots-hyprland/cache/MicroTeX/src/fonts/fonts.cpp, LINE: 47, FUNCTION: ~DefaultTeXFont, MSG: DefaultTeXFont destruct
terminate called after throwing an instance of 'std::ios_base::failure[abi:cxx11]'
what(): error while writing to output stream: iostream error
[1] 61290 IOT instruction (core dumped) ./LaTeX -headless "-input=f(x)={\frac{k}{x}}+a" -output=boba.svg
journalctl log (after /test):
May 30 17:28:46 hmb15-arch-pc /usr/lib/gdm-wayland-session[54334]: Gio.IOErrorEnum: Error opening file “/home/old4ever/.cache/ags/media/latex/1717079326213.tex”: No such file or directory
May 30 17:28:46 hmb15-arch-pc /usr/lib/gdm-wayland-session[54334]: Gio.IOErrorEnum: Error opening file “/home/old4ever/.cache/ags/media/latex/1717079326213-render.sh”: No such file or directory
May 30 17:34:53 hmb15-arch-pc systemd-coredump[61292]: Process 61290 (LaTeX) of user 1000 dumped core.
Stack trace of thread 61290:
#0 0x00007817443bde44 n/a (libc.so.6 + 0x94e44)
#1 0x0000781744365a30 raise (libc.so.6 + 0x3ca30)
#2 0x000078174434d4c3 abort (libc.so.6 + 0x244c3)
#3 0x0000781744697b0c _ZN9__gnu_cxx27__verbose_terminate_handlerEv (libstdc++.so.6 + 0x97b0c)
#4 0x00007817446adf1a _ZN10__cxxabiv111__terminateEPFvvE (libstdc++.so.6 + 0xadf1a)
#5 0x000078174469750a _ZSt9terminatev (libstdc++.so.6 + 0x9750a)
#6 0x00007817446ae1d6 __cxa_throw (libstdc++.so.6 + 0xae1d6)
#7 0x00007817452b77b8 _ZN5Cairo15throw_exceptionE13_cairo_status (libcairomm-1.0.so.1 + 0x167b8)
#8 0x00007817452bee58 _ZN5Cairo10SvgSurface6createENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEdd (libcairomm-1.0.so.1 + 0x1de58)
#9 0x00005d8f0a3b5797 _ZNK8Headless14generateSingleERKNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEEERKNS1_IcS2_IcESaIcEEE (LaTeX + 0x2a797)
#10 0x00005d8f0a3b5c94 _ZNK8Headless9runSingleEv (LaTeX + 0x2ac94)
#11 0x00005d8f0a3b5d96 _ZN8Headless3runEv (LaTeX + 0x2ad96)
#12 0x00005d8f0a3b1a27 _Z11runHeadlessRKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE (LaTeX + 0x26a27)
#13 0x00005d8f0a3b1e4b main (LaTeX + 0x26e4b)
#14 0x000078174434ec88 n/a (libc.so.6 + 0x25c88)
#15 0x000078174434ed4c __libc_start_main (libc.so.6 + 0x25d4c)
#16 0x00005d8f0a3b1065 _start (LaTeX + 0x26065)
ELF object binary architecture: AMD x86-64
yay -S MicroTex and creating latex folder in media manually fixed the issue
yay -S MicroTex and creating latex folder in media manually fixed the issue
yea, it works. btw, @end-4 you can delete /usr/local/bin/res
and remove this line https://github.com/end-4/dots-hyprland/blob/a94172d9cd860113926e2c6fd7375c547564dc76/scriptdata/installers#L102
why installing MicroTex through a function anyway? And there must be something that ensures the latex path in media/latex
why installing MicroTex through a function anyway? And there must be something that ensures the latex path in media/latex
idk either, font paths are different than hardcoded ones (yay -Ql microtex-git
)
why installing MicroTex through a function anyway?
there wasn't that package on the aur (first submitted march) when i started using microtex (february)
ensures the latex path in media/latex
also, it should make that media/latex with mkdir command: https://github.com/end-4/dots-hyprland/blob/a94172d9cd860113926e2c6fd7375c547564dc76/.config/ags/modules/sideleft/apis/ai_chatmessage.js#L75-L77
ensures the latex path in media/latex
also, it should make that media/latex with mkdir command:
@end-4 maybe missing quotes in bash -c? like bash -c mkdir -p ${LATEX_DIR}
--> bash -c "mkdir -p ${LATEX_DIR}"
the problem was this "rm: cannot remove '/home/end/.cache/ags/media/latex/*': No such file or directory" idk why the asterisk didn't work, but i made it rm -rf the whole folder instead and it should work now
i'll also have to see if that aur package works
it provides stuff in res/
but doesn't provide the binary. you may remove the line in installer that copies res/
to /usr/local/bin/
and add microtex-git
to deps (1.5 mb size, pretty small)
@end-4 btw ai answer still can't be formated to latex (it just shows answer header (like "Common trigonometric formulas") and both the answer generation and ags itself completely crash (yes, real ags crash moment))
(703 errors in 20 seconds)
prompt: name common trig formulas (put them into latex code blocks) precise, enhancements on
/test shows formatting fine
The issue
ai answers don't convert tex source code to normal formulas
(i expected the same result as in the screenshot bg)
Click to expand
```plain -> % LaTeX --help ... a lot of docs ... Usage: LaTeX [OPTION…] Help Options: -h, --help Show help options --help-all Show all help options --help-gapplication Show GApplication options --help-gtk Show GTK Options Application Options: --display=DISPLAY X display to use ``` ```plain -> % command -v LaTeX /usr/local/bin/LaTeX ```