astro-paper
astro-paper copied to clipboard
suggestion: support latex math expressions using remark-math and rehype-katex
I think support latex math expression in markdown is a good option like the following image.
Thank you Best Regards @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.
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:
As you can see, the math text is very very faint. Does anyone have any idea how to fix this?
I followed this tutorial and didn't have this issue @andreyyao https://blog.alexafazio.dev/blog/render-latex-in-astro/
@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 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
Convert this issue into a discussion for future reference. Thank you to everyone who participated in the conversation.