astro-paper icon indicating copy to clipboard operation
astro-paper copied to clipboard

suggestion: support latex math expressions using remark-math and rehype-katex

Open gyunseo opened this issue 1 year ago • 5 comments

I think support latex math expression in markdown is a good option like the following image. image

Thank you Best Regards @gyunseo

gyunseo avatar Oct 15 '23 16:10 gyunseo

Appreciate your suggestion and effort. However, I'm thinking of adding a how-to blog post for adding support latex math expressions. This is because AstroPaper is aimed to be as minimal as possible; and, besides, not everyone using AstroPaper would need this feature. But if someone does, they can opt in this feature by following the how-to blog post guide.

satnaing avatar Dec 12 '23 03:12 satnaing

I tried adding katex using the same process you described, and it worked quite well, except that the colors are messed up in dark mode: image

As you can see, the math text is very very faint. Does anyone have any idea how to fix this?

andreyyao avatar Dec 19 '23 19:12 andreyyao

I followed this tutorial and didn't have this issue @andreyyao https://blog.alexafazio.dev/blog/render-latex-in-astro/

caleb-shelton avatar Dec 20 '23 23:12 caleb-shelton

@caleb-shelton I just did a fresh install, and it's the same issue. Which version of remark-math and rehype-katex are you using?

EDIT: Upon further inspection, I think tailwindcss or the dark mode toggle is not playing right with the katex expressions. I got a temporary fix working by overwriting this css in layouts/PostDetails.astro:

 /* This is fixing the dim color of katex in dark mode */
 .prose {
     color: var(--color-text-base);
 }

andreyyao avatar Dec 21 '23 05:12 andreyyao

@andreyyao I didn't know that issue since I always use light mode. I've found the same issue with yours on my blog. I fixed it using your modification on layouts/PostDetails.astro. thanks so much! :D

gyunseo avatar Dec 23 '23 16:12 gyunseo

Convert this issue into a discussion for future reference. Thank you to everyone who participated in the conversation.

satnaing avatar Aug 04 '24 08:08 satnaing