Debian Codegraph @

texmf-dist/source/latex/clawxiv/clawxiv.dtx

raw
1 % \iffalse meta-comment
2 %
3 % clawxiv.dtx
4 % Copyright 2026 Andras Kornai and Claude Sonnet 4.6 (Anthropic)
5 %
6 % This work may be distributed and/or modified under the
7 % conditions of the LaTeX Project Public License, version 1.3c of this license.
8 % The license text is available at
9 % https://www.latex-project.org/lppl/lppl-1-3c/
10 % and is part of current LaTeX distributions.
11 %
12 % This work has the LPPL maintenance status `maintained'.
13 % The Current Maintainer of this work is Andras Kornai.
14 %
15 % This work consists of the files clawxiv.dtx, clawxiv.ins,
16 % README.md, clawxiv-sty-doc.tex, and the derived file clawxiv.sty.
17 % The distributed documentation file is clawxiv-sty-doc.pdf.
18 %
19 %<*driver>
20 \documentclass{ltxdoc}
21 \usepackage[T1]{fontenc}
22 \usepackage[utf8]{inputenc}
23 \usepackage{lmodern}
24 \usepackage{microtype}
25 \PassOptionsToPackage{hyperindex=false}{hyperref}
26 \usepackage{clawxiv}
27 \usepackage{enumitem}
28 %% \env{name} typesets an environment name in code font.
29 %% Defined here because it is absent from some ltxdoc versions.
30 \providecommand{\env}[1]{\texttt{#1}}
31 \EnableCrossrefs
32 \CodelineIndex
33 \RecordChanges
34 \begin{document}
35 \DocInput{clawxiv.dtx}
36 \PrintChanges
37 \PrintIndex
38 \end{document}
39 %</driver>
40 % \fi
41 %
42 % \CheckSum{60}
43 %
44 % \CharacterTable
45 % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
46 % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
47 % Digits \0\1\2\3\4\5\6\7\8\9
48 % Exclamation \! Double quote \" Hash (number) \#
49 % Dollar \$ Percent \% Ampersand \&
50 % Acute accent \' Left paren \( Right paren \)
51 % Asterisk \* Plus \+ Comma \,
52 % Minus \- Point \. Solidus \/
53 % Colon \: Semicolon \; Less than \<
54 % Equals \= Greater than \> Question mark \?
55 % Commercial at \@ Left bracket \[ Backslash \\
56 % Right bracket \] Circumflex \^ Underscore \_
57 % Grave accent \` Left brace \{ Vertical bar \|
58 % Right brace \} Tilde \~}
59 %
60 % \changes{v0.4}{2026/03/29}{First CTAN release}
61 % \changes{v0.4.1}{2026/04/18}{Fix documentation build; remove redundant dependencies; clarify snip marker semantics}
62 % \changes{v0.4.2}{2026/04/18}{Record release provenance and bounded endorsement for the v0.4.1 repair line; no functional code changes}
63 % \changes{v0.4.3}{2026/04/19}{CTAN follow-up release: fix duplicated v in the documentation date line; rename distributed documentation to clawxiv-sty-doc; state the LPPL 1.3c license explicitly and consistently across the bundle}
64 %
65 % \GetFileInfo{clawxiv.sty}
66 %
67 % \DoNotIndex{\newcommand,\renewcommand,\RequirePackage,\NeedsTeXFormat}
68 % \DoNotIndex{\begin,\end,\def,\gdef,\let,\relax,\noindent,\par}
69 % \DoNotIndex{\footnotesize,\color,\smallskip,\href,\ifx}
70 %
71 %^^A ===================================================================
72 % \title{The \textsf{clawxiv} package\\
73 % \large Provenance typesetting for human--AI collaborative writing}
74 % \author{Andr\'as Kornai\thanks{%
75 % Budapest University of Technology and Economics (BME);
76 % ELKH Institute for Computer Science and Control (SZTAKI).
77 % ORCID: 0000-0001-6078-6840.
78 % \texttt{[email protected]}}
79 % \and
80 % Claude Sonnet~4.6 (Anthropic)\thanks{%
81 % AI co-author. The package design, color palette, environment
82 % signatures, and alias conventions were developed collaboratively
83 % between the human and AI authors in early 2026. The framing of
84 % the provenance problem is the human author's; the specific
85 % \textsf{mdframed} style parameters and the internal
86 % \cs{cxw@attrib} helper are the AI author's.}}
87 % \date{2026-04-19\quad(\fileversion)}
88 % \maketitle
89 %
90 % \begin{abstract}
91 % The \textsf{clawxiv} package provides \LaTeX{} environments for
92 % typesetting text according to its authorial provenance in documents
93 % that mix human and AI contributions. Three principal environments
94 % are provided: \env{seniorquote} for the corresponding human author,
95 % \env{aiquote} for an AI co-author, and \env{coauthorquote} for
96 % other human contributors. Convenient aliases \env{humanprompt} and
97 % \env{airesp} support prompt/response interaction transcripts.
98 % The package is part of the ClawXiv framework for archiving
99 % human--AI co-authored papers with full provenance tracking.
100 % \end{abstract}
101 %
102 % This \textsf{v0.4.3} source bundle preserves the release provenance for the
103 % documentation-build repair introduced on 2026-04-18 and incorporates
104 % the minor CTAN follow-up adjustments requested after acceptance. The package's
105 % original design authorship remains Andr\'as Kornai and Claude
106 % Sonnet~4.6 (Anthropic). The diagnosis and source-level repair of the
107 % \texttt{clawxiv.dtx} documentation build failure, together with the
108 % explicit release-provenance metadata added in this bundle and the
109 % v0.4.3 CTAN follow-up corrections were carried out with AI assistance
110 % by \emph{ChatGPT GPT-5.4 Thinking}. Human maintainer and releasing author:
111 % Andr\'as Kornai. See
112 % Section~\ref{sec:release-provenance}.
113 %
114 % \tableofcontents
115 %
116 %^^A ===================================================================
117 % \section{Introduction}
118 %
119 % Collaborative writing between humans and AI systems raises a
120 % question that \LaTeX{} has not previously needed to answer: whose
121 % words are these? Citation and quotation mechanisms handle text
122 % from external sources, but they presuppose a clean boundary between
123 % the document's authors and everyone else. When an AI system is a
124 % genuine co-author---contributing analysis, drafting arguments,
125 % proposing structure---that boundary dissolves.
126 %
127 % The \textsf{clawxiv} package takes a simple, typographic approach.
128 % Each passage of text is attributed to its author at paragraph
129 % level, using visually distinct left-ruled boxes. The senior human
130 % author's voice appears in a steel-blue box; AI contributions in
131 % amber/ochre; other human co-authors in grey. Attribution lines
132 % carry a name, a timestamp, and an optional hyperlink to the
133 % original session, making provenance claims verifiable rather than
134 % merely asserted.
135 %
136 % This documentation is itself an example. The following passage
137 % was contributed by the AI co-author of this package:
138 %
139 % \begin{aiquote}{Claude Sonnet~4.6}{2026-03-29}[https://claude.ai]
140 % The design goal was to make provenance \emph{visible without being
141 % obtrusive}. The left-rule style was chosen over a full box because
142 % it signals a shift in voice without visually interrupting the flow
143 % of reading. The color palette is intentionally muted: steel blue,
144 % ochre, and grey rather than primary colors. A reader scanning the
145 % page should notice that something changed; they should not feel
146 % assaulted by it.
147 % \end{aiquote}
148 %
149 % And this framing is the human author's:
150 %
151 % \begin{seniorquote}{Andr\'as Kornai}{2026-03-29}
152 % The deeper motivation is archival. A document that records not
153 % only \emph{what} was written but \emph{who} wrote each part, and
154 % \emph{when}, and from \emph{which session}, is a more honest
155 % artifact than one that launders AI contributions into the
156 % undifferentiated authorial voice. The ClawXiv framework exists
157 % because honesty about provenance should have better tooling.
158 % \end{seniorquote}
159 %
160 %^^A ===================================================================
161 % \section{Usage}
162 %
163 % \subsection{Loading the package}
164 %
165 % \begin{verbatim}
166 % \usepackage{clawxiv}
167 % \end{verbatim}
168 %
169 % The package loads \textsf{mdframed}, \textsf{xcolor},
170 % \textsf{hyperref}, and \textsf{xparse}. If \textsf{hyperref}
171 % is loaded before \textsf{clawxiv}, the previously set options are
172 % respected.
173 %
174 % \subsection{Principal environments}
175 %
176 % \DescribeEnv{seniorquote}
177 % \begin{quote}
178 % \verb|\begin{seniorquote}|\marg{author}\marg{timestamp}\oarg{url}\\
179 % \meta{text}\\
180 % \verb|\end{seniorquote}|
181 % \end{quote}
182 % Typesets \meta{text} in a pale-blue left-ruled box attributed to
183 % the senior (corresponding) human author. \meta{author} is a name
184 % string; \meta{timestamp} is a date string (no special format is
185 % enforced); \meta{url} is an optional hyperlink for the attribution
186 % line.
187 %
188 % \DescribeEnv{aiquote}
189 % \begin{quote}
190 % \verb|\begin{aiquote}|\marg{author}\marg{timestamp}\oarg{url}\\
191 % \meta{text}\\
192 % \verb|\end{aiquote}|
193 % \end{quote}
194 % Typesets \meta{text} in a pale-amber left-ruled box attributed to
195 % an AI co-author. The \meta{url} argument, when supplied, should
196 % point to the original AI session transcript so that provenance is
197 % independently verifiable.
198 %
199 % \DescribeEnv{coauthorquote}
200 % \begin{quote}
201 % \verb|\begin{coauthorquote}|\marg{author}\marg{timestamp}\oarg{url}\\
202 % \meta{text}\\
203 % \verb|\end{coauthorquote}|
204 % \end{quote}
205 % Typesets \meta{text} in a grey left-ruled box for contributions
206 % from human co-authors other than the senior author.
207 %
208 % \subsection{Interaction-style aliases}
209 %
210 % \DescribeEnv{humanprompt}
211 % \begin{quote}
212 % \verb|\begin{humanprompt}|\oarg{author}\oarg{timestamp}\\
213 % \meta{text}\\
214 % \verb|\end{humanprompt}|
215 % \end{quote}
216 % An alias for \env{seniorquote} intended for prompt/response
217 % transcripts. Both arguments are optional; \meta{author} defaults
218 % to \texttt{Senior Author} (a placeholder---supply your own name)
219 % and \meta{timestamp} defaults to \cs{today}.
220 %
221 % \DescribeEnv{airesp}
222 % \begin{quote}
223 % \verb|\begin{airesp}|\marg{author}\oarg{timestamp}\oarg{url}\\
224 % \meta{text}\\
225 % \verb|\end{airesp}|
226 % \end{quote}
227 % An alias for \env{aiquote}. \meta{author} is mandatory;
228 % \meta{timestamp} defaults to \cs{today}; \meta{url} is optional.
229 %
230 % \subsection{Snip markers}
231 %
232 % \DescribeMacro{\snipinsert}
233 % \cs{snipinsert} is a no-op at typeset time. Its literal occurrence
234 % in the source serves as a marker for the \texttt{clawxiv-snip}
235 % command-line tool; the macro itself intentionally expands to nothing.
236 %
237 % \DescribeMacro{\inputsnip}
238 % \cs{inputsnip}\marg{filename} expands to
239 % \cs{input}\texttt{\{snips/}\meta{filename}\texttt{\}},
240 % assuming snip files are staged in a \texttt{snips/} subdirectory.
241 %
242 % \subsection{License}
243 % The package is distributed under the \emph{LaTeX Project Public License}
244 % \texttt{lppl1.3c}. In LPPL terminology, this work is \emph{maintained};
245 % the Current Maintainer is Andr\'as Kornai. The license is stated
246 % explicitly in the README, in this documented source, in the installer,
247 % and in the generated package file so that the CTAN metadata and the
248 % shipped files agree.
249 %
250 %^^A ===================================================================
251 % \section{Color palette}
252 %
253 % All colors are defined internally with \texttt{@}-guarded names
254 % and are not intended for direct use in documents.
255 %
256 % \begin{center}
257 % \begin{tabular}{lll}
258 % \hline
259 % Internal name & RGB & Role \\
260 % \hline
261 % \texttt{cxw@SeniorBg} & 245,\,248,\,252 & senior box fill \\
262 % \texttt{cxw@SeniorRule} & 100,\,140,\,190 & senior left rule \\
263 % \texttt{cxw@AIBg} & 250,\,248,\,240 & AI box fill \\
264 % \texttt{cxw@AIRule} & 190,\,150,\,80 & AI left rule (ochre) \\
265 % \texttt{cxw@CoAuthorBg} & 248,\,248,\,248 & co-author fill \\
266 % \texttt{cxw@CoAuthorRule} & 160,\,160,\,160 & co-author left rule \\
267 % \texttt{cxw@LinkColor} & 40,\,80,\,160 & attribution links \\
268 % \hline
269 % \end{tabular}
270 % \end{center}
271 %
272 % Future versions may expose a user-facing configuration interface.
273 %
274 %^^A ===================================================================
275 % \section{The ClawXiv framework}
276 %
277 % This package is the \LaTeX{} component of the ClawXiv framework,
278 % a workflow for archiving human--AI co-authored papers with
279 % cryptographic provenance tracking. The full framework includes:
280 %
281 % \begin{itemize}[leftmargin=2em]
282 % \item A command-line tool (\texttt{clawxiv}) with subcommands for
283 % initializing bundles (\texttt{init}), capturing text snippets
284 % with provenance metadata (\texttt{snip}), integrating captures
285 % into source (\texttt{integrate-snips}), and adding figures with
286 % attribution (\texttt{fig-add}, \texttt{fig-capture}).
287 % \item A \texttt{project.yaml} schema recording bundle-level
288 % metadata: author identifiers (ORCID, VIAF, ISNI), timestamps,
289 % version history, and co-author AI model identifiers.
290 % \item A \texttt{Makefile} and \texttt{configure} script for
291 % reproducible builds.
292 % \end{itemize}
293 %
294 % The \LaTeX{} package documented here can be used independently
295 % of the command-line tooling. Load \textsf{clawxiv} and use the
296 % environments manually; no other part of the framework is required.
297 %
298 % The ClawXiv v4 white paper is available on arXiv.
299 %
300 %^^A ===================================================================
301 % \section{Release provenance}\label{sec:release-provenance}
302 %
303 % Release \textsf{v0.4.3} is intentionally conservative. It does not
304 % change the package interface or runtime behavior relative to the
305 % repaired \textsf{v0.4.1} line. Instead, it makes the provenance of
306 % that repair explicit inside the distributed bundle.
307 %
308 % The package's durable authorship and maintenance roles remain human-led:
309 % Andr\'as Kornai is the Current Maintainer and releasing author, and the
310 % package's original design authorship remains shared between Andr\'as
311 % Kornai and Claude Sonnet~4.6 (Anthropic). The specific 2026-04-18
312 % repair sequence---reproducing the \texttt{pdflatex clawxiv.dtx} failure,
313 % diagnosing the malformed \texttt{macrocode} terminators in the
314 % \texttt{.dtx} source, patching the source, verifying the successful
315 % rebuild, and adding the present release metadata---was carried out with
316 % AI assistance by \emph{ChatGPT GPT-5.4 Thinking}.
317 %
318 % The endorsement conveyed by this bundle is textual rather than
319 % cryptographic. It should be interpreted narrowly: the AI contributor
320 % endorses the repaired source bundle to the extent actually tested in its
321 % build environment, while the human maintainer stands behind the package
322 % release over the longer archival horizon.
323 %
324 % Machine-readable release metadata are supplied in
325 % \texttt{release\_provenance.json} and \texttt{manifest.v0.4.3.json}.
326 %
327 %^^A ===================================================================
328 % \StopEventually{}
329 %
330 %^^A ===================================================================
331 % \section{Implementation}
332 %
333 % \subsection{Identification and dependencies}
334 %
335 % \begin{macrocode}
336 %<*package>
337 \NeedsTeXFormat{LaTeX2e}
338 \ProvidesPackage{clawxiv}[2026/04/19 v0.4.3 ClawXiv provenance macros (LPPL 1.3c)]
339 % Released under the LaTeX Project Public License \texttt{lppl1.3c}.
340 % Current Maintainer: Andr\'as Kornai.
341
342 \RequirePackage{mdframed}
343 \RequirePackage{xcolor}
344 \RequirePackage{hyperref}
345 \RequirePackage{xparse}
346 % \end{macrocode}
347 %
348 % \subsection{Color palette}
349 %
350 % \begin{macrocode}
351 \definecolor{cxw@SeniorBg} {RGB}{245,248,252}
352 \definecolor{cxw@SeniorRule} {RGB}{100,140,190}
353 \definecolor{cxw@AIBg} {RGB}{250,248,240}
354 \definecolor{cxw@AIRule} {RGB}{190,150,80}
355 \definecolor{cxw@CoAuthorBg} {RGB}{248,248,248}
356 \definecolor{cxw@CoAuthorRule}{RGB}{160,160,160}
357 \definecolor{cxw@LinkColor} {RGB}{40,80,160}
358 % \end{macrocode}
359 %
360 % \subsection{Frame styles}
361 %
362 % \begin{macrocode}
363 \mdfdefinestyle{cxw@senior}{
364 backgroundcolor = cxw@SeniorBg,
365 linecolor = cxw@SeniorRule,
366 linewidth = 1.2pt,
367 leftline = true,
368 rightline = false,
369 topline = false,
370 bottomline = false,
371 innerleftmargin = 6pt,
372 innerrightmargin = 4pt,
373 innertopmargin = 3pt,
374 innerbottommargin = 3pt,
375 skipabove = 4pt,
376 skipbelow = 4pt,
377 }
378 \mdfdefinestyle{cxw@ai}{
379 backgroundcolor = cxw@AIBg,
380 linecolor = cxw@AIRule,
381 linewidth = 0.8pt,
382 leftline = true,
383 rightline = false,
384 topline = false,
385 bottomline = false,
386 innerleftmargin = 6pt,
387 innerrightmargin = 4pt,
388 innertopmargin = 3pt,
389 innerbottommargin = 3pt,
390 skipabove = 4pt,
391 skipbelow = 4pt,
392 }
393 \mdfdefinestyle{cxw@coauthor}{
394 backgroundcolor = cxw@CoAuthorBg,
395 linecolor = cxw@CoAuthorRule,
396 linewidth = 0.6pt,
397 leftline = true,
398 rightline = false,
399 topline = false,
400 bottomline = false,
401 innerleftmargin = 6pt,
402 innerrightmargin = 4pt,
403 innertopmargin = 3pt,
404 innerbottommargin = 3pt,
405 skipabove = 4pt,
406 skipbelow = 4pt,
407 }
408 % \end{macrocode}
409 %
410 % \subsection{Internal attribution helper}
411 %
412 % \begin{macro}{\cxw@attrib}
413 % Prints the attribution line at the top of every provenance box.
414 % |#1|~author name, |#2|~timestamp, |#3|~URL (empty disables link).
415 % \begin{macrocode}
416 \newcommand{\cxw@attrib}[3]{%
417 \noindent
418 {\footnotesize\color{cxw@LinkColor}%
419 \ifx\relax#3\relax
420 [\textit{#1},\ #2]%
421 \else
422 \href{#3}{[\textit{#1},\ #2]}%
423 \fi
424 }\par\smallskip
425 }
426 % \end{macrocode}
427 % \end{macro}
428 %
429 % \subsection{Principal environments}
430 %
431 % \begin{environment}{seniorquote}
432 % \begin{macrocode}
433 \NewDocumentEnvironment{seniorquote}{m m O{}}{%
434 \begin{mdframed}[style=cxw@senior]%
435 \cxw@attrib{#1}{#2}{#3}%
436 }{%
437 \end{mdframed}%
438 }
439 % \end{macrocode}
440 % \end{environment}
441 %
442 % \begin{environment}{aiquote}
443 % \begin{macrocode}
444 \NewDocumentEnvironment{aiquote}{m m O{}}{%
445 \begin{mdframed}[style=cxw@ai]%
446 \cxw@attrib{#1}{#2}{#3}%
447 }{%
448 \end{mdframed}%
449 }
450 % \end{macrocode}
451 % \end{environment}
452 %
453 % \begin{environment}{coauthorquote}
454 % \begin{macrocode}
455 \NewDocumentEnvironment{coauthorquote}{m m O{}}{%
456 \begin{mdframed}[style=cxw@coauthor]%
457 \cxw@attrib{#1}{#2}{#3}%
458 }{%
459 \end{mdframed}%
460 }
461 % \end{macrocode}
462 % \end{environment}
463 %
464 % \subsection{Interaction-style aliases}
465 %
466 % \begin{environment}{humanprompt}
467 % The default author \texttt{Senior Author} is a placeholder;
468 % users should supply their own name as the optional argument.
469 % \begin{macrocode}
470 \NewDocumentEnvironment{humanprompt}{O{Senior Author} O{\today}}{%
471 \begin{seniorquote}{#1}{#2}%
472 }{%
473 \end{seniorquote}%
474 }
475 % \end{macrocode}
476 % \end{environment}
477 %
478 % \begin{environment}{airesp}
479 % \begin{macrocode}
480 \NewDocumentEnvironment{airesp}{m O{\today} O{}}{%
481 \begin{aiquote}{#1}{#2}[#3]%
482 }{%
483 \end{aiquote}%
484 }
485 % \end{macrocode}
486 % \end{environment}
487 %
488 % \subsection{Snip markers}
489 %
490 % \begin{macro}{\snipinsert}
491 % \begin{macrocode}
492 \newcommand{\snipinsert}{}
493 % \end{macrocode}
494 % \end{macro}
495 %
496 % \begin{macro}{\inputsnip}
497 % \begin{macrocode}
498 \newcommand{\inputsnip}[1]{%
499 \input{snips/#1}%
500 }
501 % \end{macrocode}
502 % \end{macro}
503 %
504 %</package>
505 %
506 % \Finale
507 \endinput