Skip to main content

Module rules

Module rules 

Source
Expand description

This module defines the lowering rule image_rule of the graphics feature, along with what every lowering rule of the image element shares: the computation of the size at which an image is shown (shown_size), and the warning UnknownSize, which is reported when this size is unknown.

The rule image_rule lowers an image, that is, a node of the element IMAGE_ELEMENT of \includegraphics, to a flm.pres.image node. The graphics feature registers this rule for the backends text, html and latex-rendered. On the backend latex-recomposed, the rule LATEX_RULE writes an image as a LaTeX hook (latex).

The payload of the flm.pres.image node (ImagePayload) contains the following values:

  • src: the published address of the image, that is, the address at which the output refers to the image. The publish stage of the backend computes this address according to the strategy set for the output (publish), unless a publish stage of your own writes the published table in its place.
  • display: whether the image is a block or inline content. An image is a block when it is a direct child of the body of a float, and inline content everywhere else (GraphicsImage).
  • alt: the alternative text, given with the option alt.
  • width and height: the size at which the image is shown (shown_size).

Each backend writes this node in its own way. For instance, the plain-text output prints \includegraphics[alt=A plot]{plot.png} as [image: A plot], and the HTML output writes an <img> element. The rendering guide describes the output of each backend: images in plain text, images in HTML, and images in the rendered LaTeX.

Structs§

ImageRule
The implementation of the lowering rule image_rule for one backend. It lowers each image to a flm.pres.image node, as the module documentation describes.
UnknownSize
The warning that is reported when the size of an image is unknown (flm.graphics.unknown-size).

Functions§

image_rule
Returns the lowering rule flm.graphics.image.lower.<backend> (rule_name), which lowers each image to a flm.pres.image node on backend, as the module documentation describes.
rule_name
Returns the name of the lowering rule image_rule for backend: flm.graphics.image.lower.<backend>.
shown_size
Returns the width and the height at which an image is shown on an output. A dimension is None when it is not set.