I would like to know if it is possible to add an interactive app created with Javascript to a Latex document.
I would like to add some of the Javascripts that appear here.
Like that one:
EDIT
I can have the .js document, so I would like how to attach a .js to Latex.
Any idea? Any help?
Best Answer
This ports the card shuffling example to LaTeX and PDF, using PDF Layers (package
ocgx2
) and JavaScript. Acrobat Reader is required for display.Update: Extended example with chart that plots King-diamond position versus riffle count.
Warning: It takes about 2h to compile the code twice using
pdflatex
due to the large number of OCGs (around 21k) that is created. Moreover, forpdflatex
to run successfully, themain_memory
must be increased in the format, orlualatex
to be used instead. The (original) example without the chart compiles much faster (second code box).Original example without chart: