links to this page:    How do I center a child morph object within the parent object? Morphic for beginners How to create a new Morphic project with code - example 2
A4 and A3 sheets in Morphic
Last updated at 8:41 am UTC on 14 January 2022
Exercise with A4 sheets
• Create a morph representing an A4 sheet
• Add morphs to the sheet, then
• Use export as PNG
• Print the PNG file

(not complete yet, add some content and show post script export)

A4 paper, a paper size defined by the ISO 216 standard, measuring 210 × 297 mm.

The sheets have an aspect ratio of 2 sqrt.

The main advantage of this system is its scaling. Rectangular paper with an aspect ratio of √2 has the unique property that, when cut or folded in half midway between its shorter sides, each half has the same √2 aspect ratio and half the area of the whole sheet before it was divided. Equivalently, if one lays two same-sized sheets paper with an aspect ratio of √2 side-by-side along their longer side, they form a larger rectangle with the aspect ratio of √2 and double the area of each individual sheet.

Here is a way to create Morphs which represent A4 and A3 sheets.

```a4Extent := 210 @ 297 "millimeter".
scaleFactorForDisplay := 1.2.
a4 := Morph new extent:  a4Extent * scaleFactorForDisplay.
a4 color: Color lightBlue.
a4 openInHand .

a4 := Morph new extent:  a4Extent * scaleFactorForDisplay.
a4 color: Color lightGreen.
a4 openInHand .

a3Extent := a4Extent scaleBy: (2 sqrt @ (2 sqrt)).
a3 := Morph new extent:  a3Extent transposed * scaleFactorForDisplay .
a3 color: Color lightRed.
a3 openInHand .
```

``` a4Extent := 210 @ 297 "millimeter".
a4ExtentPrintableArea := 190 @ 277 "millimeter".

scaleFactorForDisplay := 2.
a4ExtentForDisplay := a4Extent  * scaleFactorForDisplay.
a4 := Morph new extent:  a4ExtentForDisplay.
a4 color: Color lightBlue.

a4PrintableAreaExtentForDisplay := a4ExtentPrintableArea * scaleFactorForDisplay.
a4PrintableArea := Morph new extent:  a4PrintableAreaExtentForDisplay.
a4PrintableArea color: Color white.

a4PrintableArea center: a4 center.
a4 openInHand```

### 12 boxes

An A4 sheet with 12 boxes (submorphs). The layout is done by calculating the center points of the submorphs and then using the positioning method #center: on them.
An alternative would be to use a TableLayout.
```a4Extent := 210 @ 297 "millimeter".
a4ExtentPrintableArea := 190 @ 277 "millimeter".

scaleFactorForDisplay := 2.
a4ExtentForDisplay := a4Extent * scaleFactorForDisplay.
a4 := Morph new extent:  a4ExtentForDisplay.
a4 color: Color lightBlue.

a4PrintableAreaExtentForDisplay := a4ExtentPrintableArea * scaleFactorForDisplay.
a4PrintableArea := Morph new extent:  a4PrintableAreaExtentForDisplay.
a4PrintableArea color: Color white.

boxHeight := (a4PrintableArea height) /4.

boxWidth := (a4PrintableArea width) /3.
innerBoxWidth := boxHeight / (2 sqrt).

0 to: 3 do: [:row |
0 to: 2 do: [:col |
box:= Morph new extent: innerBoxWidth@boxHeight; color: Color random; borderWidth: 0.
centerPoint := ((col+0.5) * boxWidth)@((row+0.5) * boxHeight).
box center: centerPoint.
].

a4PrintableArea center: a4 center.
a4 openInHand
```

To consider for continuing the work:
• maintain the dimensioning in millimeters
• the scaleFactor needs to be a property of the morph so that if it is to be printed the scaling may be done accordingly.
• for morphs which are placed on the sheets the position is still given in mm.
• if there is the need to go for fractions of mm then the position and extent needs to be added as a property of the morph. The property will be used when printing or exporting.

### Also see

SVG minimal document - LODraw export (A4 size SVG export)