Measurement Units

The default unit of measure for a PDF canvas is points (pt). However, you may prefer think of measurements in terms of inches (in), centimeters (cm), or millimeters (mm). The theme can convert from any of the supported measurement units to points when you specify a unit notation directly after a number.

Default unit

Many of the theme keys, such as border-width, padding, etc., require their values be a measurement. If you specify a number without any units, the units defaults to points (pt), the unit of measure for the PDF canvas. A point is defined as 1/72 of an inch.

Supported units

The following units are supported:

Unit Suffix Notes

Centimeter

cm

Inches

in

Millimeter

mm

Percentage

%, vw, or vh

A percentage with the % unit is calculated relative to the width or height of the content area. Viewport-relative percentages (vw or vh units) are calculated as a percentage of the page width or height, respectively. Currently, percentage units can only be used for placing elements on the title page or for setting the width of a block image.

Points

pt

Default unit of measure when no unit is specified.

Specify a measurement unit

Here’s an example of how you can use inches to define the page margins:

page:
  margin: [0.75in, 1in, 0.75in, 1in]

The order of elements in a measurement array is the same as it is in CSS:

  1. top

  2. right

  3. bottom

  4. left