Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for animate package #327

Open
juhannc opened this issue Nov 3, 2024 · 6 comments
Open

Support for animate package #327

juhannc opened this issue Nov 3, 2024 · 6 comments

Comments

@juhannc
Copy link

juhannc commented Nov 3, 2024

Is your feature request related to a problem? Please describe.

I have a lot of beamer slides using the animate package (animategraphics, animateinline) which are not playing in pympress.

Describe the solution you'd like

Animations build with the animate package should play out as intended.

Describe alternatives you've considered

Converting them to gifs/videos is not feasible due to the sheer amount of animations as well as the fact that they are built using TikZ and I'd like to (have to) keep the flexibility.
Edit: other alternatives are unfavorable as well. beamers movie command as well as the movie15 package need the file to be present next to the pdf and the media9 package requires Flash (huge red flag). Only the animate package can create hermetic and standalone pdfs.

Additional context

None

@Cimbali
Copy link
Owner

Cimbali commented Nov 3, 2024

This was previously (briefly?) discussed in #314 I believe.

Animations build with the animate package should play out as intended.

As far as I can tell, this would require embedding a javascript engine in pympress, so not a tiny task. Also opens up a whole can of worms in terms of security, etc.

Only the animate package can create hermetic and standalone pdfs.

Definitely not, you can embed media files in a PDF. Use the autoplay example from the README, as you can see the \includemovie command from movie15 has an attach=false option.

Converting them to gifs/videos is not feasible due to […] the fact that they are built using TikZ

There’s a number of options, see e.g. this tex.se question. I understand this makes the pipeline a little more complex, but that could be automated by a Makefile or similar tool that handles dependencies.

media9 is indeed well deprecated now.

@Cimbali
Copy link
Owner

Cimbali commented Nov 4, 2024

Note that I’m not saying this can’t or shouldn’t be done, it would also support other javascript use cases such as some implementations of autoplay. But seen as a) there are viable workarounds for all use cases so far, b) it would be a huge investment in development time, and c) other large changes like porting to Gtk 4 (#267) that are also waiting, it’s quite unlikely this happens any time soon.

One starting point to explore feasability would be to find options for a javascript engine/interpreter/library that pympress could use. Something either smallish or existing in the Gtk world would be easiest to integrate – but hard to search for as search engines are flooded with the opposite association: using javascript to program a Gtk application.

I think the most tedious part comes next, and would be setting up the PDF-compliant API: providing objects that code in PDFs expect, and the like. Again if there’s something open-source we can reuse that’s probably best and lowest overhead. Something standalone, or in the poppler space (what does Okular use?) could again be best.

@christophehenry
Copy link

There's just a slight issue with the autoplay exemple in the README: the VLC option doesn't seem to support autoplay on page display and the media15 option relies on a LaTeX package that is not maintained anymore and is not packaged by Linux distributions. I tried with the media9 successor but not luck.

@juhannc
Copy link
Author

juhannc commented Nov 11, 2024

Only the animate package can create hermetic and standalone pdfs.

Definitely not, you can embed media files in a PDF. Use the autoplay example from the README, as you can see the \includemovie command from movie15 has an attach=false option.

Thanks, that I didn't know

I think the most tedious part comes next, and would be setting up the PDF-compliant API: providing objects that code in PDFs expect, and the like. Again if there’s something open-source we can reuse that’s probably best and lowest overhead. Something standalone, or in the poppler space (what does Okular use?) could again be best.

I know that Mozillas pdf.js can (natively) show animations built with animate but I obviously don't know how big of a change that would be for pympress.

Anyway, thank you for this undoubtfully awesome application I can totally understand that your priorities lie somewhere else and you don't want to cater to a single potential user :)

@Cimbali
Copy link
Owner

Cimbali commented Nov 11, 2024

@christophehenry Whether our VLC media backend honors autoplay or not (it should) is a different topic, and you may want to open a different issue if it appears not to work. I'd be surprised as that logic isn't backend-specific however. But first, and more relevant to this issue, you want your PDF to reliably contain the instruction to autoplay.

Flash is deprecated now so media9 is dead. However the older movie15 is still perfectly functional, as it simply relies on static PDF annotations. Which is probably why no newer package has been created for this functionality. There's also this tex.se question discussing post-media9 solutions, with 2 standalone 20ish-line implementations of a media embed command, also using annotations.

As to your dependency issue, I'm not sure what the details are, but movie15 installs fine on my distro. You may want to contact packagers of your OS, or start maintaining the OS package for that missing tex package - or even propose a newer package to CTAN based on the resources listed above.

@christophehenry
Copy link

Hmm… You're right, I do have movie15 installed on my system. However, compiling fails with the following error:

! Undefined control sequence.
l.58  \ifnum\pdftexversion<120
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
l.58  \ifnum\pdftexversion<120
! Package movie15 Error: pdfeTeX, version >= 1.20, required .

Trying to define \pdftexversion using \newcommand before using \newcommand doesn't solve the error.

As for the VLC media backend, do you have an idea how to make it work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants