Asymptote in slides

31 views
Skip to first unread message

Sean Fitzpatrick

unread,
Sep 13, 2023, 12:25:43 PM9/13/23
to PreTeXt support
I feel like in theory, an Asymptote HTML image should work in a reveal.js slide.

If I put an <asymptote> into a PreTeXt slideshow and try to build with the CLI, it fails with "KeyError: 'custom'".

So the asymptote build does not like the 'custom' format used in the project manifest.

Do I just build separately and put it in the assets folder?

Sean Fitzpatrick

unread,
Sep 13, 2023, 12:31:49 PM9/13/23
to PreTeXt support
Also, if I place an image in the assets folder it does not get copied over to output by the CLI, even if it's a jpg or png.

Sean Fitzpatrick

unread,
Sep 13, 2023, 12:42:04 PM9/13/23
to PreTeXt support
I can get an external image to work in a slideshow if I:

(a) manually create the external/ folder inside of output
(b) manually copy the image into external
(c) use <image source="external/image.png" > in my source

Sean Fitzpatrick

unread,
Sep 13, 2023, 4:43:23 PM9/13/23
to PreTeXt support
Including TikZ source similarly fails.

kcri...@gmail.com

unread,
Sep 14, 2023, 6:31:55 AM9/14/23
to PreTeXt support
Brief comment: I've used the slides a decent amount, and they import the html conversion, but are not really fully supported at all by the CLI; I had very similar errors even without trying to create images automagically.  

I recommend doing slides "the old-fashioned way" for now - they work fine, including tikz images.  But you'll have to use the pretext script (or generate images some other way), and that means paths and such if you already have managed directories.  I was too lazy to do all that, so I just made a symbolic link to the managed directory folders to my "old" image folder name, but needless to say that will make switching to the CLI more complex if I ever move my slides to that method :-) so I don't necessarily recommend doing that.

All that said, please let me know if you find some improvements you make to the slides, because I would be motivated to help test those out.  I have a few sitting in my "git stash" or a branch that I have yet to contribute, mostly because they are very hackish - for instance, images don't support sizing and some other parameters, if I recall correctly.

Sean Fitzpatrick

unread,
Sep 14, 2023, 8:37:08 AM9/14/23
to pretext...@googlegroups.com
Thanks. I'll go back to doing things without the CLI.

I'm also finding (and this is not a CLI problem) that HTML slide conversion ignores width attributes on images.

I have to manually edit the HTML after the fact to add a width to images.

--
You received this message because you are subscribed to a topic in the Google Groups "PreTeXt support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pretext-support/LeuIQ7aR9BM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pretext-suppo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/0e49343c-dd87-4625-a664-96fa05893d42n%40googlegroups.com.

kcri...@gmail.com

unread,
Sep 15, 2023, 7:11:57 AM9/15/23
to PreTeXt support
On Thursday, September 14, 2023 at 8:37:08 AM UTC-4 dsfitz...@gmail.com wrote:
Thanks. I'll go back to doing things without the CLI.

I'm also finding (and this is not a CLI problem) that HTML slide conversion ignores width attributes on images.

Oh?!   That is interesting.  I had implemented that for my slides (again, in some random branch that wasn't ready for public consumption), but probably it would be best to dust that off and try to make it appropriate for Rob's review.  Thanks for letting me know that!

Steven Clontz

unread,
Sep 15, 2023, 11:56:42 AM9/15/23
to PreTeXt support
Sean, can you share the full error message? For example, does it give a filename/linenumber where the KeyError occurred?

Sean Fitzpatrick

unread,
Sep 15, 2023, 5:48:15 PM9/15/23
to PreTeXt support
Here's the complete output if you include <latex-image> in a PreTeXt slides document (except for the bit about the project being ready for 2.0):

PreTeXt project found in `/home/sean/Documents/Teaching/Fall2023/Math1560/Activities`.
Note: No webwork elements found.
Traceback (most recent call last):
  File "/home/sean/.local/bin/pretext", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/sean/.local/pipx/venvs/pretext/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sean/.local/pipx/venvs/pretext/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/sean/.local/pipx/venvs/pretext/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sean/.local/pipx/venvs/pretext/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sean/.local/pipx/venvs/pretext/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sean/.local/pipx/venvs/pretext/lib/python3.11/site-packages/pretext/cli.py", line 451, in build
    project.generate(target.name(), asset_list=[asset])
  File "/home/sean/.local/pipx/venvs/pretext/lib/python3.11/site-packages/pretext/project/__init__.py", line 536, in generate
    generate.latex_image(
  File "/home/sean/.local/pipx/venvs/pretext/lib/python3.11/site-packages/pretext/generate.py", line 46, in latex_image
    and formats[target_format] != []
        ~~~~~~~^^^^^^^^^^^^^^^
KeyError: 'custom'

Steven Clontz

unread,
Sep 15, 2023, 9:29:59 PM9/15/23
to pretext...@googlegroups.com
What happens if you upgrade to 2.0.x?


--
You received this message because you are subscribed to a topic in the Google Groups "PreTeXt support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pretext-support/LeuIQ7aR9BM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pretext-suppo...@googlegroups.com.

Sean Fitzpatrick

unread,
Sep 15, 2023, 9:47:59 PM9/15/23
to pretext...@googlegroups.com
To be honest, I didn't realize 2.0 had already been released.

You received this message because you are subscribed to the Google Groups "PreTeXt support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-suppo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/CAOWT6Tgn8N%3DUSXR4MbXc_aSBsWB4978ayqQ%2Bu79%3DFL-3wHpK6A%40mail.gmail.com.

Steven Clontz

unread,
Sep 15, 2023, 9:59:37 PM9/15/23
to pretext...@googlegroups.com
Oscar might be waiting on me to finally deliver a promised how-to video for upgrading to it (I believe we're completely backwards compatible but there's some suggestions I'd still make for folks upgrading)...

Steven Clontz

unread,
Sep 15, 2023, 11:44:56 PM9/15/23
to pretext...@googlegroups.com
And I'm also dragging my feet until https://github.com/PreTeXtBook/pretext-cli/pull/592 is merged in (which will drastically reduce the overhead in updating boilerplate files when upgrading in the future when the comment `# Managed by PreTeXt` is included in a file).
Reply all
Reply to author
Forward
0 new messages