tikzjax badly clips when two pictures together

237 Views Asked by At

I am using the tikzjax extension to enable the latex tikz package to be used within a php script. The minimal example below demonstrates the problem. The script <head> uses the information from https://tikzjax.com/. Then follows the exact same tikzpicture except the positioning of the node B in both cases (the second case is the reflection of the first). The problem is the \clip doesn't work in the second case. If the first case is commented out, then it works. Here's a picture of the output from my browser:

output of the script below

The problem is tha the clip seems to follow the same kind of path in the second instance as for the first. How can this situation be solved, could it be a tikzjax bug? Are we not supposed to have more than one such diagram rendered in a php page?

<?php

echo '<head><link rel="stylesheet" type="text/css" href="https://tikzjax.com/v1/fonts.css">
<script src="https://tikzjax.com/v1/tikzjax.js"></script></head>';


echo 'Top node at (0,3)
<script type="text/tikz">
\begin{tikzpicture}
\coordinate (C) at (0,0);
\coordinate (B) at (0,3);
\coordinate (A) at (2,0);
\draw (A)--(B)--(C)--(A);
\begin{scope}
\clip (A)--(B)--(C)--(A);
\draw (0,0.5)--++(0.5,0)--++(0,-1)--++(-1,0)--++(0,1)--++(1,0);
\end{scope}
\end{tikzpicture}
</script>
<br><br>
';


echo 'Top node at (0,-3)
<script type="text/tikz">
\begin{tikzpicture}
\coordinate (C) at (0,0);
\coordinate (B) at (0,-3);
\coordinate (A) at (2,0);
\draw (A)--(B)--(C)--(A);
\begin{scope}
\clip (A)--(B)--(C)--(A);
\draw (0,0.5)--++(0.5,0)--++(0,-1)--++(-1,0)--++(0,1)--++(1,0);
\end{scope}
\end{tikzpicture}
</script>
';


?>
0

There are 0 best solutions below