artisticat1 / obsidian-tikzjax

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

Loops not rendering in tikz in Obsidian only #52

Open Vega-3 opened 7 months ago

Vega-3 commented 7 months ago

\documentclass{article} \usepackage{tikz} \usetikzlibrary{graphs,graphs.standard,arrows.meta}

\begin{document} \begin{tikzpicture} % Define the vertices in set A (red vertices) \foreach \i in {1,...,4} { \node[draw, circle, fill=red] (A\i) at (0, \i) {$A_\i$}; }

% Define the vertices in set B (blue vertices) \foreach \j in {1,...,4} { \node[draw, circle, fill=blue] (B\j) at (4, \j) {$B_\j$}; }

% Draw the edges for the bipartite graph \foreach \i in {1,...,4} { \foreach \j in {1,...,4} { \draw[-{Latex}] (A\i) -- (B\j); } } \end{tikzpicture} \end{document}

I am trying to render this graph, and it just comes out with the image broken symbol, yet it runs fine in overleaf. what is the issue?

mayurankv commented 4 months ago

This works fine for me:

\usepackage{tikz}  
\usetikzlibrary{graphs,graphs.standard,arrows.meta}
\begin{document} 
\begin{tikzpicture}  
% Define the vertices in set A (red vertices)  
\foreach \i in {1,...,4} {  
    \node[draw, circle, fill=red] (A\i) at (0, \i) {$A_\i$};  
}

% Define the vertices in set B (blue vertices)  
\foreach \j in {1,...,4} {  
    \node[draw, circle, fill=blue] (B\j) at (4, \j) {$B_\j$};  
}

% Draw the edges for the bipartite graph  
\foreach \i in {1,...,4} {  
    \foreach \j in {1,...,4} {  
        \draw[-{Latex}] (A\i) -- (B\j);  
    }  
}  
\end{tikzpicture}  
\end{document}

Would be good to close this so that more relevant issues can hopefully be addressed :)