artisticat1 / obsidian-tikzjax

Render LaTeX and TikZ diagrams in your notes
MIT License
454 stars 27 forks source link

Feature request: simplifying entry #83

Open madsmh opened 1 month ago

madsmh commented 1 month ago

I mostly use TikzJax for commutative diagrams with tikzcd, and rarely, if ever, change the preamble. It would nice to be able to specify a standard preamble so I wouldn't have to enter the same one many times. It would also be nice to get avoid having to type \begin{document} and \end{document} in each diagram.

Best, Mads

Silloky commented 1 month ago

Hi @madsmh , I use the Latex Suite plugin, and I set myself a replacement for chemistry :

{
    trigger: "!chem", 
    replacement: "```tikz\n\\usepackage{chemfig}\n\\begin{document}\n\t\\chemname{\n\t\t\\chemfig{ $0 }\n\t}{$1}\n\\end{document}\n```", 
    options: "tA"
}

So now I just have to type !chem and the whole boilerplate pops up ! I'm sure you could come up with something similar for tikzcd, although it would be nice to have this in the plugin automatically.

madsmh commented 1 month ago

Thanks! This is very helpful!

Silloky commented 1 month ago

You're welcome!