# Signos de lógica y de conjuntos con una fuente de símbolos

> Una cartilla de lógica en fuentes sin ∀, ∈ ni ℵ: symbolFont nombra Noto Sans Math, que dibuja esos signos y el griego en el lienzo y en el PDF.

- Versión HTML: https://postext.dev/es/cookbook/symbol-font-for-logic
- Receta N.º 185 · Texto y tipografía · Nivel 2 (Intermedio) · Salidas: Canvas, PDF
- Géneros: Libros de texto
- Requiere postext ≥ 1.73.0, postext-pdf ≥ 1.73.0 · probada con 1.73.0, postext-pdf 1.73.0 el 2026-11-10
- Páginas: [1](https://postext.dev/cookbook/symbol-font-for-logic/es/p01.webp?v=a34db0b1), [2](https://postext.dev/cookbook/symbol-font-for-logic/es/p02.webp?v=a34db0b1), [3](https://postext.dev/cookbook/symbol-font-for-logic/es/p03.webp?v=a34db0b1), [4](https://postext.dev/cookbook/symbol-font-for-logic/es/p04.webp?v=a34db0b1)
- PDF: https://postext.dev/cookbook/symbol-font-for-logic/es/symbol-font-for-logic.pdf?v=a34db0b1
- Abrir en el Sandbox: https://postext.dev/es/sandbox#recipe=symbol-font-for-logic&lang=es (.postext: https://postext.dev/cookbook/symbol-font-for-logic/es/symbol-font-for-logic.postext)
- Última actualización: 2026-11-10
- Otros idiomas: [en](https://postext.dev/en/cookbook/symbol-font-for-logic.md), [ca](https://postext.dev/ca/cookbook/symbol-font-for-logic.md), [de](https://postext.dev/de/cookbook/symbol-font-for-logic.md), [fr](https://postext.dev/fr/cookbook/symbol-font-for-logic.md), [it](https://postext.dev/it/cookbook/symbol-font-for-logic.md), [pt](https://postext.dev/pt/cookbook/symbol-font-for-logic.md), [zh](https://postext.dev/zh/cookbook/symbol-font-for-logic.md), [ja](https://postext.dev/ja/cookbook/symbol-font-for-logic.md), [ar](https://postext.dev/ar/cookbook/symbol-font-for-logic.md)

## En pocas palabras

Un capítulo breve que enseña a leer los signos de la lógica y de la teoría de conjuntos. Las fuentes del libro no tienen esos signos, así que una segunda fuente los pone, en pantalla y en el PDF impreso.

## Lo que vas a componer

El primer capítulo de una cartilla de lógica de bolsillo, en una página de 155 × 235 mm: una banda granate con los signos del capítulo a gran tamaño y después cuatro secciones que leen en voz alta ∀, ∃, ∈, ∪, ∅ y ℵ, con las fórmulas en el texto corrido y destacadas entre párrafos. El libro va en Crimson Pro, los títulos en Cormorant Garamond y los rótulos en IBM Plex Sans Condensed. Ninguna de las tres tiene ∀, ∈ ni una letra griega en los archivos que sirve Fontsource. Un solo ajuste, `symbolFont`, pone Noto Sans Math detrás de cada una, así que todos los signos salen de la misma fuente en el cuerpo, los títulos, las cabeceras y las celdas de las tablas, y el PDF los imprime todos.

**Esta receta responde a:**

- ¿Cómo imprimo los signos de lógica y conjuntos (∀, ∈, ℵ) y el griego que mi fuente no tiene, sin cajas vacías?

## La respuesta corta

```js
// script.js, líneas 34–47
// None of the three faces has ∀, ∈, ℵ or Greek. config.symbolFont (below) lists Noto Sans
// Math after every family the document names: what a face lacks is drawn from it, at the
// face's size and colour, in the canvas, the PDF, the HTML and the EPUB.
const SYMBOLS = 'Noto Sans Math';
// Fontsource serves Noto Sans Math whole in its "latin" file, and the kit would declare
// that file for the Latin range only. The screen and the PDF take it here with no range,
// so every glyph in it can be used.
const symbolFile = async () =>
  `${await fontsourceAt('noto-sans-math')}files/noto-sans-math-latin-400-normal.woff2`;
const resolve = async (family, ...face) =>
  (family === SYMBOLS ? [{ source: await symbolFile() }] : fontsourceResolver(family, ...face));
const pdfFonts = async (family, ...face) => (family !== SYMBOLS
  ? fontsourceProvider(family, ...face)
  : decompressWoff2(new Uint8Array(await (await fetch(await symbolFile())).arrayBuffer())));
```

## Ingredientes

**Enseña**

- [Fuente de símbolos](https://postext.dev/es/docs/configuration-fonts-colors-viewers.md#fuente-de-símbolos): symbolFont nombra una familia que dibuja los caracteres que no tienen las fuentes del documento (signos de lógica y de conjuntos, griego, flechas) en el lienzo, el PDF, el HTML y el EPUB, en lugar de una fuente del sistema o una caja vacía.
- [Fuentes incrustadas en el PDF](https://postext.dev/es/docs/configuration-pdf-output.md#por-qué-un-proveedor-de-fuentes): Un proveedor de fuentes entrega a renderToPdf los bytes TrueType estáticos de cada fuente que midió la composición, para que el PDF componga exactamente las mismas líneas.

**También usa**

- [Fuentes antes de componer](https://postext.dev/es/docs/configuration-programmatic-usage.md#cargar-las-fuentes-antes-de-componer)
- [Superíndices y subíndices](https://postext.dev/es/docs/document-format-inline.md#formato-en-línea)
- [Estilos de párrafo](https://postext.dev/es/docs/configuration-styles.md#estilos-de-párrafo)
- [Tablas a partir de datos](https://postext.dev/es/docs/document-format-resources.md#inserción-en-bloque-opcional-colocación-en-línea-explícita)
- [Estilo de tablas](https://postext.dev/es/docs/configuration-resources.md#estilo-de-tablas)
- [Aperturas diseñadas](https://postext.dev/es/docs/configuration-headings.md#apertura-a-toda-página-y-diseño-avanzado)
- [Atributos de título](https://postext.dev/es/docs/document-format.md#atributos-de-encabezado)
- [Cabeceras y folios](https://postext.dev/es/docs/configuration-headers-footers.md#cabeceras-y-pies)
- [Márgenes simétricos](https://postext.dev/es/docs/configuration-page-layout.md#márgenes-simétricos-espejo)
- [Paleta de color semántica](https://postext.dev/es/docs/configuration-fonts-colors-viewers.md#paleta-de-colores)
- [Exportación a PDF](https://postext.dev/es/docs/configuration-pdf-output.md#generación-de-pdf)
- [Figuras justo aquí](https://postext.dev/es/docs/document-format-resources.md#inserción-en-bloque-opcional-colocación-en-línea-explícita)
- [Figura y Tabla en tu idioma](https://postext.dev/es/docs/configuration-resources.md#tipos-de-recurso)
- [Cabeceras según el tipo de página](https://postext.dev/es/docs/configuration-headers-footers.md#elementos-de-texto)
- [Tipos de recurso propios](https://postext.dev/es/docs/configuration-resources.md#tipos-de-recurso)

**La configuración de un vistazo**

- [`bodyText`](https://postext.dev/es/docs/configuration-text.md#texto-base), [`captionStyle`](https://postext.dev/es/docs/configuration-resources.md#estilo-de-pies-de-recurso), [`colorPalette`](https://postext.dev/es/docs/configuration-fonts-colors-viewers.md#paleta-de-colores), [`footer`](https://postext.dev/es/docs/configuration-headers-footers.md#cabeceras-y-pies), [`header`](https://postext.dev/es/docs/configuration-headers-footers.md#cabeceras-y-pies), [`headings`](https://postext.dev/es/docs/configuration-headings.md#encabezados), [`layout`](https://postext.dev/es/docs/configuration-page-layout.md#disposición), [`locale`](https://postext.dev/es/docs/configuration-language.md#separación-silábica), [`page`](https://postext.dev/es/docs/configuration-page-layout.md#página), [`paragraphStyles`](https://postext.dev/es/docs/configuration-styles.md#estilos-de-párrafo), [`resourceTypes`](https://postext.dev/es/docs/configuration-resources.md#tipos-de-recurso), [`symbolFont`](https://postext.dev/es/docs/configuration-fonts-colors-viewers.md#fuente-de-símbolos), [`tableStyle`](https://postext.dev/es/docs/configuration-resources.md#estilo-de-tablas)

**API**

- [`buildDocumentWithFonts`](https://postext.dev/es/docs/configuration-programmatic-usage.md#cargar-las-fuentes-antes-de-componer), [`decompressWoff2`](https://postext.dev/es/docs/configuration-pdf-output.md#proveedor-de-fuentes-en-el-navegador-fontsource--woff2), [`defaultResourceTypes`](https://postext.dev/es/docs/configuration-resources.md#tipos-de-recurso), `formatWarning`, [`parseTSV`](https://postext.dev/es/docs/document-format-resources.md#inserción-en-bloque-opcional-colocación-en-línea-explícita), [`renderPageToCanvas`](https://postext.dev/es/docs/configuration-programmatic-usage.md#renderizar-una-página-como-mapa-de-bits), [`renderToPdf`](https://postext.dev/es/docs/configuration-pdf-output.md#generación-de-pdf)

**Tipografías**

- Crimson Pro (OFL-1.1), Cormorant Garamond (OFL-1.1), IBM Plex Sans Condensed (OFL-1.1), Noto Sans Math (OFL-1.1)

## Elaboración

### 1 · Una fuente de símbolos detrás de todas

El código de este paso es la respuesta corta, más arriba. `symbolFont: 'Noto Sans Math'` ([fuente de símbolos](https://postext.dev/es/docs/configuration-fonts-colors-viewers.md#fuente-de-símbolos)) coloca esa familia detrás de todas las que nombra la configuración: un carácter que la fuente no tiene se dibuja con Noto Sans Math, al tamaño y en el color de la fuente, y el resto de la línea sigue en la suya. Fontsource sirve Noto Sans Math entera en su archivo `latin`, con 3033 caracteres, pero el kit declara ese archivo solo para el rango latino, y el navegador no le pediría ∀. El `resolve` y el `pdfFonts` de la receta entregan el mismo archivo sin rango, en pantalla y a `renderToPdf`. Solo cambian de fuente los caracteres que faltan: Crimson Pro tiene ¬, así que la negación del texto sigue en Crimson Pro.

### 2 · Una primera composición sin ella enseña lo que falta

```js
// script.js, líneas 243–250
// Each paragraph that sets a character its face lacks is a glyphFallbackAt warning with its
// page; with no symbol font it names no family that draws them, and the PDF would print
// empty boxes. The pages shown are the second build's.
const fonts = { ...kitFonts(FONTS), resolve }; // the kit's resolver, with the symbol file
const bare = await buildDocumentWithFonts({ markdown, resources }, { ...config, symbolFont: '' },
  fonts);
console.info((bare.contentWarnings ?? []).filter((w) => w.kind === 'glyphFallbackAt')
  .map(formatWarning).join('\n'));
```

La primera composición deja `symbolFont` vacío e imprime sus avisos `glyphFallbackAt`, uno por cada párrafo, título o tabla que lleva caracteres para los que su fuente no tiene glifo, con la página y los caracteres. La edición inglesa da dieciocho: catorce párrafos en Crimson Pro, tres títulos en Cormorant Garamond y la fila de cabecera de la tabla 1.1 en IBM Plex Sans Condensed negrita. Sin una familia que los dibuje, el lienzo toma los signos de una fuente del sistema del lector y el PDF imprime una caja vacía por cada uno. La segunda composición, con la fuente de símbolos, es la que se ve en la página; sus avisos nombran `"Noto Sans Math"` como la familia que los dibuja.

### 3 · Los signos de la apertura son texto

```js
// script.js, líneas 51–67
const BAND = 78; // mm from the trim to the foot of the band
const onBand = { color: col('paper'), align: 'left' };
const below = (id, y, width) => ({ anchor: { to: `#${id}`, edge: 'below' }, offset: { y: mm(y) },
  size: { width: mm(width) } });
const opener = { enabled: true, minHeight: mm(BAND - TOP + 2), slot: { elements: [
  { kind: 'box', id: 'band', style: { backgroundColor: col('accent') },
    placement: { anchor: { to: 'bleed', edge: 'top-left' }, size: { height: mm(BAND) } } },
  { kind: 'text', id: 'kicker', content: '{attr.kicker}', ...onBand, fontFamily: LABEL,
    fontWeight: 600, fontSize: pt(8.5), letterSpacing: pt(1.8), textTransform: 'uppercase',
    placement: { anchor: { to: 'container', edge: 'top-left' }, offset: { y: mm(2) } } },
  { kind: 'text', id: 'title', content: '{titleText}', ...onBand, fontFamily: DISPLAY,
    fontWeight: 600, fontSize: pt(38), lineHeight: 1.02, placement: below('kicker', 3, 110) },
  // The signs are text in Cormorant Garamond, which has none of them: Noto Sans Math draws
  // every one, at 30 pt, in the band's white.
  { kind: 'text', id: 'signs', content: '{attr.signs}', ...onBand, fontFamily: DISPLAY,
    fontSize: pt(30), lineHeight: 1, letterSpacing: pt(9), placement: below('title', 7, 114) },
] } };
```

La línea de siete signos bajo el título es un texto de diseño en Cormorant Garamond a 30 pt, que toma su contenido del atributo `signs` del título. Cormorant Garamond no tiene ninguno, así que los siete salen de la fuente de símbolos, en el blanco de la banda. Un espaciado de 9 pt los reparte a lo ancho de la caja.

### 4 · Las celdas y las cabeceras usan la misma fuente

```js
// script.js, líneas 212–230
const [T, F] = t({ en: ['T', 'F'], es: ['V', 'F'] });
const connectives = [['¬*p*', (p) => !p], ['*p* ∧ *q*', (p, q) => p && q],
  ['*p* ∨ *q*', (p, q) => p || q], ['*p* → *q*', (p, q) => !p || q],
  ['*p* ↔ *q*', (p, q) => p === q]];
const cell = (content, isHeader = false) => ({ content, align: 'center', isHeader });
const truth = [[true, true], [true, false], [false, true], [false, false]].map(([p, q]) =>
  [p, q, ...connectives.map(([, f]) => f(p, q))].map((v) => cell(v ? T : F)));
const table = (id, rows, columnWidths, caption, position) => ({ id, typeId: 'table',
  kind: 'table', caption, createdAt: 0, updatedAt: 0, placement: { position },
  table: { model: { headerRowCount: 1, columnWidths, rows } } });
const resources = [
  table('truth', [['*p*', '*q*', ...connectives.map(([s]) => s)].map((s) => cell(s, true)),
    ...truth],
    [1, 1, 1.3, 1.6, 1.6, 1.6, 1.6], t({ en: 'The five connectives, row by row.',
      es: 'Las cinco conectivas, fila a fila.' }), 'top'), // to the head of a page
  table('signs', parseTSV(signs.trim()).rows.map((row, r) => row.map(({ content }, c) => ({
    content, align: c === 0 ? 'center' : 'left', isHeader: r === 0 }))), [0.8, 2.1, 5.3],
  t({ en: 'Where the signs come from.', es: 'De dónde vienen los signos.' }), 'here'),
];
```

La tabla de verdad se construye con las propias conectivas: la cabecera de cada columna es la fórmula, y cada celda, lo que la fórmula da en esa fila. Las celdas de cabecera van en IBM Plex Sans Condensed negrita cursiva y las del cuerpo en Crimson Pro; la fuente de símbolos sirve a las dos. Su única variante redonda dibuja para todos los pesos e inclinaciones, de modo que el ∧ de la cabecera en negrita y el ∈ de una fórmula en cursiva son el mismo signo recto. La cabecera de la página impar imprime la sección en curso, `{firstMark.h2}`, y *CONJUNTOS: ∈, ∪, ∩ Y ∅*, en la página 3, también toma sus signos de Noto Sans Math.

![Página 3: Conjuntos: ∈, ∪, ∩ y ∅. Las metavariables griegas φ, ψ, Γ ⊢ φ, la sección Conjuntos con tres fórmulas destacadas para ⊆, ∪ y ∩, la paradoja de Russell y la sección Contar el infinito: ℵ.](https://postext.dev/cookbook/symbol-font-for-logic/es/p03.webp?v=a34db0b1)

*Página 3: las fórmulas de conjuntos, en Crimson Pro cursiva, con todos los signos de Noto Sans Math.*

## La receta completa

Un solo archivo, compuesto a partir de la carpeta de la receta con el texto de ejemplo y el kit común del Recetario ya incluidos; construye su propia página. Para ejecutarlo, ponlo en un `<script type="module">` de una página vacía o pégalo en el panel JS de un pen nuevo de CodePen (como módulo). Importa postext desde esm.sh, así que no hay nada que instalar ni compilar.

- Carpeta de la receta: https://github.com/drnachio/postext/tree/main/cookbook/symbol-font-for-logic

### script.js

```js
// ═══ Postext Cookbook · Nº 185 · Logic signs from a symbol font ═════════════════════
// https://postext.dev/en/cookbook/symbol-font-for-logic
// Code: MIT · Text: original (CC BY 4.0) · Pictures: none
// Fonts: Crimson Pro, Cormorant Garamond, IBM Plex, Noto Sans Math (OFL) · Needs postext ≥ 1.73.0
// A primer of logical notation set in faces that have no ∀, no ∈, no ℵ and no Greek:
// symbolFont names Noto Sans Math, which draws those characters on the canvas and in the PDF.
import {
  buildDocumentWithFonts, renderPageToCanvas, defaultResourceTypes, parseTSV, formatWarning,
} from 'https://esm.sh/postext';
import { renderToPdf, decompressWoff2 } from 'https://esm.sh/postext-pdf';

const LANG = 'es'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'symbol-font-for-logic';

// ─── 1 · Design ─────────────────────────────────────────────────────────────
const palette = {
  ink: '#1f1c22', // text: a cool near-black
  accent: '#7b2a3b', // claret: the opener band, labels, the table heads
  tint: '#f4ece9', // the even rows of the truth table
  rule: '#c3b4b2', // hairlines
  muted: '#6a6064', // running heads, the colophon
  paper: '#ffffff',
};
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = [
  ...Object.entries(palette).map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } })),
  { id: 'main-color', name: 'accent (defaults)', value: { hex: palette.accent, model: 'hex' } },
];
const TEXT = 'Crimson Pro', DISPLAY = 'Cormorant Garamond', LABEL = 'IBM Plex Sans Condensed';
const TRIM = [155, 235], INNER = 20, OUTER = 21, TOP = 23; // mm: a trade-size primer
const LEAD = 15; // pt: the body leading

// #region answer: one symbol font behind every face, on the canvas and in the PDF
// None of the three faces has ∀, ∈, ℵ or Greek. config.symbolFont (below) lists Noto Sans
// Math after every family the document names: what a face lacks is drawn from it, at the
// face's size and colour, in the canvas, the PDF, the HTML and the EPUB.
const SYMBOLS = 'Noto Sans Math';
// Fontsource serves Noto Sans Math whole in its "latin" file, and the kit would declare
// that file for the Latin range only. The screen and the PDF take it here with no range,
// so every glyph in it can be used.
const symbolFile = async () =>
  `${await fontsourceAt('noto-sans-math')}files/noto-sans-math-latin-400-normal.woff2`;
const resolve = async (family, ...face) =>
  (family === SYMBOLS ? [{ source: await symbolFile() }] : fontsourceResolver(family, ...face));
const pdfFonts = async (family, ...face) => (family !== SYMBOLS
  ? fontsourceProvider(family, ...face)
  : decompressWoff2(new Uint8Array(await (await fetch(await symbolFile())).arrayBuffer())));
// #endregion

// #region opener: a claret band with the chapter's signs set large
const BAND = 78; // mm from the trim to the foot of the band
const onBand = { color: col('paper'), align: 'left' };
const below = (id, y, width) => ({ anchor: { to: `#${id}`, edge: 'below' }, offset: { y: mm(y) },
  size: { width: mm(width) } });
const opener = { enabled: true, minHeight: mm(BAND - TOP + 2), slot: { elements: [
  { kind: 'box', id: 'band', style: { backgroundColor: col('accent') },
    placement: { anchor: { to: 'bleed', edge: 'top-left' }, size: { height: mm(BAND) } } },
  { kind: 'text', id: 'kicker', content: '{attr.kicker}', ...onBand, fontFamily: LABEL,
    fontWeight: 600, fontSize: pt(8.5), letterSpacing: pt(1.8), textTransform: 'uppercase',
    placement: { anchor: { to: 'container', edge: 'top-left' }, offset: { y: mm(2) } } },
  { kind: 'text', id: 'title', content: '{titleText}', ...onBand, fontFamily: DISPLAY,
    fontWeight: 600, fontSize: pt(38), lineHeight: 1.02, placement: below('kicker', 3, 110) },
  // The signs are text in Cormorant Garamond, which has none of them: Noto Sans Math draws
  // every one, at 30 pt, in the band's white.
  { kind: 'text', id: 'signs', content: '{attr.signs}', ...onBand, fontFamily: DISPLAY,
    fontSize: pt(30), lineHeight: 1, letterSpacing: pt(9), placement: below('title', 7, 114) },
] } };
// #endregion

// #region running-heads: the book on the verso, the section on the recto
const head = (id, content, parity, edge, x, extra = {}) => ({
  kind: 'text', id, content, parity, pages: 'body', fontFamily: LABEL, fontSize: pt(7.5),
  fontWeight: 500, letterSpacing: pt(1.2), textTransform: 'uppercase', color: col('muted'),
  placement: { anchor: { to: 'page', edge }, offset: { x: mm(x), y: mm(13) } }, ...extra });
const folio = { fontWeight: 600, color: col('ink') };
const header = { elements: [
  head('verso-folio', '{pageNumber}', 'even', 'top-left', OUTER, folio),
  head('verso-title', '{title}', 'even', 'top-left', OUTER + 8),
  // A section title such as "Quantifiers: ∀ and ∃" takes its signs from the symbol font too.
  head('recto-title', '{firstMark.h2}', 'odd', 'top-right', -(OUTER + 8)),
  head('recto-folio', '{pageNumber}', 'odd', 'top-right', -OUTER, folio),
] };
const footer = { elements: [head('drop-folio', '{pageNumber}', 'all', 'top', 0, {
  ...folio, pages: 'opener',
  placement: { anchor: { to: 'container', edge: 'top' }, offset: { y: mm(9) } } })] };
// #endregion

const config = {
  locale: t({ en: 'en-us', es: 'es' }),
  symbolFont: SYMBOLS,
  resourceTypes: defaultResourceTypes(LANG),
  colorPalette,
  page: { sizePreset: 'custom', width: mm(TRIM[0]), height: mm(TRIM[1]), dpi: 150,
    margins: { top: mm(TOP), bottom: mm(22), left: mm(INNER), right: mm(OUTER), mirror: true } },
  layout: { layoutType: 'single' },
  bodyText: {
    fontFamily: TEXT, fontSize: pt(11), lineHeight: pt(LEAD), color: col('ink'),
    boldColor: col('ink'), italicColor: col('ink'), referenceColor: col('ink'),
    textAlign: 'justify', firstLineIndent: mm(4.5), indentAfterHeading: false,
    hyphenation: { enabled: true }, optimalLineBreaking: true,
    avoidWidows: true, avoidOrphans: true, avoidRunts: true,
  },
  headings: { fontFamily: DISPLAY, color: col('ink'), fontWeight: 600,
    levels: [
      { level: 1, fontSize: pt(38), breakBefore: { parity: 'odd' }, advancedDesign: opener,
        marginBottom: pt(0) },
      { level: 2, fontSize: pt(16), lineHeight: pt(LEAD * 1.2), color: col('accent'),
        marginTop: pt(LEAD), marginBottom: pt(LEAD * 0.3) },
    ] },
  paragraphStyles: [
    // Displayed formulas: centred, in the text face, a size up; the signs still come from
    // the symbol font, the italic variables from Crimson Pro.
    { id: 'formula', fontSize: pt(12), lineHeight: pt(LEAD * 1.2), textAlign: 'center',
      firstLineIndent: pt(0), hyphenation: { enabled: false } },
    { id: 'colophon', fontFamily: LABEL, fontSize: pt(7.5), lineHeight: pt(10),
      color: col('muted'), textAlign: 'left', firstLineIndent: pt(0), marginTop: pt(LEAD) },
  ],
  tableStyle: { rules: 'horizontal', borderColor: col('rule'), borderWidth: pt(0.5),
    headerBackground: col('accent'), headerColor: col('paper'), headerBold: true,
    headerFontFamily: LABEL, headerFontSize: pt(8.5), bodyFontFamily: TEXT,
    bodyFontSize: pt(10), bodyColor: col('ink'), cellPadding: mm(1.1) },
  captionStyle: { fontFamily: LABEL, fontSize: pt(8), color: col('ink'), labelBold: true,
    labelColor: col('accent'), note: { color: col('muted') } },
  header,
  footer,
};

// ─── 2 · Content ────────────────────────────────────────────────────────────
const markdown = String.raw`---
title: "Cartilla de lógica"
author: "Ignacio Ferro"
---

# Leer los signos {kicker="Cartilla de lógica · Capítulo 1" signs="∀ ∃ → ∈ ∪ ∅ ℵ"}

Una página de lógica parece una página de álgebra que ha perdido los números. Sus letras representan enunciados, objetos y colecciones de objetos, y una docena de signos los mantiene unidos. La mayoría de esos signos es más joven que el teléfono: Giuseppe Peano imprimió el primero de los modernos en 1889, y Gerhard Gentzen añadió el último de los habituales en 1935. Este capítulo los lee uno a uno, en el orden en que los encuentra un primer curso, y da a cada uno su nombre en palabras, para que cualquier fórmula pueda leerse en voz alta como una frase.

## Enunciados y conectivas

Una letra como *p* o *q* representa un enunciado entero, que es verdadero o falso: *llueve*, *el tren llega tarde*. Cinco signos forman enunciados largos a partir de otros más cortos. ¬*p* se lee «no *p*» y es verdadero justo cuando *p* es falso. *p* ∧ *q*, «*p* y *q*», es verdadero cuando lo son los dos. *p* ∨ *q*, «*p* o *q*», es verdadero cuando lo es al menos uno; el signo es una *v* estilizada, por el latín *vel*, la «o» que admite las dos cosas. *p* → *q*, «si *p*, entonces *q*», solo es falso en un caso: cuando *p* es verdadero y *q* es falso. *p* ↔ *q*, «*p* si y solo si *q*», es verdadero cuando los dos lados coinciden.

La tabla 1.1 pone las cinco una junto a otra. Cada fila es una manera en que podría estar el mundo, y cada columna es un enunciado, que se obtiene de las dos letras de la izquierda.

::resource{id="truth"}

La tabla zanja cuestiones en las que la intuición se equivoca. Las filas tercera y cuarta muestran que *p* → *q* es verdadero siempre que *p* es falso, diga lo que diga *q*: una promesa cuya condición nunca se cumplió no se ha roto. La tabla demuestra también las leyes de De Morgan, que convierten la negación de una «o» en una «y» de negaciones, y al revés:

:::paragraphs{style="formula"}
¬(*p* ∨ *q*) ↔ (¬*p* ∧ ¬*q*) \
¬(*p* ∧ *q*) ↔ (¬*p* ∨ ¬*q*)
:::

## Cuantificadores: ∀ y ∃

Las letras de enunciado no ven el interior de un enunciado. *Todos los humanos son mortales* y *Sócrates es humano* no comparten ninguna letra y, sin embargo, juntas dan *Sócrates es mortal*. La lógica de predicados separa un enunciado en un predicado y las cosas de las que se dice: *Hx* para «*x* es humano», *Mx* para «*x* es mortal», *s* para Sócrates. Dos cuantificadores dicen entonces de cuántas cosas vale un predicado. ∀*x*, «para todo *x*», es una A puesta del revés; ∃*x*, «existe un *x*», una E vuelta hacia atrás.

:::paragraphs{style="formula"}
∀*x* (*Hx* → *Mx*) \
*Hs* → *Ms*
:::

La primera línea es la premisa mayor del silogismo más antiguo de los manuales, y la segunda, lo que esa premisa dice de Sócrates en particular. Los dos cuantificadores están ligados por la negación. Negar que todo tenga una propiedad es decir que algo carece de ella, y negar que algo la tenga es decir que todo carece de ella:

:::paragraphs{style="formula"}
¬∀*x* φ ↔ ∃*x* ¬φ \
¬∃*x* φ ↔ ∀*x* ¬φ
:::

Las letras griegas φ y ψ no forman parte del lenguaje de las fórmulas. Cada una representa una fórmula cualquiera, así que cada línea de arriba es un esquema con infinitos casos. Los lógicos reservan el alfabeto griego para hablar de las fórmulas y el latino para las fórmulas mismas. Una gamma mayúscula, Γ, suele nombrar un conjunto de premisas, y Γ ⊢ φ dice que φ se puede deducir de ellas.

## Conjuntos: ∈, ∪, ∩ y ∅

Un conjunto es una colección tomada como un solo objeto. *a* ∈ *A* dice que *a* es elemento de *A*, y *a* ∉ *A*, que no lo es. *A* ⊆ *B* dice que todo elemento de *A* es elemento de *B*; *A* ⊂ *B* añade que *B* tiene algún elemento más. Con las conectivas y los cuantificadores, cada una de estas relaciones se reduce a un enunciado sobre elementos:

:::paragraphs{style="formula"}
*A* ⊆ *B* ↔ ∀*x* (*x* ∈ *A* → *x* ∈ *B*) \
*x* ∈ *A* ∪ *B* ↔ (*x* ∈ *A* ∨ *x* ∈ *B*) \
*x* ∈ *A* ∩ *B* ↔ (*x* ∈ *A* ∧ *x* ∈ *B*)
:::

La unión ∪ se construye sobre la «o», y la intersección ∩, sobre la «y», y las formas dejan ver el parentesco: ∪ se abre hacia arriba como ∨, ∩ hacia abajo como ∧. El conjunto vacío ∅ no tiene elementos, ∀*x* (*x* ∉ ∅), y es subconjunto de cualquier conjunto *A*, porque la condición de ∀*x* (*x* ∈ ∅ → *x* ∈ *A*) no se cumple nunca.

No toda condición define un conjunto. En junio de 1902, Bertrand Russell escribió a Gottlob Frege sobre la colección de todos los conjuntos que no son elementos de sí mismos. Llamémosla *R*. Si *R* ∈ *R*, *R* no cumple su propia condición, luego *R* ∉ *R*; si *R* ∉ *R*, la cumple, luego *R* ∈ *R*. El sistema de Frege admitía *R*, y con ella *R* ∈ *R* ↔ *R* ∉ *R*, una contradicción. Las teorías de conjuntos que se enseñan hoy no dejan que una colección así sea un conjunto.

## Contar el infinito: ℵ

Dos conjuntos tienen el mismo tamaño cuando sus elementos pueden emparejarse uno a uno. Los números naturales, ℕ, y los números pares se emparejan llevando cada *n* a 2*n*, de modo que un conjunto infinito puede ser tan grande como una parte de sí mismo. Georg Cantor designó el tamaño de ℕ con ℵ~0~, alef cero, la primera letra del alfabeto hebreo, y demostró en 1891 que los números reales no pueden emparejarse con ℕ: cualquier lista de ellos deja alguno fuera. Hay, por tanto, al menos dos tamaños infinitos, y sus alefs ℵ~0~, ℵ~1~, ℵ~2~ los nombran por orden.

## De dónde vienen los signos

Los signos de este capítulo llegaron a la imprenta uno a uno y de manos distintas; la tabla 1.2 dice quién puso en uso cada uno.

::resource{id="signs"}

:::paragraphs{style="colophon"}
Compuesto en Crimson Pro, Cormorant Garamond e IBM Plex Sans Condensed, con los signos de Noto Sans Math (SIL Open Font License) · Texto: original, CC BY 4.0.
:::
`; // content.<lang>.md, inlined by the Cookbook
const signs = String.raw`Signo	Se lee	Lo puso en uso
∈	es elemento de	Giuseppe Peano, *Arithmetices principia*, 1889, como ε, por el griego *esti*, «es»
∪ ∩	unión, intersección	Peano, *Calcolo geometrico*, 1888
∃	existe	Peano, *Formulaire de mathématiques*, tomo II, 1897
ℵ	alef	Georg Cantor, *Mathematische Annalen*, 1895
∨	o	Whitehead y Russell, *Principia Mathematica*, 1910
→	si…, entonces	Hilbert y Ackermann, *Grundzüge der theoretischen Logik*, 1928
¬	no	Arend Heyting, sobre la lógica intuicionista, 1930
∀	para todo	Gerhard Gentzen, *Mathematische Zeitschrift*, 1935
∅	el conjunto vacío	André Weil, para Nicolas Bourbaki, 1939
`; // TSV: sign, read as, made current by

// #region tables: the truth table from the connectives themselves, the signs from TSV
const [T, F] = t({ en: ['T', 'F'], es: ['V', 'F'] });
const connectives = [['¬*p*', (p) => !p], ['*p* ∧ *q*', (p, q) => p && q],
  ['*p* ∨ *q*', (p, q) => p || q], ['*p* → *q*', (p, q) => !p || q],
  ['*p* ↔ *q*', (p, q) => p === q]];
const cell = (content, isHeader = false) => ({ content, align: 'center', isHeader });
const truth = [[true, true], [true, false], [false, true], [false, false]].map(([p, q]) =>
  [p, q, ...connectives.map(([, f]) => f(p, q))].map((v) => cell(v ? T : F)));
const table = (id, rows, columnWidths, caption, position) => ({ id, typeId: 'table',
  kind: 'table', caption, createdAt: 0, updatedAt: 0, placement: { position },
  table: { model: { headerRowCount: 1, columnWidths, rows } } });
const resources = [
  table('truth', [['*p*', '*q*', ...connectives.map(([s]) => s)].map((s) => cell(s, true)),
    ...truth],
    [1, 1, 1.3, 1.6, 1.6, 1.6, 1.6], t({ en: 'The five connectives, row by row.',
      es: 'Las cinco conectivas, fila a fila.' }), 'top'), // to the head of a page
  table('signs', parseTSV(signs.trim()).rows.map((row, r) => row.map(({ content }, c) => ({
    content, align: c === 0 ? 'center' : 'left', isHeader: r === 0 }))), [0.8, 2.1, 5.3],
  t({ en: 'Where the signs come from.', es: 'De dónde vienen los signos.' }), 'here'),
];
// #endregion

// ─── 3 · Fonts ──────────────────────────────────────────────────────────────
const FONTS = {
  'Crimson Pro': ['400', '400i', '600'],
  'Cormorant Garamond': ['400', '600'], // 400: the line of signs, all of it from the symbol font
  'IBM Plex Sans Condensed': ['400', '500', '600', '700', '700i'],
  'Noto Sans Math': ['400'], // the symbol font: one upright regular for every face
};

// ─── 4 · Build & show ───────────────────────────────────────────────────────
// #region without: one build without the symbol font, to read what it reports
// Each paragraph that sets a character its face lacks is a glyphFallbackAt warning with its
// page; with no symbol font it names no family that draws them, and the PDF would print
// empty boxes. The pages shown are the second build's.
const fonts = { ...kitFonts(FONTS), resolve }; // the kit's resolver, with the symbol file
const bare = await buildDocumentWithFonts({ markdown, resources }, { ...config, symbolFont: '' },
  fonts);
console.info((bare.contentWarnings ?? []).filter((w) => w.kind === 'glyphFallbackAt')
  .map(formatWarning).join('\n'));
// #endregion
const doc = await buildDocumentWithFonts({ markdown, resources }, config, fonts);
showPages(doc, { title: t({ en: 'A pocket primer of logic', es: 'Cartilla de lógica' }) });
offerPdf(() => renderToPdf(doc, { fontProvider: pdfFonts }), `${RECIPE}.pdf`);

// ─── Kit ── helpers shared by every Cookbook recipe · postext.dev/cookbook ─────

// ─── Kit · core v1 ── the same in every recipe · postext.dev/cookbook
function mm(value) { return { value, unit: 'mm' }; }
function pt(value) { return { value, unit: 'pt' }; }
function em(value) { return { value, unit: 'em' }; }
/** The sample language's string: t({ en: 'Figure', es: 'Figura' }). */
function t(strings) { return strings[LANG] ?? Object.values(strings)[0]; }
/** A file in this recipe's assets folder, served from the Postext repo by jsDelivr. */
function asset(file) { return `https://cdn.jsdelivr.net/gh/drnachio/postext@main/cookbook/${RECIPE}/assets/${file}`; }

// ─── Kit · fonts v3 ── the same in every recipe · postext.dev/cookbook
// Postext loads the faces a config asks for before layout and asks the kit
// for Fontsource's files, the ones the PDF embeds too.

/** buildDocumentWithFonts' options: the resolver, and FONTS' faces loaded
 *  with the config's. FONTS = { 'Family Name': ['400', '400i', '700'] }. */
function kitFonts(FONTS = {}) {
  const faces = Object.entries(FONTS).flatMap(([family, specs]) => specs.map((spec) =>
    ({ family, weight: parseInt(spec, 10), style: spec.endsWith('i') ? 'italic' : 'normal' })));
  return { resolve: fontsourceResolver, faces };
}

/** A face's files with their ranges: latin, then latin-ext and greek when
 *  `text` needs them (kitSubsetsFor). Null for a face Fontsource lacks. */
async function fontsourceResolver(family, weight, style, { text = '' } = {}) {
  const id = fontsourceId(family);
  const meta = await fontsourceMeta(family);
  if (meta && !(await fontsourceWeights(family, style)).includes(weight)) return null;
  kitStatus('Loading fonts…');
  const at = await fontsourceAt(id);
  return ['latin', ...kitSubsetsFor(text, meta)].map((subset) => ({
    source: `${at}files/${id}-${subset}-${weight}-${style}.woff2`,
    unicodeRange: kitRanges()[subset],
  }));
}

/** Each file's unicode-range (a function: the kit runs after the pen's code). */
function kitRanges() {
  return {
    latin: 'U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,'
      + 'U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD',
    'latin-ext': 'U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,'
      + 'U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF',
    greek: 'U+0370-03FF',
  };
}

/** For the cjk, arabic and comics blocks: loads `faces` (as FONTS) for the
 *  sample `text`; `optional` skips a face Fontsource lacks. Files are added in
 *  the order asked, the last winning a shared character. Resolves to the count. */
async function loadFonts(faces, text = '', { optional = false } = {}) {
  kitStatus('Loading fonts…');
  const ranges = kitRanges();
  const jobs = [];
  for (const [family, specs] of Object.entries(faces)) {
    const id = fontsourceId(family);
    const todo = [...new Set(specs)].map((spec) => [parseInt(spec, 10), spec.endsWith('i') ? 'italic' : 'normal'])
      .filter(([weight, style]) => !hasFace(family, weight, style)); // before any await
    const at = fontsourceAt(id);
    const meta = optional || /[^\0-ÿ]/u.test(text) ? await fontsourceMeta(family) : null;
    const subsets = ['latin', ...kitSubsetsFor(text, meta)];
    for (const [weight, style] of todo) {
      if (optional && !(meta && (await fontsourceWeights(family, style)).includes(weight))) continue;
      for (const subset of subsets) {
        const url = `${await at}files/${id}-${subset}-${weight}-${style}.woff2`;
        const face = new FontFace(family, `url(${url}) format('woff2')`,
          { weight: String(weight), style, unicodeRange: ranges[subset] });
        jobs.push(face.load().catch(() => {
          if (subset === 'latin' && !optional) throw new Error(`Fontsource has no ${family} ${weight} ${style}`);
        }));
      }
    }
  }
  const ready = await Promise.all(jobs).catch((error) => { kitFail(error); throw error; });
  return ready.filter((face) => face && document.fonts.add(face)).length;
}

/** A loaded FontFace covers this face (fonts.check() says yes to any family). */
function hasFace(family, weight, style) {
  for (const face of document.fonts) {
    if (face.status !== 'loaded' || face.style !== style) continue;
    if (face.family.replace(/^["']|["']$/g, '') !== family) continue;
    const [low, high = low] = face.weight.split(' ').map(Number);
    if (weight >= low && weight <= high) return true;
  }
  return false;
}

/** The files beyond latin `text` needs that `meta`'s family ships. */
function kitSubsetsFor(text, meta) {
  return [[/[Ā-˿ᴀ-ᶿḀ-ỿ†ℓⱠ-Ɀ꜠-ꟿ]/u, 'latin-ext'], [/[Ͱ-Ͽ]/u, 'greek']]
    .filter(([re, x]) => re.test(text) && meta?.subsets?.includes(x)).map(([, x]) => x);
}

/** Fontsource's id for a family: 'Source Serif 4' → 'source-serif-4'. */
function fontsourceId(family) { return family.toLowerCase().replace(/\s+/g, '-'); }

/** A package's folder at the one version @5 names now (#766). */
function fontsourceAt(id, u = `https://cdn.jsdelivr.net/npm/@fontsource/${id}@`) {
  return (fontsourceAt.c ??= {})[id] ??= fetch(u + '5/package.json').then((r) => r.json())
    .then((p) => p.version || 5, () => 5).then((v) => `${u}${v}/`);
}

/** The family's Fontsource metadata (weights, styles, subsets), or null. */
function fontsourceMeta(family, id = fontsourceId(family)) {
  return (fontsourceMeta.c ??= {})[id] ??= fetch(`https://api.fontsource.org/v1/fonts/${id}`)
    .then((res) => (res.ok ? res.json() : null), () => null);
}

/** The weights the package ships in `style`: the API pairs none (no Libre
 *  Caslon 700 italic file), so italics are read from latin-italic.css. */
function fontsourceWeights(family, style, id = fontsourceId(family)) {
  return (fontsourceWeights.c ??= {})[id + style] ??= fontsourceMeta(family).then(async (m) => {
    if (!m?.styles.includes(style)) return m ? [] : [400, 700];
    const css = style === 'italic' ? await fetch(`${await fontsourceAt(id)}latin-italic.css`).then((r) => (r.ok ? r.text() : ''), () => '') : '';
    const w = [...css.matchAll(/weight: (\d+)/g)].map((x) => +x[1]);
    return w.length ? w : m.weights;
  });
}

// ─── Kit · viewer v2 ── the same in every recipe · postext.dev/cookbook
/** The pages as spreads on a dark desk, page 1 alone, then verso | recto,
 *  each painted when it scrolls near. Other options go to renderPageToCanvas. */
function showPages(docs, { title, width = 460, ...render } = {}) {
  const root = viewer(title);
  const pages = [docs].flat().flatMap((doc) =>
    doc.pages.map((page) => ({ doc, page, n: (doc.pageIndexOffset ?? 0) + page.index })));
  const spreads = [];
  let verso = null;
  for (const p of pages) {
    if (p.n % 2 === 1) { if (verso) spreads.push([verso, null]); verso = p; }
    else { spreads.push([verso, p]); verso = null; }
  }
  if (verso) spreads.push([verso, null]);
  const density = Math.min(window.devicePixelRatio || 1, 2);
  showPages.painter?.disconnect();
  const painter = new IntersectionObserver((entries) => {
    for (const { isIntersecting, target } of entries) {
      if (!isIntersecting) continue;
      painter.unobserve(target);
      const { doc, page } = target.postext;
      renderPageToCanvas(page, doc, target, { ...render, scale: (width * density) / page.width });
    }
  }, { rootMargin: '800px' });
  showPages.painter = painter;
  root.replaceChildren(...spreads.map((pair) => {
    const spread = document.createElement('div');
    spread.className = 'pt-spread';
    for (const p of pair) {
      const figure = document.createElement('figure');
      if (p) {
        const label = p.page.pageLabel || String(p.n + 1);
        const canvas = document.createElement('canvas');
        canvas.postext = p;
        canvas.style.aspectRatio = `${p.page.width} / ${p.page.height}`;
        canvas.setAttribute('role', 'img');
        canvas.setAttribute('aria-label', `Page ${label}`);
        const folio = document.createElement('figcaption');
        folio.textContent = label;
        figure.append(canvas, folio);
        painter.observe(canvas);
      } else figure.className = 'pt-blank';
      spread.append(figure);
    }
    return spread;
  }));
  kitStatus(`${pages.length} ${pages.length === 1 ? 'page' : 'pages'}`);
  document.documentElement.dataset.postext = 'ready';
  return pages.length;
}

/** The desk, the bar and the error reporting, created once. */
function viewer(title) {
  if (!document.getElementById('pt-kit')) {
    document.head.insertAdjacentHTML('beforeend', `<style id="pt-kit">
      :root { color-scheme: dark; }
      body { margin: 0; background: #0e1014; color: #b9bcc4; font: 13px/1.45 system-ui, sans-serif; }
      #pt-bar { position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; align-items: center;
        gap: 6px 16px; padding: 10px 16px; background: rgb(14 16 20 / .92); backdrop-filter: blur(6px);
        border-bottom: 1px solid #23262d; }
      #pt-bar strong { color: #f4f1ea; font-weight: 600; }
      #pt-actions { display: flex; gap: 12px; margin-left: auto; }
      #pt-actions a, #pt-actions button { color: #d8a21a; font: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
      #pages { display: grid; justify-items: center; gap: 48px; padding: 32px 16px 72px; }
      .pt-spread { display: flex; }
      .pt-spread figure { margin: 0; width: min(460px, 44vw); }
      .pt-spread canvas { display: block; width: 100%; background: #fff;
        box-shadow: 0 1px 2px rgb(0 0 0 / .5), 0 22px 44px -16px rgb(0 0 0 / .8); }
      .pt-spread figure:first-child canvas { box-shadow: inset -14px 0 14px -14px rgb(0 0 0 / .18), 0 1px 2px rgb(0 0 0 / .5), 0 22px 44px -16px rgb(0 0 0 / .8); }
      .pt-spread figcaption { margin-top: 10px; text-align: center; font: 600 10px/1 system-ui, sans-serif;
        letter-spacing: .18em; text-transform: uppercase; color: #6c7079; }
      .pt-blank { visibility: hidden; }
      @media (max-width: 760px) {
        .pt-spread { flex-direction: column; gap: 32px; }
        .pt-spread figure { width: min(460px, 92vw); }
        .pt-blank { display: none; }
      }
    </style>`);
    document.body.insertAdjacentHTML('afterbegin',
      '<header id="pt-bar"><strong id="pt-title"></strong><span id="pt-status" role="status"></span><span id="pt-actions"></span></header>');
    document.getElementById('pt-title').textContent = document.title || 'Postext';
    addEventListener('error', (event) => kitFail(event.error ?? event.message));
    addEventListener('unhandledrejection', (event) => kitFail(event.reason));
  }
  if (title) document.getElementById('pt-title').textContent = title;
  return document.getElementById('pages')
    ?? document.body.appendChild(Object.assign(document.createElement('main'), { id: 'pages' }));
}

function kitStatus(text) {
  viewer();
  document.getElementById('pt-status').textContent = text;
}

function kitFail(error) {
  document.documentElement.dataset.postext = 'error';
  kitStatus(`Error: ${error?.message ?? error}`);
}

// ─── Kit · pdf v3 ── the same in every recipe that exports a PDF
/** The Fontsource files the screen used, as TrueType, with their range and
 *  place: the nearest weight the family ships in that style, upright with no italic;
 *  latin, then what its letters need (kitSubsetsFor). */
async function fontsourceProvider(family, weight, style, request) {
  const id = fontsourceId(family);
  const meta = await fontsourceMeta(family);
  const s = style === 'italic' && meta && !meta.styles.includes('italic') ? 'normal' : style;
  const shipped = meta ? await fontsourceWeights(family, s) : [];
  const weights = shipped.length ? shipped : [400, 700];
  const w = weights.reduce((a, b) => (Math.abs(b - weight) < Math.abs(a - weight) ? b : a));
  const text = String.fromCodePoint(...(request?.codePoints ?? []));
  const files = await Promise.all(['latin', ...kitSubsetsFor(text, meta)].map(async (subset, order) => {
    const res = await fetch(`${await fontsourceAt(id)}files/${id}-${subset}-${w}-${s}.woff2`);
    if (!res.ok) throw new Error(`Fontsource has no ${family} ${w} ${s} ${subset}`);
    return Object.assign(await decompressWoff2(new Uint8Array(await res.arrayBuffer())),
      { unicodeRange: kitRanges()[subset], order });
  }));
  return files.length === 1 ? files[0] : files;
}

/** A "Build the PDF" button; then "Open the PDF" (a new tab: CodePen's frame
 *  shows no PDFs) and a download link. */
function offerPdf(makePdf, filename) {
  viewer();
  const button = Object.assign(document.createElement('button'), { type: 'button', textContent: 'Build the PDF' });
  button.dataset.postextPdf = filename;
  button.addEventListener('click', async () => {
    button.disabled = true;
    button.textContent = 'Building the PDF…';
    try {
      const bytes = await makePdf();
      const url = URL.createObjectURL(new Blob([bytes], { type: 'application/pdf' }));
      const size = `${Math.max(1, Math.round(bytes.length / 1024))} KB`;
      button.replaceWith(
        Object.assign(document.createElement('a'), { href: url, target: '_blank', rel: 'noopener', textContent: 'Open the PDF ↗' }),
        Object.assign(document.createElement('a'), { href: url, download: filename, textContent: `Download ${filename} · ${size}` }));
    } catch (error) {
      button.disabled = false;
      button.textContent = 'Build the PDF';
      kitFail(error);
    }
  });
  document.getElementById('pt-actions').append(button);
}

// ─── /Kit ───────────────────────────────────────────────────────────────────────
```

## Variantes

### Quita la primera composición

Leídos los avisos, basta con una composición.

```diff
-const bare = await buildDocumentWithFonts({ markdown, resources }, { ...config, symbolFont: '' },
-  fonts);
-console.info((bare.contentWarnings ?? []).filter((w) => w.kind === 'glyphFallbackAt')
-  .map(formatWarning).join('\n'));
```

## Errores frecuentes

- **Aviso de maquetación: Caracteres que la fuente no tiene, aquí** (`glyphFallbackAt`). Un párrafo lleva caracteres que la fuente de su texto no tiene: letras y operadores matemáticos (∪, ℵ), griego en una fuente latina, flechas (glyphFallback nombra la fuente, este el párrafo). supplier es la familia que los dibuja, normalmente la symbolFont; sin ella, el PDF los imprime como cajas vacías. Solución: Indica una symbolFont que los tenga (Noto Sans Math cubre casi toda la matemática) o elige una familia de texto que los tenga. Si el carácter está mal (una alef hebrea donde el autor quería un complemento), corrige el texto. ([Documentación](https://postext.dev/es/docs/configuration-programmatic-usage.md#avisos-del-documento))

- Una fuente cuyos archivos de Fontsource incluyen el griego (Source Serif 4, Alegreya) compone φ y Γ por sí misma, y el kit carga ese archivo cuando el texto lleva griego: entonces solo los signos pasan a la fuente de símbolos. Crimson Pro no tiene archivo griego, así que su griego sale de Noto Sans Math.
- La fuente de símbolos tiene una sola variante, redonda y regular. Un título en negrita o una fórmula en cursiva compone sus signos en esa variante, que es como los imprimen las matemáticas.

## Créditos

- Receta: Ignacio Ferro ([@drnachio](https://github.com/drnachio))
- Texto: La cartilla de notación lógica, en inglés y en español: Ignacio Ferro, CC-BY-4.0
- Tipografías: Crimson Pro (OFL-1.1), Cormorant Garamond (OFL-1.1), IBM Plex Sans Condensed (OFL-1.1), Noto Sans Math (OFL-1.1)
- Código: MIT · Contenido de ejemplo: CC-BY-4.0

## Relacionadas

- [N.º 180 · Resaltados por colores en un libro de lecturas](https://postext.dev/es/cookbook/colour-coded-study-highlights.md): Un libro de lecturas de historia con tres colores de resaltado (verde para términos, ámbar para fechas, azul para nombres) definidos en markStyles. · Nivel 2 (Intermedio) · Libros de texto
- [N.º 077 · Marcas de nombre y de título, en vertical y en horizontal](https://postext.dev/es/cookbook/proper-name-marks.md): Los Anales básicos de Xiang Yu con marcas :name y :book, en vertical y en horizontal: las líneas van a la izquierda de los nombres y luego debajo de ellos. · Nivel 2 (Intermedio) · Libros de texto
- [N.º 122 · Kanbun con sus marcas de lectura y la lectura japonesa](https://postext.dev/es/cookbook/kanbun-kundoku.md): Tres dichos de las Analectas y una cuarteta Tang como en un libro escolar japonés: marcas de retorno y okurigana en bermellón, y la lectura en kana debajo. · Nivel 2 (Intermedio) · Libros de texto
