Dear David,
Presently, *every* HTML "img" has a
style="width: 100%; height: auto;"
on it. This is to make it fill an enclosing div horizontally, keep the aspect
ratio unchanged, and grow the div to match the height of the image. If there is
a better way you know, I'm all for it.
In the beta below, I have removed all of these style attributes. An "img" will
be inside an "div.sbspanel" when it is authored as part of a PTX "sidebyside".
So I am suggesting the width and height attributes need to go on sbspanel > img.
I think.
For an image *not* authored within a "sidebyside" I've made the HTML mirror the
case above.
div.imagepanel
img
No more constant "style" attribute. The div.imagepanel will have variable
margins and width derived from author's source.
Section 22.4 has the previous two non-sidebyside images, and I added a third
bare image with absolutely no layout information (no width, no margins).
PreTeXt writes 100% width, with 0% margins, as a default. If img.width=100%
and img.height=auto are in place the image seems to bump up against a
max-width=550px, and is left-justified (despite an attempt to center?).
Proposal: You and I both agree that images like this should have a bit of
indentation on either side. I'm not particular about the amount (presently
4.1666%?). I would like to control/enforce this via the PreTeXt layout
templates rather than with CSS. In other words, I'd like to have the PreTeXt
default change away from 100%.
Why? The very complicated, but very robust, templates to accomodate all the
different sidebyside layout parameters is (a) conversion-independent and (b)
recyclable for these non-sidebyside placements. In order to have an author's
source implemented faithfully in LaTeX and it HTML, it will mean accomodating in
the LaTeX conversion the implicit 600:550 scaling factor present in the HTML
conversion. Better long-term to unify as much as possible into the -common
templates.
https://pretextbook.org/beta/2019-04-21-images
Section 22.4, first three images, as discussed.
Section 22.7, SVG and JPG images, since mostly PNG elsewhere.
Section 9, many single images, authored outside a "sidebyside", but given inside
a "figure"
Thanks for working on this, I've wanted to nail this down for some time. Let's
finish styling here, I am going to move the general "single item sidebyside"
discussion to -dev just now.
Rob