Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions whitepaper/PUBLISHER_CONTEXT.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ After any change:
2. Check for errors in output
3. Verify PDF generates correctly
4. Spot-check web navigation
5. Check PDF geometry, not only glyphs: `pdftotext -bbox` and count words whose xMax exceeds page width − 36 pt (baseline 1 since 2026-10-31, a plain-text table cell on page 6). Long inline code breaks via `pdf-breakable-code.lua`; a rise means a new unbreakable construct.

**Never commit changes that break the build.**

Expand Down
1 change: 1 addition & 0 deletions whitepaper/make-pdf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ pandoc "$TEMP_MD" -o "$PDF_FILE" \
-V toccolor=black \
-V colorlinks=true \
-H pdf-glyphs.tex \
--lua-filter=pdf-breakable-code.lua \
2> "$PANDOC_LOG"
PANDOC_RC=$?
# xelatex drops glyphs its font lacks and only says so on stderr — surface them
Expand Down
41 changes: 41 additions & 0 deletions whitepaper/pdf-breakable-code.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
-- Long inline code in the PDF gets break points.
--
-- pandoc sets inline code as \texttt{...}, which TeX never breaks: the mono
-- font has no hyphen character and a path has no spaces. The provenance this
-- paper cites inline (Research/proposals/<long_snake_name>.md,
-- synchronism-site/explorer/findings/<long-kebab-name>, scripts) therefore ran
-- straight off the page. Measured 2026-10-31: 98 words on 55 of 293 pages
-- ended past the 1in margin, most of them clipped at the physical page edge,
-- so the reader could not see the end of the path.
--
-- For inline code of MIN_LEN characters or more, this emits the \texttt
-- itself and puts \allowbreak after each / _ - . so a line can end there. Nothing
-- is inserted into the text, so the text layer is unchanged. Short code
-- (1/Ω_m, B_max) is left to pandoc, since a break there would split a symbol.
-- PDF only: make-pdf.sh passes this filter, and the HTML builds do not.

local MIN_LEN = 20

local escapes = {
['\\'] = '\\textbackslash{}',
['{'] = '\\{', ['}'] = '\\}',
['#'] = '\\#', ['$'] = '\\$', ['%'] = '\\%', ['&'] = '\\&', ['_'] = '\\_',
['~'] = '\\textasciitilde{}', ['^'] = '\\^{}',
['`'] = '\\textasciigrave{}', ["'"] = '\\textquotesingle{}',
[' '] = '\\ ',
}
local breakafter = { ['/'] = true, ['_'] = true, ['-'] = true, ['.'] = true }

function Code(el)
if not FORMAT:match('latex') then return nil end
if utf8.len(el.text) == nil or utf8.len(el.text) < MIN_LEN then return nil end
local out = {}
for _, cp in utf8.codes(el.text) do
local ch = utf8.char(cp)
out[#out + 1] = escapes[ch] or ch
-- '-' gets '{}' first so a following '-' cannot form a ligature
if ch == '-' then out[#out + 1] = '{}' end
if breakafter[ch] then out[#out + 1] = '\\allowbreak{}' end
end
return pandoc.RawInline('latex', '\\texttt{' .. table.concat(out) .. '}')
end
Loading