かんたんな説明
ブックデザイナーの1ページの履歴書です。左側に色の帯があり、連絡先とスキルを載せています。職歴ごとの期間は右端にそろいます。
できあがり
マドリードで働く架空のブックデザイナー、Irene SalcedoのA4判1枚の履歴書です。幅66 mmのプラム色の帯が、用紙の左端を天から地まで走ります。帯の頭には、コードで描いたクロス装の本の積み重ねが、彼女の名前のベースラインと同じ高さに立っています。その下に連絡先、ピル型に組んだスキルとツール、語学、学歴、教歴、仕事以外の活動が続きます。名前は46 ptのHedvig Letters Serifで、幅118 mmの本文の段の頭に置き、その下に5行のプロフィール、3つの職歴、手がけた本の一覧が並びます。職歴の見出しはどれも、肩書きを左に、期間を同じベースラインの右端に置き、その下に勤務先をイタリックで入れます。サイドバーの最初の見出しは、名前の下の職種と同じベースラインに並びます。
このレシピが答える質問
- 幅の広い本文の段と幅の狭いサイド段からなる1段半のレイアウトにするには?
- すべてのページに透かし、背景の色、装飾画像を加えるには?
- キーボードのキー、タグ、練習問題の語群などのインラインのチップを作るには?
手短な答え
const layout = {
layoutType: 'oneAndHalf',
sideColumnPercent: (SIDE / CONTENT) * 100, // 57 of the 185 mm between the margins
sideColumnSide: 'left',
sideColumnRole: 'floats', // no body text: only boxes fenced with span="side"
gutterWidth: mm(GUTTER), // the text column keeps 185 − 57 − 10 = 118 mm
};
// A side box stands where the text has reached at its fence, so the Markdown opens with it,
// before the name, and it starts at the head of the column (gotcha: side-box-starts-at-fence):
// :::callout{type="sidebar" span="side"}
// :::callout{type="section" title="Contact"} … ::: ← the sections nest inside it
// …
// :::space{lines=2.76} ← last: runs the band to the column's foot; a fifth of a line
// ::: more and the whole box moves to page 2
// # Irene Salcedo {role="Book designer and art director"}
const sidebar = { id: 'sidebar', background: col('band'),
// The first title stands on the role's line. The text starts 10 mm from the trim, the
// left margin plus 1 mm, and stops 10 mm short of the band's right edge.
padding: { top: mm(ROLE_Y), right: mm(10), bottom: pt(0), left: mm(1) },
body: { fontFamily: SANS, fontSize: pt(8.4), lineHeight: pt(12.4), color: col('paper'),
boldColor: col('paper'), paragraphSpacing: false } };
材料
- 機能
- フロート用の余白段1段半組み欄外の注入れ子の囲み囲み明示的な縦のアキインラインのチップページデザインのテキスト・罫・ボックスページデザインの画像デザイン要素の基準位置見出しの階層見出しの属性箇条書きとチェックリスト段落スタイルセマンティックカラーパレットキャンバス上のページ
- 併用する機能
- デザインした章扉リソースとしての図と表
- 種類
- Hedvig Letters Serif, Hanken Grotesk (SIL OFL 1.1)
- 素材
- The stack of books at the head of the sidebar, drawn in code in the page's palette (Ignacio Ferro, CC BY 4.0)
作り方
#1 · 節を1つの脇のボックスに入れ子にする
// The sections nest in one side box. As separate side boxes they would stand at least a line
// of paper apart (gotcha: side-boxes-line-apart). A nested box ignores span and flows inside
// its parent (gotcha: nested-callout-limits).
const section = (id, lineHeight) => ({ id, backgroundEnabled: false, // the band shows through
padding: { top: pt(0), right: pt(0), bottom: pt(0), left: pt(0) },
marginTop: mm(10),
titleStyle: { ...caps('glow'), gap: mm(2.4) },
body: { ...sidebar.body, lineHeight: pt(lineHeight) } });
const chipStyles = [{ id: 'skill', fontFamily: SANS, fontSize: pt(7.6), bold: true,
background: col('chip'), color: col('paper'), borderWidth: pt(0),
borderRadius: em(1), // past half the chip's height: a pill
paddingX: em(0.6), paddingY: em(0.22), gap: em(0.3) }];
段の中では、帯は手短な答えの囲みです。その囲みのブロックは名前より前にあるので、span="side"がそれをフロート専用の段の頭に置きます。各節はその中に入れ子にした囲みで、それぞれには塗りがないので、プラム色はContactからOutside workまで途切れずに続きます。別々の脇の囲みにすると、marginBottomを0にしても4.7〜9.1 mm離れて並びます。ピルの高さは約3.9 mmです。SkillsとToolsは専用の節スタイルchipsを使い、その16 ptの行送りで行の間に1.8 mmが空きます。ほかの節の12.4 ptでは、0.5 mmしか空きません(チップスタイル)。
#2 · 段の周りの余白を塗る
// Header elements are painted after the text, over it, so these stay in the margins, where
// no text runs (gotcha: header-paints-over-text). They repeat on every page.
const BAND_W = LEFT + SIDE; // mm from the trim edge to the band's right edge
const SEAM = 0.5; // mm of overlap with the box, so no hairline of paper shows between them
const REACH = 1; // mm the foot box climbs above the column's foot, over the end of the box
const bandBox = (id, x, y, w, h) => ({ kind: 'box', id, style: { backgroundColor: col('band') },
placement: { ...at('page', 'top-left', x, y), size: { width: mm(w), height: mm(h) } } });
const header = { elements: [
bandBox('head', 0, 0, BAND_W, TOP + SEAM), // above the column: the top margin
bandBox('edge', 0, 0, LEFT + SEAM, TRIM_H), // beside it: the left margin, top to bottom
bandBox('foot', 0, TRIM_H - BOTTOM - REACH, BAND_W, BOTTOM + REACH), // below it
// Painted last, over the box's top padding, where no text runs. The bottom of the stack
// sits on the name's baseline.
{ kind: 'image', id: 'books', resourceId: 'books', placement: {
...at('page', 'top-left', LEFT + 1, TOP + BASELINE - BOOKS.h),
size: { width: mm(BOOKS.w), height: mm(BOOKS.h) } } },
] };
サイド段はページの余白の内側にあるので、サイドバーの囲みは左端の9 mm手前、天の18 mm手前で止まります。3つのヘッダーのボックスが、段の上の天の余白、天から地までの左の余白、段の下の地の余白を埋めます。ヘッダーの要素は本文の後に、本文の上へ重ねて塗られるので、このレシピでは本文の流れない余白の中にとどめています。ヘッダーの要素はすべてのページで繰り返されるので、2ページ目にも帯が付きます(柱とノンブル)。上と左のボックスはサイドバーの囲みに0.5 mm重なり、地のボックスは段の下端より1 mm上まで、サイドバーの囲みの終わりの上に伸びているので、継ぎ目に紙の細い線が見えることはありません。サイドバーの囲みを閉じる:::spaceは、英語版では2.76行、スペイン語版では1.76行で、囲みを段の下端より0.8 mm上の278.0 mmまで下ろします。
#3 · 本文の段の頭に名前を置く
const nameplate = { enabled: true, slot: { elements: [
{ kind: 'text', id: 'name', content: '{titleText}', fontFamily: SERIF,
fontSize: pt(NAME.size), lineHeight: 1, color: col('ink'),
placement: at('container', 'top-left') },
{ kind: 'text', id: 'role', content: '{attr.role}', ...caps('accent'),
placement: at('#name', 'below', 0, NAME.gap) },
] } };
const nameLevel = { level: 1, // span stays 'column': the name heads the text column only
// No break before the name: the sidebar box is already on the page, and a break would
// move the name and the whole text column to page 2.
breakBefore: { enabled: false },
marginBottom: pt(LEAD), // one grid line of air under the role
advancedDesign: nameplate };
H1は既定のspan: 'column'のままです。'page'にすると両方の段にまたがる章扉になり、サイドバーの囲みの後に置かれるので2ページ目へ移り、そこではサイド段が名前の下、45.9 mmの位置から始まります。サイドバーの囲みがすでにページにあるので、breakBeforeはオフにしています。改ページを入れると、名前と本文の段全体が2ページ目へ移ります。このレベルのmarginBottomをグリッド1行分にすると、プロフィールが41.3 mmではなく45.9 mmから始まります。サイドバーの囲みの上内側余白はROLE_Y、つまり名前の高さとその下の間隔の合計なので、サイドバーの最初の見出しと職種は、用紙の上端から39.3 mmの同じベースラインに並びます。
#4 · 期間を肩書きの行に置く
const JOB = 9.8; // pt: the job title, the dates and the employer share the size and leading
const jobText = (id, content, look) => ({ kind: 'text', id, content, fontFamily: SANS,
fontSize: pt(JOB), lineHeight: LEAD / JOB, // the body's leading, as a multiple of the size
align: 'left', ...look }); // without align, design text is centred in its box
const job = { enabled: true, slot: { elements: [
jobText('title', '{titleText}', { fontWeight: 700, color: col('ink'), overflow: 'wrap',
placement: { ...at('container', 'top-left'), size: { width: mm(84) } } }), // clear of dates
jobText('dates', '{attr.dates}', { color: col('muted'),
placement: at('container', 'top-right') }), // the title's top and size, so its baseline
jobText('org', '{attr.org}', { italic: true, color: col('muted'),
placement: at('#title', 'below') }),
] } };
const jobLevel = { level: 3, fontSize: pt(JOB), lineHeight: pt(LEAD), marginTop: pt(9),
marginBottom: pt(0), advancedDesign: job };
// The section head takes 20 pt under 19.6 pt of space, three grid lines, so a job head
// starts the same 9 pt under a grid line after a section head as after a list. The 9 pt
// below it merge with a job head's 9 pt above. Under Selected books they push the list to
// the next grid line, as the default 7 pt would; with 0 it would start one line higher.
const sectionLevel = { level: 2, fontSize: pt(14), lineHeight: pt(20),
marginTop: pt(3 * LEAD - 20), marginBottom: pt(9), advancedDesign: sectionHead };
職歴はどれもH3で、その属性が勤務先と期間を運びます。### Art director {org="Ediciones del Albardín, Madrid" dates="2021 – present"}のように書きます(見出しの属性)。肩書きと期間は同じコンテナーの上端に、それぞれ左右の角に固定し、同じサイズと行送りで組むので、1本のベースラインに並びます。肩書きは84 mmまでに制限して折り返しを許すので、長い肩書きは期間に届く前に2行目へ折り返し、勤務先はその下へ移ります。上の間隔を含めて各節の見出しがちょうどグリッド3行分を占めるので、職歴の見出しは、節の見出しの後でもリストの後でも、必ずグリッド線の9 pt下に来ます。
レシピの全体
// ═══ Postext Cookbook · Nº 057 · One-page CV with a sidebar ═══════════════════════
// https://postext.dev/en/cookbook/cv-with-sidebar
// Code: MIT · Text: original (CC BY 4.0) · Drawing: made in code (CC BY 4.0)
// Fonts: Hedvig Letters Serif, Hanken Grotesk (SIL OFL 1.1) · Needs postext ≥ 1.25.0
import {
buildDocumentWithFonts, renderPageToCanvas, registerResourceImage,
} from 'https://esm.sh/postext';
const LANG = 'en'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'cv-with-sidebar';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
const palette = {
ink: '#231b22', // text: a plum-tinted near-black
band: '#3a2235', // the sidebar
accent: '#8f3b62', // on paper: the role and the section heads (7.1:1)
glow: '#f1b98f', // on the band: the sidebar titles (8.3:1)
chip: '#744d6c', // on the band: the skill chips
rule: '#d9cdd5', // the hairlines after the section heads
muted: '#6c5f69', // dates, employers, the colophon (6.0:1)
paper: '#ffffff', // the page, and the text on the band (14.4:1)
};
// Each colour carries its hex and the palette entry it follows.
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = Object.entries({ ...palette, 'main-color': palette.accent })
.map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } }));
const [SERIF, SANS] = ['Hedvig Letters Serif', 'Hanken Grotesk'];
const PT = 25.4 / 72; // mm in a point
const [TRIM_W, TRIM_H] = [210, 297]; // mm: A4, printed on one side, so nothing is mirrored
const [TOP, LEFT, RIGHT] = [18, 9, 16]; // mm
const LEAD = 13.2; // pt: the body leading
const BOTTOM = TRIM_H - TOP - 56 * LEAD * PT; // mm: the text block holds 56 lines
const CONTENT = TRIM_W - LEFT - RIGHT; // 185 mm between the margins
const [SIDE, GUTTER] = [57, 10]; // mm: the sidebar column, and the white after it
const at = (to, edge, x = 0, y = 0) => ({ anchor: { to, edge }, offset: { x: mm(x), y: mm(y) } });
const LABEL = 7.8; // pt: the role and the sidebar titles, tracked capitals
const caps = (colour) => ({ fontFamily: SANS, fontSize: pt(LABEL), fontWeight: 700,
textTransform: 'uppercase', letterSpacing: pt(LABEL * 0.18), color: col(colour) });
const NAME = { size: 46, gap: 2.6 }; // pt and mm: the name, and the room under it
const ROLE_Y = NAME.size * PT + NAME.gap; // mm under the top margin: the role's line
// mm under the top margin: the name's baseline. Hedvig Letters Serif, set solid, puts it 0.795
// of the size down the line (measured on the page); another face needs its own ratio.
const BASELINE = 0.795 * NAME.size * PT;
const BOOKS = { w: 46, h: 18 }; // mm: the drawing at the head of the band
// #region answer: a float-only column on the left, filled by one box
const layout = {
layoutType: 'oneAndHalf',
組み立てたscript.jsはそのまま動きます。任意のページのモジュールスクリプトに貼り付けるか、レシピをCodePenで開いてください。 GitHub上のレシピのフォルダー ↗ (新しいタブで開きます)
アレンジ
#帯の色を変える
色はどれもpaletteに一度だけ書き、帯のボックス、サイドバーの囲み、チップ、職種、見出し、イラストはそこから色を取ります。次の3行で、帯、アクセント、チップがティール色になります。
- band: '#3a2235', // the sidebar
+ band: '#1d3b3a', // the sidebar
- accent: '#8f3b62', // on paper: the role and the section heads (7.1:1)
+ accent: '#2b5f5b', // on paper: the role and the section heads (7.3:1)
- chip: '#744d6c', // on the band: the skill chips
+ chip: '#456d69', // on the band: the skill chips#同じ段に図をフロートさせる
余白に段を設けた教科書は、すべてのページの小口側にあるフロート専用の段に、図、脇のキャプション、注釈を置きます。
よくあるつまずき
つまずき
サイド段の囲みは、囲みを開く位置の次のブロックと同じ高さから始まる
postext 1.4.1では、span: 'side'の囲みは、囲みを開く位置で本文が達した高さの次のグリッド行から、すでにある囲みがあればその下に、サイド段に置かれます。注釈は説明する段落の直前で開いてください。段落のあとで開くと、注釈は次の段落の横から始まります。段の末尾を越える囲みは、上の囲みが許す範囲で、下端が段の末尾にそろうまで上にずれます。それでも収まらない囲みは、次のページのサイド段まで待ちます。 欄外の注 →
つまずき
サイド段に積んだ囲みの間には、紙の地が1行分空く
postext 1.4.1では、span: 'side'の囲みは、marginBottomの値にかかわらず、サイド段で次に来るものとの間に、ベースライングリッドに切り上げた本文の少なくとも1行分を空けます。そのため背景が同じ囲みでも互いに接することはなく、積むと別々のカードに見えます。1枚の続いたパネルにするには、サイド段の囲みを1つだけ置き、その中に各部分を入れ子にしてください。 欄外の注 →
つまずき
:::spaceは囲みや段の頭では捨てられる
:::spaceは、段の頭、:::columnsグループの頭、ほかに中身のあるタイトルなしの囲みの頭、分割された囲みの続きの頭では捨てられます。postext 1.5からは、:::spaceだけで作った囲みは空きが求めるとおりの高さになり(解答欄の囲み、書き込み用の場所)、囲みのタイトルのすぐ下に置いた空きは、その分だけ本文を下げて始めます。タイトルなしの囲みを空きで始めるには、タイトルか最初の行を与え、そのあとに空きを入れてください。 明示的な縦のアキ →
つまずき
ヘッダーとフッターの要素は本文の上に描かれる
ヘッダーとフッターの要素はページの上に重ねて描かれ、本文の領域はそのための場所を空けません。要素は余白の中に収めてください。その場所を確保するのは余白です。 柱とノンブル →
つまずき
入れ子の囲みはspan、placement、snapToGridを無視する
ほかの囲みの中に入れ子にした囲みは、自分のspan、placement、snapToGrid、floatBarrierを無視し、常に親の内側の幅で親の中を流れます。 入れ子の囲み →
:::spaceはページに合わせて調整します。英語版では2.76行で囲みが段の下端の0.8 mm上で終わります。2.96行にすると下端を0.1 mm越えて、サイドバー全体が2ページ目へ移ります。2.66行では、囲みと地のボックスの間に紙の帯が空きます。- 名前のデザインの中のボックスでは帯を塗れません。見出しはボックスの高さを確保するので、帯と同じ高さのボックスにすると、段の260.8 mmより大きい高さを確保し、本文が2ページ目へ移ります。
reserve: falseを付けるとボックスは何も確保しませんが、段の中のデザインは段の下端で切られるので、地の余白は白いまま残ります。
クレジット
- 本文
- 書き下ろしの文章, CC BY 4.0
- 画像
- The stack of books at the head of the sidebar, drawn in code in the page's palette · Ignacio Ferro · CC BY 4.0
- フォント
- Hedvig Letters Serif (SIL OFL 1.1) · Hanken Grotesk (SIL OFL 1.1)


