slidev icon indicating copy to clipboard operation
slidev copied to clipboard

Support Tikz in Slidev

Open issaccv opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please describe.

I am a researcher. Thanks to slidev's complete community ecology, I can use markdown to quickly complete some simple reports and introduce rich animation effects. I can almost entirely use slidev instead of Latex for reporting. However, whenever I need to display complex drawings, especially tikz charts that are very common in latex, I have to put the screenshots into the public folder. This way the screenshots produce different resolutions on different screens. As a result, it is difficult to obtain the best display effect.

Describe the solution you'd like Based on my investigation, I found a plugin from the hexo community: https://github.com/prinsss/hexo-filter-tikzjax

This plug-in enables markdown to support tikz syntax. Specifically, you can draw a tikz chart in the following way

```tikz \begin{document} \begin{tikzpicture}[domain=0:4,scale=1.1] \draw[very thin,color=gray] (-0.1,-1.1) grid (3.9,3.9); \draw[->] (-0.2,0) -- (4.2,0) node[right] {$x$}; \draw[->] (0,-1.2) -- (0,4.2) node[above] {$f(x)$}; \draw[color=red] plot (\x,\x) node[right] {$f(x) =x$}; \draw[color=blue] plot (\x,{sin(\x r)}) node[right] {$f(x) = \sin x$}; \draw[color=orange] plot (\x,{0.05*exp(\x)}) node[right] {$f(x) = \frac{1}{20} \mathrm e^x$}; \end{tikzpicture} \end{document} ```

Describe alternatives you've considered I'm not familiar with JavaScript, but it would be great if slidev could support tikzjax the same way it supports katex!

issaccv avatar Jul 11 '24 14:07 issaccv