visualproof 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +99 -2
  3. package/dist/assets/fonts/JuliaMono-Regular.ttf +0 -0
  4. package/dist/assets/fonts/JuliaMono-RegularItalic.ttf +0 -0
  5. package/dist/assets/fonts/JuliaMono-SemiBold.ttf +0 -0
  6. package/dist/assets/fonts/LICENSE-JuliaMono.txt +93 -0
  7. package/dist/assets/latex/visualproof.sty +308 -0
  8. package/dist/extractor/Extract.lean +1180 -0
  9. package/dist/extractor/Usage.lean +900 -0
  10. package/dist/mcp/visualproof-mcp.mjs +476 -0
  11. package/dist/server/access.js +95 -0
  12. package/dist/server/agent.js +3235 -0
  13. package/dist/server/agentdocs.js +35 -0
  14. package/dist/server/agentlibrary.js +202 -0
  15. package/dist/server/agentnotes.js +701 -0
  16. package/dist/server/agentviews.js +703 -0
  17. package/dist/server/askfollow.js +286 -0
  18. package/dist/server/boardspots.js +159 -0
  19. package/dist/server/dirs.js +175 -0
  20. package/dist/server/doctor.js +186 -0
  21. package/dist/server/events.js +198 -0
  22. package/dist/server/export.js +420 -0
  23. package/dist/server/extract.js +204 -0
  24. package/dist/server/fetchurl.js +321 -0
  25. package/dist/server/figures.js +158 -0
  26. package/dist/server/history.js +741 -0
  27. package/dist/server/historyapi.js +304 -0
  28. package/dist/server/hover.js +595 -0
  29. package/dist/server/identity.js +114 -0
  30. package/dist/server/invites.js +241 -0
  31. package/dist/server/layoutthread.js +51 -0
  32. package/dist/server/library.js +600 -0
  33. package/dist/server/libraryroute.js +211 -0
  34. package/dist/server/live.js +1101 -0
  35. package/dist/server/lostfound.js +199 -0
  36. package/dist/server/main.js +1394 -0
  37. package/dist/server/mcptools.js +497 -0
  38. package/dist/server/pastdoc.js +73 -0
  39. package/dist/server/pipeline.js +156 -0
  40. package/dist/server/poppler.js +251 -0
  41. package/dist/server/presence.js +252 -0
  42. package/dist/server/project.js +222 -0
  43. package/dist/server/prompt.js +53 -0
  44. package/dist/server/readonly.js +152 -0
  45. package/dist/server/readonlygate.js +123 -0
  46. package/dist/server/renames.js +268 -0
  47. package/dist/server/review.js +334 -0
  48. package/dist/server/reviewapi.js +188 -0
  49. package/dist/server/snapshot.js +49 -0
  50. package/dist/server/sourcestore.js +473 -0
  51. package/dist/server/status.js +360 -0
  52. package/dist/server/talk.js +476 -0
  53. package/dist/server/tokens.js +221 -0
  54. package/dist/server/usage.js +501 -0
  55. package/dist/server/versions.js +82 -0
  56. package/dist/server/view.js +157 -0
  57. package/dist/server/views.js +1167 -0
  58. package/dist/shared/askfollow.js +46 -0
  59. package/dist/shared/board.js +332 -0
  60. package/dist/shared/build.js +2 -0
  61. package/dist/shared/collab.js +148 -0
  62. package/dist/shared/comment.js +285 -0
  63. package/dist/shared/context.js +157 -0
  64. package/dist/shared/doc/authors.js +98 -0
  65. package/dist/shared/doc/build.js +358 -0
  66. package/dist/shared/doc/latex.js +455 -0
  67. package/dist/shared/doc/markdown.js +159 -0
  68. package/dist/shared/doc/model.js +37 -0
  69. package/dist/shared/doc/order.js +107 -0
  70. package/dist/shared/doc/proof.js +272 -0
  71. package/dist/shared/doc/sections.js +93 -0
  72. package/dist/shared/doc/settings.js +75 -0
  73. package/dist/shared/edgecodec.js +102 -0
  74. package/dist/shared/editor.js +64 -0
  75. package/dist/shared/excerpt.js +87 -0
  76. package/dist/shared/graph.js +16 -0
  77. package/dist/shared/items.js +92 -0
  78. package/dist/shared/keys.js +203 -0
  79. package/dist/shared/layout.js +926 -0
  80. package/dist/shared/lexer.js +130 -0
  81. package/dist/shared/library.js +711 -0
  82. package/dist/shared/lostfound.js +150 -0
  83. package/dist/shared/moves.js +243 -0
  84. package/dist/shared/notecard.js +295 -0
  85. package/dist/shared/noteplace.js +505 -0
  86. package/dist/shared/palette.js +46 -0
  87. package/dist/shared/pastgraph.js +95 -0
  88. package/dist/shared/places.js +80 -0
  89. package/dist/shared/projectnotes.js +244 -0
  90. package/dist/shared/query.js +810 -0
  91. package/dist/shared/review.js +642 -0
  92. package/dist/shared/reviewqueue.js +333 -0
  93. package/dist/shared/ring.js +366 -0
  94. package/dist/shared/scope.js +255 -0
  95. package/dist/shared/scopeedit.js +81 -0
  96. package/dist/shared/search.js +191 -0
  97. package/dist/shared/separate.js +178 -0
  98. package/dist/shared/sharesnap.js +280 -0
  99. package/dist/shared/sticky.js +501 -0
  100. package/dist/shared/timeline.js +73 -0
  101. package/dist/shared/titles.js +298 -0
  102. package/dist/shared/viewgraph.js +139 -0
  103. package/dist/shared/views.js +859 -0
  104. package/dist/web/bundle/app.js +48733 -0
  105. package/dist/web/bundle/edges.js +409 -0
  106. package/dist/web/bundle/layout.js +1010 -0
  107. package/dist/web/bundle/pdfworker.js +48322 -0
  108. package/dist/web/index.html +239 -0
  109. package/dist/web/src/motion.js +430 -0
  110. package/dist/web/src/past.js +224 -0
  111. package/dist/web/src/scene.js +787 -0
  112. package/dist/web/style.css +2312 -0
  113. package/docs/agent-api/README.md +91 -0
  114. package/docs/agent-api/advice.md +108 -0
  115. package/docs/agent-api/export.md +120 -0
  116. package/docs/agent-api/following.md +140 -0
  117. package/docs/agent-api/history.md +142 -0
  118. package/docs/agent-api/library.md +65 -0
  119. package/docs/agent-api/mcp.md +104 -0
  120. package/docs/agent-api/notes.md +93 -0
  121. package/docs/agent-api/reading.md +166 -0
  122. package/docs/agent-api/requests.md +94 -0
  123. package/docs/agent-api/talking.md +100 -0
  124. package/docs/agent-api/tcb.md +135 -0
  125. package/docs/agent-api/views.md +124 -0
  126. package/docs/agent-api/words.md +56 -0
  127. package/package.json +39 -4
  128. package/test/toolchains.json +5 -0
@@ -0,0 +1,308 @@
1
+ % visualproof.sty — the style of the documents VisualProof exports (ExportSpec.md, decision 7).
2
+ %
3
+ % VisualProof writes a .tex of semantic macros and environments only (shared/doc/latex.ts): what
4
+ % each thing is — a section, a declaration, its docstring, its code, a note, a figure — never how it
5
+ % looks. How
6
+ % it looks is this file's: a sober printed document, plain typography, the Lean code highlighted in
7
+ % the page's colours. Replace it, or load your own package after it and \renewcommand what you want
8
+ % changed: the interface below is all a document uses, and its arguments are already escaped
9
+ % (nothing in them is LaTeX someone else wrote).
10
+ %
11
+ % Needs XeLaTeX (fontspec). Compile twice, for the page references, the contents and the bookmarks:
12
+ % xelatex doc.tex && xelatex doc.tex
13
+ %
14
+ % ---------------------------------------------------------------------------------------------
15
+ % The interface (what a .tex from VisualProof calls)
16
+ %
17
+ % \vpSetup{paper=a4|letter, margin=<dim>, codesize=<pt>} page and code size
18
+ % \vpSetTitle{<title>} the title, for the running heads
19
+ % \vpTitle{<title>}{<author line, or empty>}
20
+ % \begin{vpCard} ... \end{vpCard} the head card; inside it:
21
+ % \vpCardRow{<label>}{<value>} one row
22
+ % \begin{vpContents} ... \end{vpContents} the table of contents, in two columns, where the
23
+ % settings print it; inside it:
24
+ % \vpContentsSection{<id>}{<level 1-4>}{<number, or empty>}{<title>}
25
+ % \vpContentsDecl{<id>}{<level 1-5: one below its section's>}{<short name>}
26
+ % \vpMono{<text>} a name, a hash or a prefix, inline
27
+ % \vpName{<dotted name>} a full Lean name, breakable after its dots (\vpBreak);
28
+ % called by the macros here, not by a .tex: renew it to restyle
29
+ % \vpSym{<symbols>} symbols the text font lacks (⟪ ⟫ ℕ ∀ ⊗ …), in JuliaMono
30
+ % \vpBookmark{<id>}{<level>}{<text>} a PDF bookmark to an anchor
31
+ % \vpSection{<id>}{<level: 1 section, 2 subsection, 3 subsubsection, 4 paragraph-level>}
32
+ % {<number, or empty>}{<title>}{<the cluster's key>}{<bookmark level>}{<bookmark text>}
33
+ % a cluster of the view, following on the page what comes before it
34
+ % \vpSectionResume{<level, 1-4>}{<title>} a section's own declarations and notes again, after one
35
+ % of its sections: its title, "continued", unnumbered
36
+ % \begin{vpDecl}{<id>}{<short>}{<kind>} ... \end{vpDecl} a declaration; inside it:
37
+ % \vpFullName{<name>} \vpPlace{<module>}{<file, or empty>}{<line, or empty>}
38
+ % \begin{vpDocstring} ... \end{vpDocstring}
39
+ % \vpInlineCode{<code>} code in prose
40
+ % \begin{vpCode} ... \end{vpCode} the code, highlighted, without line numbers
41
+ % token macros: \vpTkKeyword \vpTkType \vpTkComment \vpTkDoc \vpTkString \vpTkNumber
42
+ % \vpTkAttr \vpTkOp \vpTkSorry \vpTkElided (a proof left out), and
43
+ % \vpBS \vpLB \vpRB for \ { } in code
44
+ % \vpDeclNote{<text>} a short note under its code: of a past build, that its
45
+ % text then is not kept and its statement is printed
46
+ % \vpPaper{<label, or empty>}{<file's title>}{<page, or empty>}{<its number among the references>}
47
+ % a place in a paper it is linked to, under its code; with
48
+ % no label, a file a note carries
49
+ % \begin{vpNote}{<id>} ... \end{vpNote} a note of the view, as prose: in a section, at the start,
50
+ % or under the declaration it is attached to; inside it,
51
+ % paragraphs and \vpInlineCode, \vpMention, \vpPaper, \vpFigure
52
+ % \vpMention{<id>}{<full name>} a declaration a note names, where the document prints it
53
+ % \vpFigure{<file>}{<width, or empty: the image's own>}{<file's title>}{<page, or empty>}
54
+ % {<its number among the references>} an image or a clip a note carries, with its caption
55
+ % \begin{vpSectionPapers} ... \end{vpSectionPapers} a cluster's \vpPaper lines, under its heading
56
+ % \begin{vpReferences} ... \end{vpReferences} the files the papers cite, at the end; inside it:
57
+ % \vpReference{<n>}{<title>}{<where it came from>}{<what it is>}{<its SHA-256, cut short>}
58
+ % \vpUrl{<address>} an address, breakable after its slashes
59
+ % \vpKind{<kind>} called by the macros here, not by a .tex: renew it to restyle
60
+ %
61
+ % Colours (xcolor names; the .tex defines them again from VisualProof's palette, shared/palette.ts,
62
+ % so that the code reads as on the page): vpTkkeyword, vpTktype, vpTkcomment, vpTkstring,
63
+ % vpTknumber, vpTkattr, vpTkop, vpTksorry. This file adds vpMuted (secondary text) and vpRule
64
+ % (rules).
65
+ %
66
+ % Fonts: Libertinus Serif and Sans for the text (TeX Live's), Latin Modern where they are not
67
+ % installed; JuliaMono (v0.63.2, SIL Open Font License, fonts/LICENSE-JuliaMono.txt) for code,
68
+ % loaded from fonts/ next to the document, since it covers the Unicode Lean is written in.
69
+ % ---------------------------------------------------------------------------------------------
70
+
71
+ \NeedsTeXFormat{LaTeX2e}
72
+ \ProvidesPackage{visualproof}[2026/10/12 v9 VisualProof's exported documents]
73
+
74
+ \RequirePackage{iftex}
75
+ \RequireXeTeX
76
+ \RequirePackage{etoolbox}
77
+ \RequirePackage{pgfkeys}
78
+ \RequirePackage{xcolor}
79
+ \RequirePackage{fontspec}
80
+ \RequirePackage{geometry}
81
+ \RequirePackage{fvextra}
82
+ \RequirePackage{multicol}
83
+ \RequirePackage{needspace}
84
+ \RequirePackage{enumitem}
85
+ \RequirePackage{fancyhdr}
86
+ \RequirePackage{lastpage}
87
+ \RequirePackage{graphicx}
88
+ \RequirePackage{caption}
89
+ \RequirePackage[hidelinks]{hyperref}
90
+ \RequirePackage{bookmark}
91
+
92
+ % ------------------------------------------------------------------------------ the page
93
+
94
+ \newcommand\vp@codesize{\fontsize{8.5}{10.6}\selectfont}
95
+ \pgfkeys{/vp/.is family, /vp,
96
+ paper/.code={\ifstrequal{#1}{letter}{\geometry{letterpaper}}{\geometry{a4paper}}},
97
+ margin/.code={\geometry{margin=#1}},
98
+ codesize/.code={\renewcommand\vp@codesize{\fontsize{#1}{\fpeval{round(1.25*#1,1)}}\selectfont}},
99
+ }
100
+ \newcommand\vpSetup[1]{\pgfkeys{/vp,#1}}
101
+ \geometry{a4paper, margin=22mm, headheight=14pt, headsep=12pt, footskip=24pt}
102
+
103
+ \setlength\parindent{0pt}
104
+ \setlength\parskip{4pt plus 1pt}
105
+ \setlength\emergencystretch{3em}
106
+ \raggedbottom
107
+
108
+ % ------------------------------------------------------------------------------ fonts
109
+
110
+ \IfFontExistsTF{LibertinusSerif-Regular.otf}{%
111
+ \setmainfont{LibertinusSerif}[Extension=.otf, UprightFont=*-Regular, BoldFont=*-Semibold,
112
+ ItalicFont=*-Italic, BoldItalicFont=*-SemiboldItalic]
113
+ \setsansfont{LibertinusSans}[Extension=.otf, UprightFont=*-Regular, BoldFont=*-Bold,
114
+ ItalicFont=*-Italic, BoldItalicFont=*-Bold]
115
+ }{%
116
+ \setmainfont{Latin Modern Roman}
117
+ \setsansfont{Latin Modern Sans}
118
+ }
119
+ % the code at the size the settings say: not scaled
120
+ \setmonofont{JuliaMono}[Path=fonts/, Extension=.ttf, UprightFont=*-Regular, BoldFont=*-SemiBold,
121
+ ItalicFont=*-RegularItalic, BoldItalicFont=*-SemiBold]
122
+ % names and symbols in running text: scaled to the text's x-height, so that they sit in a line
123
+ \newfontfamily\vp@inline{JuliaMono}[Path=fonts/, Extension=.ttf, UprightFont=*-Regular,
124
+ BoldFont=*-SemiBold, ItalicFont=*-RegularItalic, BoldItalicFont=*-SemiBold, Scale=MatchLowercase]
125
+
126
+ % ------------------------------------------------------------------------------ colours
127
+
128
+ \definecolor{vpMuted}{HTML}{6E6E73}
129
+ \definecolor{vpRule}{HTML}{C7C7CC}
130
+ % VisualProof's palette for code (the .tex defines these again, from the page's own values)
131
+ \definecolor{vpTkkeyword}{HTML}{AD3DA4}\definecolor{vpTktype}{HTML}{3E7FD6}
132
+ \definecolor{vpTkcomment}{HTML}{8A8A8E}\definecolor{vpTkstring}{HTML}{C4392B}
133
+ \definecolor{vpTknumber}{HTML}{6C5CE7}\definecolor{vpTkattr}{HTML}{B5762C}
134
+ \definecolor{vpTkop}{HTML}{AD3DA4}\definecolor{vpTksorry}{HTML}{FF375F}
135
+
136
+ % ------------------------------------------------------------------------------ running heads
137
+
138
+ \newcommand\vp@title{}
139
+ \newcommand\vpSetTitle[1]{\renewcommand\vp@title{#1}}
140
+ \fancypagestyle{vp}{%
141
+ \fancyhf{}%
142
+ \fancyhead[L]{\footnotesize\color{vpMuted}\vp@title}%
143
+ \fancyhead[R]{\footnotesize\color{vpMuted}\rightmark}%
144
+ \fancyfoot[C]{\footnotesize\color{vpMuted}\thepage\ / \pageref*{LastPage}}%
145
+ \renewcommand\headrulewidth{0pt}}
146
+ \fancypagestyle{vpfirst}{%
147
+ \fancyhf{}%
148
+ \fancyfoot[C]{\footnotesize\color{vpMuted}\thepage\ / \pageref*{LastPage}}%
149
+ \renewcommand\headrulewidth{0pt}}
150
+ \pagestyle{vp}
151
+ \markright{}
152
+
153
+ % ------------------------------------------------------------------------------ inline pieces
154
+
155
+ \newcommand\vpSym[1]{{\vp@inline #1}}
156
+ \newcommand\vpMono[1]{{\vp@inline #1}}
157
+ \newcommand\vpBreak{\allowbreak}
158
+ \newcommand\vpName[1]{{\vp@inline #1}}
159
+ \newcommand\vpInlineCode[1]{{\vp@inline #1}}
160
+ \newcommand\vpBookmark[3]{\bookmark[dest=#1,level=#2]{#3}}
161
+ % in a bookmark, PDF title or running head turned into a PDF string, the inline macros are their text
162
+ \pdfstringdefDisableCommands{\def\vpSym#1{#1}\def\vpMono#1{#1}\def\vpName#1{#1}\def\vpBreak{}}
163
+
164
+ % a declaration's kind, in small capitals
165
+ \newcommand\vpKind[1]{{\normalfont\small\scshape #1}}
166
+
167
+ % ------------------------------------------------------------------------------ the head
168
+
169
+ \newcommand\vpTitle[2]{%
170
+ \thispagestyle{vpfirst}%
171
+ {\raggedright\hyphenpenalty=10000\sffamily\bfseries\fontsize{20}{24}\selectfont #1\par}%
172
+ \ifstrempty{#2}{}{\vspace{4pt}{\large #2\par}}%
173
+ \vspace{2pt}{\small\color{vpMuted}Made by VisualProof\par}%
174
+ \vspace{16pt}}
175
+
176
+ % the head card: a list of what the document was made from, between two rules
177
+ \newlength\vp@cardlabel
178
+ \setlength\vp@cardlabel{10.5em}
179
+ \newenvironment{vpCard}{\par\noindent{\color{vpRule}\rule{\linewidth}{0.4pt}}\par\vspace{1pt}%
180
+ \small\setlength\parskip{2pt}}{\par\vspace{3pt}\noindent{\color{vpRule}\rule{\linewidth}{0.4pt}}\par\bigskip}
181
+ \newcommand\vpCardRow[2]{\par\hangindent=\vp@cardlabel\hangafter=1\noindent
182
+ \makebox[\vp@cardlabel][l]{\color{vpMuted}#1}#2\par}
183
+
184
+ % ------------------------------------------------------------------------------ the contents
185
+
186
+ \newcommand\vp@leaders{\leaders\hbox to 0.7em{\hss.\hss}\hfill}
187
+ \newcommand\vp@page[1]{\nobreak\hbox to 2.4em{\hss\pageref*{#1}}}
188
+ % in two columns, balanced, the body following on the same page
189
+ \newenvironment{vpContents}{\par\needspace{6\baselineskip}%
190
+ {\sffamily\bfseries\large Contents\par}\nopagebreak\small\setlength\parskip{0pt}%
191
+ \setlength\columnsep{20pt}\setlength\multicolsep{4pt plus 2pt}\begin{multicols}{2}}%
192
+ {\end{multicols}\par}
193
+ % each level indented a step further; a section's number before its title, a top section in bold
194
+ \newlength\vp@tocstep
195
+ \setlength\vp@tocstep{1em}
196
+ \newcommand\vpContentsSection[4]{\par\ifnum#2=1 \addvspace{5pt plus 2pt}\fi\noindent
197
+ \hangindent=\dimexpr#2\vp@tocstep+1.6em\relax\hspace*{\dimexpr#2\vp@tocstep-\vp@tocstep\relax}%
198
+ {\ifnum#2=1 \bfseries\fi\ifstrempty{#3}{}{#3\enspace}\hyperlink{#1}{#4}}\nobreak
199
+ \vp@leaders{\ifnum#2=1 \bfseries\fi\vp@page{#1}}\par\ifnum#2=1 \nopagebreak\fi}
200
+ \newcommand\vpContentsDecl[3]{\par\noindent\hangindent=\dimexpr#2\vp@tocstep+1.6em\relax
201
+ \hspace*{\dimexpr#2\vp@tocstep-\vp@tocstep\relax}{\color{vpMuted}\hyperlink{#1}{#3}}\nobreak
202
+ \vp@leaders{\color{vpMuted}\vp@page{#1}}\par}
203
+
204
+ % ------------------------------------------------------------------------------ a section
205
+
206
+ % a section follows on the page what comes before it — the first, the head card and the contents —
207
+ % with room above its head, the more the higher its level, and its head is kept with the start of
208
+ % what follows: a section of one declaration takes no page of its own. Its heading: the number and
209
+ % the title, sans-serif and bold, smaller at each level; the cluster's key beneath, small and mono.
210
+ % A top section names the running head, as LaTeX's own classes do.
211
+ \newcommand\vp@sectionbreak[1]{\par\addvspace{\ifcase#1\or 22pt plus 8pt minus 4pt\or 16pt plus 6pt minus 3pt\or
212
+ 12pt plus 4pt minus 2pt\else 10pt plus 3pt minus 2pt\fi}\needspace{\ifnum#1<3 14\else 10\fi\baselineskip}}
213
+ \newcommand\vpSection[7]{%
214
+ \vp@sectionbreak{#2}%
215
+ \phantomsection\hypertarget{#1}{}\label{#1}\bookmark[dest=#1,level=#6]{#7}%
216
+ {\raggedright\sffamily\bfseries\ifcase#2\or\LARGE\or\Large\or\large\else\normalsize\fi
217
+ \ifstrempty{#3}{}{#3\quad}#4\par}\nopagebreak
218
+ \vspace{1pt}{\footnotesize\color{vpMuted}\vpName{#5}\par}\nopagebreak
219
+ \ifnum#2=1 \markright{\ifstrempty{#3}{}{#3\enspace}#4}\fi
220
+ \vspace{\ifnum#2<3 4pt\else 2pt\fi}}
221
+ % a section's own declarations and notes again after one of its sections, as the board's order may
222
+ % have them: its title at the level of its sections, unnumbered, "continued" after it
223
+ \newcommand\vpSectionResume[2]{%
224
+ \vp@sectionbreak{#1}%
225
+ {\raggedright\sffamily\bfseries\ifcase#1\or\LARGE\or\Large\or\large\else\normalsize\fi
226
+ #2\hskip 0.5em{\mdseries\small\color{vpMuted}continued}\par}\nopagebreak
227
+ \vspace{\ifnum#1<3 4pt\else 2pt\fi}}
228
+
229
+ % ------------------------------------------------------------------------------ a declaration
230
+
231
+ % {id}{short}{kind}: the short name, the kind on the right
232
+ \newenvironment{vpDecl}[3]{%
233
+ \par\needspace{8\baselineskip}%
234
+ \vspace{10pt plus 4pt}%
235
+ \phantomsection\hypertarget{#1}{}\label{#1}%
236
+ \noindent{\sffamily\bfseries #2}%
237
+ \hfill\vpKind{#3}\par\nopagebreak\vspace{1pt}}{\par}
238
+ \newcommand\vpFullName[1]{\noindent{\footnotesize\vpName{#1}}}
239
+ % where it is written: its file and line in the project, else (outside it) its module; on the line
240
+ % of the full name while there is room, on a line of its own beneath it otherwise
241
+ \newcommand\vpPlace[3]{{\footnotesize\color{vpMuted}\hskip 1.2em plus 1fil\penalty 0\hskip 0pt plus -1fil
242
+ \ifstrempty{#2}{\vpMono{#1}}{\vpMono{#2}\ifstrempty{#3}{}{, line #3}}}\par\nopagebreak\smallskip}
243
+
244
+ % what it is: its docstring, as body text
245
+ \newenvironment{vpDocstring}{\par}{\par}
246
+
247
+ % a short note under the code, small and grey (of a past build, that the declaration's text then is
248
+ % not kept)
249
+ \newcommand\vpDeclNote[1]{\par\nopagebreak{\footnotesize\itshape\color{vpMuted}#1\par}}
250
+
251
+ % a place in a reference the declaration (or, under a section's heading, the cluster) is linked to:
252
+ % "Reference: Theorem 3 [title, p. 12]", small, the number of the file among the references after it
253
+ % With no label, a file a note carries: "Reference: title, p. 12"
254
+ \newcommand\vpPaper[4]{\par\nopagebreak{\small\noindent\hangindent=1.5em\hangafter=1
255
+ {\color{vpMuted}Reference:}\space\ifstrempty{#1}{\textit{#2}\ifstrempty{#3}{}{, p.~#3}}{#1 [\textit{#2}\ifstrempty{#3}{}{, p.~#3}]}%
256
+ \nobreak\hskip 0.4em{\footnotesize\color{vpMuted}(#4)}\par}}
257
+ \newenvironment{vpSectionPapers}{\par\nopagebreak\vspace{1pt}}{\par\vspace{4pt}}
258
+ % an address, broken after its slashes (\vpBreak) where the line is full
259
+ \newcommand\vpUrl[1]{\vpMono{#1}}
260
+ % the files the references cite, at the end: a heading of its own ("References"), then each file
261
+ % by its number
262
+ \newenvironment{vpReferences}{\par\addvspace{22pt plus 8pt minus 4pt}\needspace{6\baselineskip}%
263
+ \phantomsection\hypertarget{vp-references}{}\label{vp-references}\bookmark[dest=vp-references,level=0]{References}%
264
+ {\raggedright\sffamily\bfseries\Large References\par}\nopagebreak\vspace{6pt}\small\setlength\parskip{4pt}}{\par}
265
+ \newcommand\vpReference[5]{\par\noindent\hangindent=2em\hangafter=1
266
+ \makebox[2em][l]{(#1)}\textit{#2}. #4; #3.\hskip 0.5em{\footnotesize\color{vpMuted}SHA-256 \vpMono{#5}…}\par}
267
+
268
+ % ------------------------------------------------------------------------------ notes and figures
269
+
270
+ % a note of the view, as the document's prose: body text, with room around it
271
+ \newenvironment{vpNote}[1]{\par\addvspace{6pt plus 2pt}\phantomsection\hypertarget{#1}{}}{\par\addvspace{6pt plus 2pt}}
272
+ % a declaration a note names, linked to where the document prints it, with its page
273
+ \newcommand\vpMention[2]{\hyperlink{#1}{\vpInlineCode{#2}}\nobreak\hskip 0.2em{\footnotesize\color{vpMuted}(p.~\pageref*{#1})}}
274
+ % an image or a clip a note carries, where the note is (no float): an image at its own size, a clip at
275
+ % the size the paper prints it, never wider than the text nor taller than half the page; its caption
276
+ % the file's title, a clip's page, and the file's number among the references
277
+ \captionsetup[figure]{font=small, labelfont={sf,bf}, labelsep=colon, skip=3pt}
278
+ \newsavebox\vp@figbox
279
+ \newlength\vp@figw
280
+ \newcommand\vpFigure[5]{%
281
+ \par\needspace{8\baselineskip}\vspace{4pt}\noindent
282
+ \begin{minipage}{\linewidth}\centering
283
+ \ifstrempty{#2}{\sbox\vp@figbox{\includegraphics{#1}}\setlength\vp@figw{\wd\vp@figbox}}{\setlength\vp@figw{#2}}%
284
+ \ifdim\vp@figw>\linewidth \setlength\vp@figw{\linewidth}\fi
285
+ \includegraphics[width=\vp@figw, height=0.5\textheight, keepaspectratio]{#1}\par
286
+ \captionof{figure}{\textit{#3}\ifstrempty{#4}{}{, p.~#4}\nobreak\hskip 0.4em{\footnotesize\color{vpMuted}(#5)}}%
287
+ \end{minipage}\par\vspace{4pt}}
288
+
289
+ % code: highlighted, broken where too long (after a dot, or at a space), without line numbers
290
+ \newcommand\vpBS{\char"5C\relax}
291
+ \newcommand\vpLB{\char"7B\relax}
292
+ \newcommand\vpRB{\char"7D\relax}
293
+ \newcommand\vpTkKeyword[1]{{\color{vpTkkeyword}\bfseries#1}}
294
+ \newcommand\vpTkType[1]{{\color{vpTktype}#1}}
295
+ \newcommand\vpTkComment[1]{{\color{vpTkcomment}\itshape#1}}
296
+ \newcommand\vpTkDoc[1]{{\color{vpTkcomment}\itshape#1}}
297
+ \newcommand\vpTkString[1]{{\color{vpTkstring}#1}}
298
+ \newcommand\vpTkNumber[1]{{\color{vpTknumber}#1}}
299
+ \newcommand\vpTkAttr[1]{{\color{vpTkattr}#1}}
300
+ \newcommand\vpTkOp[1]{{\color{vpTkop}#1}}
301
+ \newcommand\vpTkSorry[1]{{\setlength\fboxsep{0.6pt}\colorbox{vpTksorry}{\textcolor{white}{#1}}}}
302
+ \newcommand\vpTkElided[1]{{\color{vpMuted}\itshape#1}}
303
+ \DefineVerbatimEnvironment{vpCode}{Verbatim}{commandchars=\\\{\}, fontsize=\vp@codesize,
304
+ xleftmargin=1em, breaklines=true, breakafter={.}, breakaftersymbolpre={},
305
+ breaksymbolleft={\tiny\color{vpMuted}\vpSym{↪}}, tabsize=2,
306
+ listparameters={\setlength\topsep{4pt}\setlength\partopsep{0pt}}}
307
+
308
+ \endinput