Examples

Worksheet

Unit 4 · Linear functions

Mathematics department, Brookside Academy

A fictional two-page A4 maths worksheet and answer key using CSS multi-column flow, spanning headers, ruled answer space, and an embedded chart.

Output of koma export

Page 1

Worksheet page 1: Unit 4 Linear functions in two ruled columns with key points and five numbered problems

Page 2

Worksheet page 2: Answers and explanations in two columns with worked solutions, a plotted intersection chart, and a summary table

Source

===
title: Unit 4 · Linear functions
type: article
size: A4
lang: en
css: |
  page {
    --koma-primary: #1b1f24;
    --koma-secondary: #c9a227;
    --koma-line: #8a929b;
    --koma-font-size: 12.5px;
    --ws-rule: #cbd2d9;
    --ws-pitch: 24px;
    --ws-paper: #ffffff;
    background: var(--ws-paper);
    color: #1b1f24;
    font-size: var(--koma-font-size);
    line-height: 1.5;
    /* The page number stands 3% above the foot of the page, the sheet ends 38px above it (THM-024). */
    padding: 34px 38px 3%;
  }
  page-footer { min-height: 4.31px; }
  box.ws-sheet {
    columns: 2;
    column-gap: 28px;
    column-rule: 1px solid var(--koma-line);
    column-fill: auto;
    row-gap: 12px;
    background:
      linear-gradient(to right, transparent calc(50% - 14px), var(--ws-paper) calc(50% - 14px) calc(50% + 14px), transparent calc(50% + 14px)),
      repeating-linear-gradient(to bottom, transparent 0 calc(var(--ws-pitch) - 1px), var(--ws-rule) calc(var(--ws-pitch) - 1px) var(--ws-pitch));
  }
  box.ws-sheet.plain {
    background: var(--ws-paper);
    column-fill: balance;
  }
  .span { column-span: all; }
  box.ws-head {
    background: var(--ws-paper);
    border-bottom: 2px solid #1b1f24;
    padding: 0 0 8px;
  }
  box.ws-head p { font-size: 0.92em; margin: 0; }
  box.ws-head h3 { font-size: 1.55em; margin: 0 0 2px; }
  col.ws-meta { align-items: flex-end; justify-content: flex-end; row-gap: 4px; }
  col.ws-meta p { text-align: right; white-space: nowrap; }
  box.ws-topic {
    background: #1b1f24;
    color: #ffffff;
    font-weight: 700;
    padding: 4px 10px;
    break-after: avoid;
  }
  box.ws-topic.span {
    box-shadow: 0 -10px 0 0 #ffffff;
  }
  box.ws-problem, box.ws-answer, box.ws-key, box.ws-note, box.ws-group, figure {
    break-inside: avoid;
    background: var(--ws-paper);
  }
  box.ws-group { row-gap: 8px; }
  box.ws-problem {
    --ws-space: 5;
    row-gap: 4px;
    border: 1.5px solid #1b1f24;
    padding: 6px 12px 10px;
    margin-block-end: calc(var(--ws-pitch) * var(--ws-space));
  }
  box.ws-problem h3, box.ws-answer h3 {
    font-size: 1em;
    margin: 0 0 4px;
    padding: 2px 0;
    border-bottom: 1px solid #1b1f24;
  }
  box.ws-problem.space-5 { --ws-space: 5; }
  box.ws-problem.space-6 { --ws-space: 6; }
  box.ws-problem.space-7 { --ws-space: 7; }
  box.ws-problem.space-8 { --ws-space: 8; }
  box.ws-problem.space-9 { --ws-space: 9; }
  box.ws-problem.space-10 { --ws-space: 10; }
  box.ws-answer {
    border: 1px solid #1b1f24;
    row-gap: 4px;
    padding: 6px 10px 8px;
    margin-block-end: 10px;
  }
  box.ws-step {
    border-left: 4px solid #1b1f24;
    background: #f1f3f5;
    padding: 2px 8px;
  }
  box.ws-key {
    border: 1.5px solid var(--koma-secondary);
    background: #fff8dc;
    padding: 8px 10px;
    margin-block-end: 12px;
  }
  box.ws-key h3 { font-size: 1em; color: #6b5200; margin: 0 0 4px; }
  box.ws-note {
    border-top: 1px dashed #6b737c;
    color: #3d4550;
    font-size: 0.92em;
    padding: 6px 0 0;
  }
  figure {
    font-size: 0.9em;
    background: var(--ws-paper);
    border: 1px solid #d0d7de;
    padding: 8px 10px 6px;
    margin-block-end: 10px;
  }
  th, td { padding: 0.25em 0.55em; }
  .blank {
    display: inline-block;
    min-width: 7.5em;
    border-bottom: 1px solid #1b1f24;
    margin-left: 6px;
    color: transparent;
  }
  .score-blank {
    display: inline-block;
    min-width: 6.5em;
    border-bottom: 1px solid #1b1f24;
    margin-left: 6px;
    text-align: right;
    color: #57606a;
    font-size: 0.92em;
  }
===

[box .ws-sheet:
  [box .ws-head .span:
    [col weight=3:
      # Unit 4 · Linear functions

      Worksheet A · Practice · 30 minutes
    ]
    [col .ws-meta weight=2:
      Name [\_\_\_\_\_\_]{.blank}

      Score [/ 30]{.score-blank}
    ]
  ]
  [box .ws-topic .span: Topic 1 · Slope, intercept, and intersections]
  [box .ws-key:
    # Key points

    A linear function is $y = ax + b$. The slope $a$ is the change in $y$ for each step of 1 in $x$; the intercept $b$ is the value of $y$ at $x = 0$.

    Through two points: $a = \dfrac{y_2 - y_1}{x_2 - x_1}$.
  ]
  [box .ws-problem .space-9:
    # Problem 1 · Reading a line

    A line passes through $(0, -1)$ and $(2, 3)$.
    [box .ws-step: (1) Find its slope.]
    [box .ws-step: (2) Write its equation.]
  ]
  [box .ws-problem .space-10:
    # Problem 2 · Two points and intercepts

    A line passes through $(1, 4)$ and $(3, 2)$.
    [box .ws-step: (1) Find its slope.]
    [box .ws-step: (2) Write its equation.]
    [box .ws-step:
      (3) Where does it cross the $x$-axis?
    ]
  ]
  [box .ws-problem .space-7:
    # Problem 3 · Where two lines meet

    Find the point where $y = 2x - 1$ and $y = -x + 5$ cross, and check your answer in both equations.
  ]
  [box .ws-problem .space-6:
    # Problem 4 · A table of values

    | $x$ | 0 | 1 | 2 | 3 |
    | --- | --- | --- | --- | --- |
    | $y$ | 7 | 4 | 1 |   |

    [box .ws-step:
      (1) Show that $y$ changes by the same amount each step.
    ]
    [box .ws-step:
      (2) Write $y$ in terms of $x$ and fill the empty cell.
    ]
  ]
  [box .ws-problem .space-6:
    # Problem 5 · A draining tank

    A water tank holds 40 L and loses 2.5 L each minute.
    [box .ws-step:
      (1) Write the volume $V$ after $t$ minutes.
    ]
    [box .ws-step: (2) After how many minutes is it empty?]
  ]
]

+++

[box .ws-sheet .plain:
  [box .ws-head .span:
    [col weight=3:
      # Answers and explanations

      Unit 4 · Worksheet A · Linear functions
    ]
    [col .ws-meta weight=2:
      Marks: 6 per problem (30 total)
    ]
  ]
  [box .ws-topic .span: Worked solutions · Problems 1–5]
  [box .ws-answer:
    # Problem 1

    (1) $a = \dfrac{3 - (-1)}{2 - 0} = \dfrac{4}{2} = 2$

    (2) Because the line passes through $(0, -1)$, the intercept is $b = -1$, so $y = 2x - 1$.
  ]
  [box .ws-answer:
    # Problem 2

    (1) $a = \dfrac{2 - 4}{3 - 1} = \dfrac{-2}{2} = -1$

    (2) Substitute $(1, 4)$: $4 = -1 \cdot 1 + b$, so $b = 5$ and $y = -x + 5$.

    (3) Set $y = 0$: $-x + 5 = 0$ gives $x = 5$, the point $(5, 0)$.
  ]
  [box .ws-answer:
    # Problem 3

    Set the right-hand sides equal: $2x - 1 = -x + 5$, so $3x = 6$ and $x = 2$. Then $y = 2(2) - 1 = 3$.

    Check in the second line: $-2 + 5 = 3$. They cross at $(2, 3)$.
  ]
  [figure:
    [chart h=235px f="2*x - 1; -x + 5" labels=("y = 2x − 1", "y = −x + 5") domain=(-1, 5) range=(-3, 9) x-title="$x$" y-title="$y$":]
    The lines of Problems 1 and 2 cross at $(2, 3)$; the second crosses the $x$-axis at $(5, 0)$.
  ]
  [box .ws-answer:
    # Problem 4

    (1) As $x$ increases by 1, $y$ drops by 3 each time ($7 \to 4 \to 1$), so the rate of change is constant at $-3$.

    (2) The intercept is $y(0) = 7$, giving $y = -3x + 7$. At $x = 3$, $y = -3(3) + 7 = -2$.
  ]
  [box .ws-answer:
    # Problem 5

    (1) Starting at 40 L and losing 2.5 L per minute gives $V = 40 - 2.5t$ ($0 \le t \le 16$).

    (2) Set $V = 0$: $40 - 2.5t = 0$, so $t = \dfrac{40}{2.5} = 16$. The tank is empty after 16 minutes.
  ]
  [box .ws-group:
    [box .ws-topic: Summary & quick checks]
    [box .ws-key:
      # Three ways to write a line

      | Known | Equation |
      | --- | --- |
      | Slope $a$, intercept $b$ | $y = ax + b$ |
      | Slope $a$, point $(x_1, y_1)$ | $y - y_1 = a(x - x_1)$ |
      | Two points | $a = \dfrac{y_2 - y_1}{x_2 - x_1}$ first |
    ]
    [box .ws-note:
      **Check your work:** substitute both original points back into your equation. A slope of 0 gives a horizontal line; two lines with equal slopes are parallel and never meet.
    ]
  ]
]