What I’m trying to do: Render a Venn diagram. It renders fine in Overleaf and looks like the image pasted below, but I must be making a noob mistake with TikZJax Obsidian. Could anyone help me figure out what I’m doing wrong please?
Things I have tried: I’ve tinkered, but I’m kinda new to this so I’m not sure where to start trying solutions! I have successfully rendered other codes (example at the bottom).
The code I’m trying to render:
\begin{tikzpicture}[scale=1.0]
% -- Node definitions (just positions here) --
\node (M) at (0,0) {};
\node (K) at (1.8,0) {};
% -- 1) Fill M entirely (light blue for example) --
\fill[blue!30] (M) circle (1.5cm);
% -- 2) Fill K entirely, overlapping everything including the intersection --
\fill[red!30] (K) circle (1.5cm);
% -- Finally, draw the outlines and labels for clarity --
\draw (M) circle(1.5cm) node[above left] {$M$};
\draw (K) circle(1.5cm) node[above right] {$K$};
\node at (0.9,0) {$B$};
\draw[dashed] (0.9,0) circle (3cm)
node[above, yshift=3 cm] {Soft Boundary}; % Adjust position with yshift
\end{tikzpicture}
The code that I’ve rendered successfully:
(This is a completely different image for a different topic, but it works fine so the Venn should be possible, there aren’t any other silly mistakes like forgetting to turn on TikZJaX haha.)
\begin{document}
\begin{tikzpicture}[line join = round, line cap = round]
\pgfmathsetmacro{\factor}{1/sqrt(2)};
\coordinate [label=right:C] (C) at (2,0,-2*\factor);
\coordinate [label=left:B] (B) at (-2,0,-2*\factor);
\coordinate [label=above:A] (A) at (0,2,2*\factor);
\coordinate [label=below:D] (D) at (0,-2,2*\factor);
\foreach \i in {A,B,C,D}
\draw[dashed] (0,0)--(\i);
\draw[-, fill=red!30, opacity=1] (A)--(D)--(B)--cycle;
\draw[-, fill=blue!30, opacity=.5] (A) --(D)--(C)--cycle;
\draw[-, fill=purple!30, opacity=.5] (B)--(D)--(C)--cycle;
\end{tikzpicture}
\end{document}
Thank you!
~A