artisticat1 / obsidian-tikzjax

Render LaTeX and TikZ diagrams in your notes
MIT License
357 stars 18 forks source link

Support for bayesnet package #17

Open przemyslslaw opened 1 year ago

przemyslslaw commented 1 year ago

Great plugin, many thanks!

Is there a way to use usetikzlibrary to load a tikz library such as bayesnet?

I've tried the following code, but it doesn't render in Obsidian:

\usetikzlibrary{bayesnet}
\begin{document}
\begin{tikzpicture}
\node[obs]  (y)      {$y$} ; %
\node[obs, above=of y]              (x2)      {$x_2$} ; %
\node[obs, left=of x2]              (x1)      {$x_1$} ; %
\node[obs, right=of x2]             (z)      {$z$} ; %
\edge[-,dashed] {x2} {z} ; %
\edge {x1,z} {y} ; %
\end{tikzpicture}
\end{document}
artisticat1 commented 1 year ago

This package isn't included in TikZJax, but I can look into adding it.

See also #4, which would enable users to add their own custom packages.

przemyslslaw commented 1 year ago

That would be wonderful. Thanks!

mayurankv commented 4 months ago

Can I ask what the procedure is for adding general tikz packages just for my knowledge. As far as I can tell, it includes checking whether they are in base latex (i.e. no luatex or xelatex) and if so adding it to the compiled script? Is that correct?

thecodechemist99 commented 11 hours ago

Can I ask what the procedure is for adding general tikz packages just for my knowledge. As far as I can tell, it includes checking whether they are in base latex (i.e. no luatex or xelatex) and if so adding it to the compiled script? Is that correct?

They are added in tikzjax in tex_files.json. This should work for all packages installed on the machine executing this command as long as they don’t require LuaTeX. Also, I haven’t got packages containing extra fonts to work yet.