PreTeXtBook / pretext

PreTeXt: an authoring and publishing system for scholarly documents
https://pretextbook.org
Other
267 stars 209 forks source link

External images in slideshows do not consider the publication file #2155

Open rbeezer opened 6 months ago

rbeezer commented 6 months ago

Check the template matching image and condition on the existence of a generated directory. Good chance there maybe other similar failures to respect aspects of the publication file.

Obsoletes: https://github.com/PreTeXtBook/pretext-cli/issues/717

kcrisman commented 6 months ago

Check the template matching image and condition on the existence of a generated directory. Good chance there maybe other similar failures to respect aspects of the publication file.

Commenting to see updates, as I'm still interested in modernizing some of the slideshow stuff (on the js side, at least). (I haven't been using generated or CLI on that project yet, for what it's worth, but I'm hoping to upgrade that before Spring 2025, the next time I teach that course.)

Message ID: @.***>

kcrisman commented 3 months ago

Sounds like #2156 addresses this, correct?

sean-fitzpatrick commented 3 months ago

I just checked a slideshow that I have.

Images are in the assets directory, and I have

<directories external="../assets" generated="../generated-assets"/>

within the source section of my publication file.

Including an image with <image source="foo.svg"/> works as expected. (This was not the case when I wrote the slides last fall.)

However, width attributes (either on the image element or on an enclosing sidebyside) are not respected.

kcrisman commented 3 months ago

However, width attributes (either on the image element or on an enclosing sidebyside) are not respected.

I certainly expect this on the image element, I have some hacked code that solves that problem which I'd like to contribute after helping with #2159. I never had problems with sidebyside so I'd have to check that out.

kcrisman commented 3 months ago

Including an image with <image source="foo.svg"/> works as expected. (This was not the case when I wrote the slides last fall.)

Weirdly, this works for my complex slides too, but not when I mess with the sample slideshow - ?!?

kcrisman commented 3 months ago

Including an image with <image source="foo.svg"/> works as expected. (This was not the case when I wrote the slides last fall.)

Weirdly, this works for my complex slides too, but not when I mess with the sample slideshow - ?!?

I should point out that I am NOT using the CLI for the sample slideshow yet (that would be, as #2159 points out. another level of difficulty). The publisher file is being recognized (as I can tell from changing other entries) - any ideas on an extra step I might need to take, something with the pretext script? That's been alluded to various times recently.

kcrisman commented 3 months ago

No, I figured it out. It's weird. Instead of using

https://github.com/PreTeXtBook/pretext/blob/67967944818e8f0150322634a0d67cc48dd79de6/xsl/publisher-variables.xsl#L1027

it's using

https://github.com/PreTeXtBook/pretext/blob/67967944818e8f0150322634a0d67cc48dd79de6/xsl/publisher-variables.xsl#L1110

which defaults to external (intentionally hard-coded!) for backwards compatibility. I just posted to -dev about this.

kcrisman commented 3 months ago

However, width attributes (either on the image element or on an enclosing sidebyside) are not respected.

I certainly expect this on the image element, I have some hacked code that solves that problem which I'd like to contribute after helping with #2159. I never had problems with sidebyside so I'd have to check that out.

Yeah, I have code like <sidebyside widths="60% 20%"> and it definitely behaves as expected. Is there something different you're doing there?

sean-fitzpatrick commented 3 months ago

If you use the CLI, images are copied over where you expect them to be.

I have a slide with:

<sidebyside widths="45% 45%>
  <image source="foo.svg"/>
  <p>Some text</p>
</sidebyside>

and the image only takes up about 30% of the first SBS panel. If I edit the HTML file to add width="100%" to the image element, it scales to fill the panel.

Probably if you use .jpg or .png, you get the native size of the image (or it scales down?)

sean-fitzpatrick commented 3 months ago

Does your sidebyside behave as expected because you are using the hacked code you mention?

kcrisman commented 3 months ago

Probably? I can't check now, unfortunately.

On Fri, Jul 19, 2024, 14:31 Sean Fitzpatrick @.***> wrote:

Does your sidebyside behave as expected because you are using the hacked code you mention?

— Reply to this email directly, view it on GitHub https://github.com/PreTeXtBook/pretext/issues/2155#issuecomment-2239877694, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANRQ4BMVC4IHJLPLY3RH53ZNFLOVAVCNFSM6AAAAABGP2BTHCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZZHA3TONRZGQ . You are receiving this because you commented.Message ID: @.***>

kcrisman commented 3 months ago

Probably? I can't check now, unfortunately.

See my woeful guess at https://github.com/PreTeXtBook/pretext/issues/2159#issuecomment-2240675420