For Sean:
https://www.youtube.com/watch?v=wjKQQpPVifY&t=194s
Using the AIM development WW server, I have this working. See the results at:
http://spot.pcc.edu/~ajordan/tikzwwtesting/section-9.html
When you click to make the exercise interactive, it takes a moment to
load. And then it takes even longer for the image to appear, because
the WW server is still generating it, going from tex to pdf to svg.
And if you click things like the re-randomize button, it will take a
moment again, because the problem is unaware that the image will be
the same image (it could be a dynamic image that depends on the seed,
so it is appropriate to regenerate it). Perhaps in the future the
initial click of the "make interactive" button could still use the
local image file instead of reproducing it that first time.
WW version 2.16 is still baking, although we really hope it comes out
of the oven soon. But for example, trying to get this work revealed a
bug in 2.16 for which I just submitted a fix. So it's an ongoing
effort. And I don't want to move the production AIM WW server to
version 2.16 until version 2.16 is officially released.
Is it OK that I move forward with the PTX pull request that has all
this? The code is dependent upon checking the WW server version, so
should not affect current users. The exception *might* be Sean, who
has a fake "2.16" server that is really 2.15 but identifies as 2.16 to
get early access to some other features. But I think this won't hurt
Sean either, because this is only to support problems that produce
tikz-based images, and nothing in APEX does that (yet). Testing can be
done with the AIM development server.
PTX source looks like:
<exercise>
<title>Solve using a tikz graph</title>
<webwork>
<pg-code>
Context()->variables->are(n=>'Real');
$answer = Formula("n(n+1)/2");
$refreshCachedImages=1;
</pg-code>
<statement>
<p>
This image is a visual proof that
<m>\sum_{k=1}^{n}k</m> equals what?
</p>
<image width="50%">
<latex-image>
\draw [dashed]
(0.5-0.5*6.5,-0.866025*6.5) -- (7-0.5*6.5,-0.866025*6.5);
\draw [very thick]
(2-0.5*7,-0.866025*7) -- (2-0.5*4,-0.866025*4) --
(5-0.5*7,-0.866025*7);
\foreach \x in {1,...,6}
\foreach \y in {1,...,\x}
\shade[ball color=blue!30]
(\y-0.5*\x,-0.866025*\x) circle (0.2cm);
\foreach \y in {1,...,7}
\shade[ball color=orange!40]
(\y-0.5*7,-0.866025*7) circle (0.2cm);
\node at (2.5,-0.5) [anchor=north
west]{\(\color{blue}\sum\limits_{k=1}^nk\color{black}\)};
\shade[ball color=blue]
(2-0.5*4,-0.866025*4) circle (0.2cm);
\shade[ball color=orange]
(2-0.5*7,-0.866025*7) circle (0.2cm);
\shade[ball color=orange]
(5-0.5*7,-0.866025*7) circle (0.2cm);
</latex-image>
</image>
<p>
<var name="$answer" width="20"/>
</p>
</statement>
</webwork>
</exercise>
This does not yet include any latex-image-preamble content. I have
that going separately. This seems like a good place to pause and get
merged before things like late-image-preamble and archiving.
On Sun, May 2, 2021 at 4:38 PM Sean Fitzpatrick <
dsfitz...@gmail.com> wrote:
>
> Does x equal 4 or 5 in this example?
>
>
>> \node {\parbox{5in}{there are\\$x$ lights}};
>
> --
> You received this message because you are subscribed to the Google Groups "PreTeXt development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
pretext-dev...@googlegroups.com.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/pretext-dev/CAH%2BNcPatL-ZMcdVjRw5wCOWTk1f0pJs5BFyhs2kS0Ee18%2BDv2g%40mail.gmail.com.