Files
Marc WäckerlinandClaude Opus 5 adc58e19d7 One LaTeX design for a company, in three templates
A company that writes with LaTeX ends up with a document class, a letter class
and a presentation theme that share a design and not a line of code. Every fix
is then made three times, two of them late and the third never.

Here the page is written once. A company declares its colours, faces and logo in
one file, and the document template, the letter class and the presentation theme
read that one file. Nothing in the suite carries a colour value, a font name or
a file name of any company, which is what lets it be published while the
companies stay private.

Every measure of the page follows from a measurement or from a named definition:
the room the head and the foot need is taken from the boxes they really build,
one line of the body text stands between the head and the text and between the
text and the foot, a heading never stands alone at the foot of a page, a picture
takes the size of the family, and a Markdown file reaches the same page as the
same document written in LaTeX.

The suite ships with a company that does not exist, Nordwind AG, so that it
builds and is measured anywhere: three colours, the TeX Gyre families every
installation carries, and an icon drawn in TikZ.

574 checks over five measurements, all of them on the rendered page or on the
build log rather than on the source.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-22 15:06:07 +02:00

30 lines
1.1 KiB
Lua

-- Copyright (c) 2026 Marc Wäckerlin. SPDX-License-Identifier: MIT
-- A link to a Markdown file of the same set points at the PDF of that file.
--
-- The documents reference each other, `[ARCHITECTURE.md](ARCHITECTURE.md)`, and
-- that is right in the repository, where the reader opens the Markdown. In the
-- PDF the same target opens nothing: the reader holds a PDF, the file beside it
-- is a PDF, and the link reaches for a source he does not have.
--
-- So a target that names a local Markdown file is rewritten to the PDF that the
-- same converter produces from it, with its anchor kept. An address with a
-- scheme (https:, mailto:) and an anchor inside the same document stay as they
-- are.
local function rewritten(target)
if target:match('^%a[%w+.-]*:') or target:match('^#') then
return nil
end
local file, anchor = target:match('^([^#]+)(#?.*)$')
if not file or not file:lower():match('%.md$') then
return nil
end
return file:sub(1, #file - 3) .. '.pdf' .. anchor
end
function Link(link)
local target = rewritten(link.target)
if not target then return nil end
link.target = target
return link
end