artisticat1 / obsidian-tikzjax

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

A case that cannot be correctly renderred #18

Open dutry opened 2 years ago

dutry commented 2 years ago

I use the tikz code provided by mathcha, I find in some case it can be renderred, while not in some other cases, which is weird.

For the not working case, the image is stuck in:

The case working:

\begin{document}

\tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt        

\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
%uncomment if require: \path (0,300); %set diagram left start at 0, and has height of 300

%Shape: Axis 2D [id:dp8764141779135839] 
\draw [line width=1.5]  (109,151.7) -- (312,151.7)(210.18,64.7) -- (210.18,238.7) (305,146.7) -- (312,151.7) -- (305,156.7) (205.18,71.7) -- (210.18,64.7) -- (215.18,71.7)  ;
%Shape: Circle [id:dp5522194396077298] 
\draw  [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][dash pattern={on 1.69pt off 2.76pt}][line width=1.5]  (204.65,151.7) .. controls (204.65,148.65) and (207.12,146.17) .. (210.18,146.17) .. controls (213.23,146.17) and (215.71,148.65) .. (215.71,151.7) .. controls (215.71,154.76) and (213.23,157.23) .. (210.18,157.23) .. controls (207.12,157.23) and (204.65,154.76) .. (204.65,151.7) -- cycle ;
%Shape: Circle [id:dp8143080163074996] 
\draw  [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][dash pattern={on 1.69pt off 2.76pt}][line width=1.5]  (169.62,151.7) .. controls (169.62,129.3) and (187.78,111.14) .. (210.18,111.14) .. controls (232.58,111.14) and (250.74,129.3) .. (250.74,151.7) .. controls (250.74,174.11) and (232.58,192.27) .. (210.18,192.27) .. controls (187.78,192.27) and (169.62,174.11) .. (169.62,151.7) -- cycle ;
%Shape: Ellipse [id:dp33449423710676096] 
\draw  [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][dash pattern={on 1.69pt off 2.76pt}][line width=1.5]  (81.88,151.7) .. controls (81.88,83.61) and (139.32,28.41) .. (210.18,28.41) .. controls (281.03,28.41) and (338.47,83.61) .. (338.47,151.7) .. controls (338.47,219.8) and (281.03,275) .. (210.18,275) .. controls (139.32,275) and (81.88,219.8) .. (81.88,151.7) -- cycle ;
%Shape: Arc [id:dp7307206684633336] 
\draw  [draw opacity=0][line width=1.5]  (82.85,136.48) .. controls (90.66,75.57) and (144.69,28.41) .. (210.18,28.41) .. controls (275.26,28.41) and (329.03,74.98) .. (337.36,135.34) -- (210.18,151.7) -- cycle ; \draw  [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][line width=1.5]  (82.85,136.48) .. controls (90.66,75.57) and (144.69,28.41) .. (210.18,28.41) .. controls (275.26,28.41) and (329.03,74.98) .. (337.36,135.34) ;  
%Straight Lines [id:da9078059478487674] 
\draw [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][line width=1.5]    (83.18,136.64) -- (338.18,135.64) ;
%Straight Lines [id:da22135254703940133] 
\draw [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][line width=1.5]    (86.18,116.14) -- (332.18,116.14) ;
%Straight Lines [id:da024409394217732583] 
\draw [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][line width=1.5]    (96.18,96.52) -- (324.18,96.52) ;
%Shape: Ellipse [id:dp38684539385835937] 
\draw  [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][fill={rgb, 255:red, 255; green, 0; blue, 0 }  ,fill opacity=1 ] (164.16,61.44) .. controls (164.16,59.53) and (165.65,57.98) .. (167.5,57.98) .. controls (169.34,57.98) and (170.84,59.53) .. (170.84,61.44) .. controls (170.84,63.36) and (169.34,64.91) .. (167.5,64.91) .. controls (165.65,64.91) and (164.16,63.36) .. (164.16,61.44) -- cycle ;
%Shape: Ellipse [id:dp17186168524664702] 
\draw  [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][fill={rgb, 255:red, 255; green, 0; blue, 0 }  ,fill opacity=1 ] (168.92,72.07) .. controls (168.92,70.16) and (170.41,68.61) .. (172.26,68.61) .. controls (174.11,68.61) and (175.6,70.16) .. (175.6,72.07) .. controls (175.6,73.99) and (174.11,75.54) .. (172.26,75.54) .. controls (170.41,75.54) and (168.92,73.99) .. (168.92,72.07) -- cycle ;
%Shape: Ellipse [id:dp5045582996062006] 
\draw  [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][fill={rgb, 255:red, 255; green, 0; blue, 0 }  ,fill opacity=1 ] (159.39,51.1) .. controls (159.39,49.19) and (160.89,47.64) .. (162.74,47.64) .. controls (164.58,47.64) and (166.08,49.19) .. (166.08,51.1) .. controls (166.08,53.02) and (164.58,54.57) .. (162.74,54.57) .. controls (160.89,54.57) and (159.39,53.02) .. (159.39,51.1) -- cycle ;
%Shape: Circle [id:dp7784626994336648] 
\draw  [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][dash pattern={on 1.69pt off 2.76pt}][line width=1.5]  (136.81,151.7) .. controls (136.81,111.18) and (169.66,78.34) .. (210.18,78.34) .. controls (250.7,78.34) and (283.55,111.18) .. (283.55,151.7) .. controls (283.55,192.22) and (250.7,225.07) .. (210.18,225.07) .. controls (169.66,225.07) and (136.81,192.22) .. (136.81,151.7) -- cycle ;
%Straight Lines [id:da5806520966695097] 
\draw [color={rgb, 255:red, 65; green, 117; blue, 5 }  ,draw opacity=1 ][line width=1.5]    (191.18,116.14) -- (229.18,116.14) ;
%Straight Lines [id:da8577415386536396] 
\draw [color={rgb, 255:red, 0; green, 0; blue, 255 }  ,draw opacity=1 ][line width=1.5]    (248.18,136.14) -- (282.18,136.14) ;
%Straight Lines [id:da2930700105485291] 
\draw [color={rgb, 255:red, 65; green, 117; blue, 5 }  ,draw opacity=1 ][line width=1.5]    (173.18,136.14) -- (248.18,136.14) ;
%Straight Lines [id:da3894553979972608] 
\draw [color={rgb, 255:red, 0; green, 0; blue, 255 }  ,draw opacity=1 ][line width=1.5]    (163.18,96.52) -- (257.18,96.52) ;
%Straight Lines [id:da3310839253134501] 
\draw [color={rgb, 255:red, 0; green, 0; blue, 255 }  ,draw opacity=1 ][line width=1.5]    (138.18,136.14) -- (173.18,136.14) ;
%Straight Lines [id:da6831758357075788] 
\draw [color={rgb, 255:red, 0; green, 0; blue, 255 }  ,draw opacity=1 ][line width=1.5]    (146.18,116.14) -- (191.18,116.14) ;
%Straight Lines [id:da9892417800894142] 
\draw [color={rgb, 255:red, 0; green, 0; blue, 255 }  ,draw opacity=1 ][line width=1.5]    (229.18,116.14) -- (275.18,116.14) ;

% Text Node
\draw (179,160.72) node [anchor=north west][inner sep=0.75pt]  [font=\scriptsize,color={rgb, 255:red, 65; green, 117; blue, 5 }  ,opacity=1 ]  {$n=1$};
% Text Node
\draw (166,197.72) node [anchor=north west][inner sep=0.75pt]  [font=\scriptsize,color={rgb, 255:red, 0; green, 0; blue, 255 }  ,opacity=1 ]  {$n=2$};
% Text Node
\draw (341,128.72) node [anchor=north west][inner sep=0.75pt]  [font=\scriptsize]  {$m=1$};
% Text Node
\draw (336,109.72) node [anchor=north west][inner sep=0.75pt]  [font=\scriptsize]  {$m=2$};
% Text Node
\draw (328,90.72) node [anchor=north west][inner sep=0.75pt]  [font=\scriptsize]  {$m=3$};
% Text Node
\draw (267,22.32) node [anchor=north west][inner sep=0.75pt]   [align=left] {Infinity};
% Text Node
\draw (223.68,137.22) node [anchor=north west][inner sep=0.75pt]  [font=\scriptsize,color={rgb, 255:red, 65; green, 117; blue, 5 }  ,opacity=1 ]  {$K_{11}$};
% Text Node
\draw (258.18,137.22) node [anchor=north west][inner sep=0.75pt]  [font=\scriptsize,color={rgb, 255:red, 0; green, 0; blue, 255 }  ,opacity=1 ]  {$K_{12}$};
% Text Node
\draw (251.18,117.22) node [anchor=north west][inner sep=0.75pt]  [font=\scriptsize,color={rgb, 255:red, 0; green, 0; blue, 255 }  ,opacity=1 ]  {$K_{22}$};
% Text Node
\draw (214.68,117.22) node [anchor=north west][inner sep=0.75pt]  [font=\scriptsize,color={rgb, 255:red, 65; green, 117; blue, 5 }  ,opacity=1 ]  {$K_{21}$};
% Text Node
\draw (225.18,97.22) node [anchor=north west][inner sep=0.75pt]  [font=\scriptsize,color={rgb, 255:red, 0; green, 0; blue, 255 }  ,opacity=1 ]  {$K_{32}$};

\end{tikzpicture}

\end{document}

The case not working:

\begin{document} 

\tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt        

\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
%uncomment if require: \path (0,290); %set diagram left start at 0, and has height of 290

%Shape: Axis 2D [id:dp0999179114900497] 
\draw [line width=1.5]  (58.1,259.06) -- (280.1,259.06)(80.3,63) -- (80.3,280.84) (273.1,254.06) -- (280.1,259.06) -- (273.1,264.06) (75.3,70) -- (80.3,63) -- (85.3,70)  ;
%Shape: Block Arc [id:dp9040753340201015] 
\draw  [line width=1.5]  (134.63,145.52) .. controls (166.09,160.7) and (190.28,188.67) .. (200.49,222.7) -- (123.98,245.85) .. controls (120.29,233.41) and (111.53,223.19) .. (100.13,217.62) -- cycle ;
%Straight Lines [id:da32946654832604994] 
\draw [line width=1.5]  [dash pattern={on 1.69pt off 2.76pt}]  (272,200.84) -- (80.3,259.06) ;
%Straight Lines [id:da08659465846330194] 
\draw [line width=1.5]  [dash pattern={on 1.69pt off 2.76pt}]  (80.3,259.06) -- (156,100.84) ;
%Shape: Block Arc [id:dp2245060381299795] 
\draw  [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][line width=1.5]  (114.09,137.81) .. controls (147.71,147.3) and (176.38,170.64) .. (192.35,202.38) -- (121.02,238.46) .. controls (115.23,226.86) and (104.83,218.31) .. (92.63,214.81) -- cycle ;
%Straight Lines [id:da8775400636749446] 
\draw [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][line width=1.5]  [dash pattern={on 1.69pt off 2.76pt}]  (80.3,259.06) -- (263,166.84) ;
%Straight Lines [id:da9623658878312962] 
\draw [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][line width=1.5]  [dash pattern={on 1.69pt off 2.76pt}]  (80.3,259.06) -- (131,75.84) ;

%Straight Lines [id:da10914044989535521] 
\draw [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][line width=1.5]    (160,176.84) -- (178.93,157.01) ;
\draw [shift={(181,154.84)}, rotate = 133.67] [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][line width=1.5]    (14.21,-4.28) .. controls (9.04,-1.82) and (4.3,-0.39) .. (0,0) .. controls (4.3,0.39) and (9.04,1.82) .. (14.21,4.28)   ;
%Straight Lines [id:da28688187191709646] 
\draw [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][line width=1.5]    (106,232.84) -- (121.94,216.02) ;
\draw [shift={(124,213.84)}, rotate = 133.45] [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][line width=1.5]    (14.21,-4.28) .. controls (9.04,-1.82) and (4.3,-0.39) .. (0,0) .. controls (4.3,0.39) and (9.04,1.82) .. (14.21,4.28)   ;
%Straight Lines [id:da009188025421678514] 
\draw [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][line width=1.5]    (151,246.84) -- (136.28,215.56) ;
\draw [shift={(135,212.84)}, rotate = 64.8] [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][line width=1.5]    (14.21,-4.28) .. controls (9.04,-1.82) and (4.3,-0.39) .. (0,0) .. controls (4.3,0.39) and (9.04,1.82) .. (14.21,4.28)   ;
%Straight Lines [id:da9125246998149943] 
\draw [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][line width=1.5]    (117,199.34) -- (84.86,189.24) ;
\draw [shift={(82,188.34)}, rotate = 17.45] [color={rgb, 255:red, 255; green, 0; blue, 0 }  ,draw opacity=1 ][line width=1.5]    (14.21,-4.28) .. controls (9.04,-1.82) and (4.3,-0.39) .. (0,0) .. controls (4.3,0.39) and (9.04,1.82) .. (14.21,4.28)   ;

% Text Node
\draw (177.47,210.24) node [anchor=north west][inner sep=0.75pt]  [font=\footnotesize,rotate=-64.02]  {$A_{1}$};
% Text Node
\draw (146.13,174.92) node [anchor=north west][inner sep=0.75pt]  [rotate=-31.55]  {$A_{2}$};
% Text Node
\draw (110.07,154.52) node [anchor=north west][inner sep=0.75pt]  [font=\footnotesize,rotate=-17.11]  {$A_{3}$};
% Text Node
\draw (266,150.4) node [anchor=north west][inner sep=0.75pt]    {$\textcolor[rgb]{1,0,0}{\varphi }\textcolor[rgb]{1,0,0}{_{1}}\textcolor[rgb]{1,0,0}{+\si{\ohm}}\textcolor[rgb]{1,0,0}{_{\mathrm{P}}}\textcolor[rgb]{1,0,0}{\delta t}$};
% Text Node
\draw (94,60.4) node [anchor=north west][inner sep=0.75pt]    {$\textcolor[rgb]{1,0,0}{\varphi }\textcolor[rgb]{1,0,0}{_{2}}\textcolor[rgb]{1,0,0}{+\si{\ohm}}\textcolor[rgb]{1,0,0}{_{\mathrm{P}}}\textcolor[rgb]{1,0,0}{\delta t}$};
% Text Node
\draw (278,259.74) node [anchor=north west][inner sep=0.75pt]    {$x$};
% Text Node
\draw (64,65.74) node [anchor=north west][inner sep=0.75pt]    {$y$};
% Text Node
\draw (157,81.4) node [anchor=north west][inner sep=0.75pt]    {$\varphi _{2}$};
% Text Node
\draw (123.02,241.86) node [anchor=north west][inner sep=0.75pt]    {$r_{1}$};
% Text Node
\draw (199.49,219.1) node [anchor=north west][inner sep=0.75pt]    {$r_{2}$};
% Text Node
\draw (275,188.4) node [anchor=north west][inner sep=0.75pt]    {$\varphi _{1}$};
% Text Node
\draw (173,139.4) node [anchor=north west][inner sep=0.75pt]    {$\textcolor[rgb]{1,0,0}{v}\textcolor[rgb]{1,0,0}{_{r}}$};
% Text Node
\draw (151,234.4) node [anchor=north west][inner sep=0.75pt]    {$\textcolor[rgb]{1,0,0}{v}\textcolor[rgb]{1,0,0}{_{\varphi }}$};
% Text Node
\draw (116,198.4) node [anchor=north west][inner sep=0.75pt]    {$\textcolor[rgb]{1,0,0}{v}\textcolor[rgb]{1,0,0}{_{r}}$};
% Text Node
\draw (82,166.4) node [anchor=north west][inner sep=0.75pt]    {$\textcolor[rgb]{1,0,0}{v}\textcolor[rgb]{1,0,0}{_{\varphi }}$};

\end{tikzpicture}
\end{document}
thecodechemist99 commented 4 months ago

The issue here is the \si command. It seems like it belongs to the package siunitx which is currently not supported. The second example works when \Omega is used instead of \si{\ohm}.