latex-kit 0.5.0 → 0.5.1

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.
package/README.md CHANGED
@@ -63,7 +63,7 @@ latex-kit render letter.tex --json # machine-readable summary
63
63
  | `-o, --out <dir>` | `out` | Output directory, relative to `--root` |
64
64
  | `-e, --engine <name>` | `auto` | `auto` (from the packages the file loads), `lualatex`, `xelatex`, `pdflatex`, `pdfps` (PSTricks) |
65
65
  | `--root <dir>` | current directory | Directory TeX can see |
66
- | `--image <ref>` | pinned `ghcr.io/constructive-io/latex-kit` (TeX Live 2026) | Docker image |
66
+ | `--image <ref>` | pinned `constructiveio/latex-kit` on Docker Hub (TeX Live 2026) | Docker image |
67
67
  | `--platform <os/arch>` | native | Docker `--platform` |
68
68
  | `--local` | | Use `latexmk` on `PATH` instead of Docker (not pinned) |
69
69
  | `--source-date-epoch <s>` | `SOURCE_DATE_EPOCH`, else the last git commit | Build timestamp |
package/boilerplates.d.ts CHANGED
@@ -3,6 +3,19 @@
3
3
  * and amount is a placeholder.
4
4
  */
5
5
  export type FileMap = Record<string, string>;
6
+ /** Paper presets for `latex-kit init --paper --preset <name>`. */
7
+ export declare const PAPER_PRESETS: readonly ["whitepaper", "plain"];
8
+ export type PaperPreset = (typeof PAPER_PRESETS)[number];
6
9
  export declare function projectFiles(version: string): FileMap;
7
- export declare function paperFiles(): FileMap;
10
+ /** A minimal LuaLaTeX paper: fontspec, natbib. */
11
+ export declare function plainPaperFiles(): FileMap;
8
12
  export declare function templateFiles(name: string): FileMap;
13
+ /**
14
+ * The Constructive whitepaper style (rls-whitepaper, hyperweb-whitepaper):
15
+ * article class, the code colour palette and TypeScript listings style,
16
+ * TikZ and PSTricks, IEEE references. PSTricks means latex → dvips → ps2pdf,
17
+ * which `engine: auto` picks.
18
+ */
19
+ export declare function whitepaperFiles(): FileMap;
20
+ /** Files for `latex-kit init --paper`. */
21
+ export declare function paperFiles(preset?: PaperPreset): FileMap;
package/boilerplates.js CHANGED
@@ -4,9 +4,15 @@
4
4
  * and amount is a placeholder.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.PAPER_PRESETS = void 0;
7
8
  exports.projectFiles = projectFiles;
8
- exports.paperFiles = paperFiles;
9
+ exports.plainPaperFiles = plainPaperFiles;
9
10
  exports.templateFiles = templateFiles;
11
+ exports.whitepaperFiles = whitepaperFiles;
12
+ exports.paperFiles = paperFiles;
13
+ const paper_style_1 = require("./paper-style");
14
+ /** Paper presets for `latex-kit init --paper --preset <name>`. */
15
+ exports.PAPER_PRESETS = ['whitepaper', 'plain'];
10
16
  function projectFiles(version) {
11
17
  return {
12
18
  'package.json': `${JSON.stringify({
@@ -129,7 +135,8 @@ data:
129
135
  `,
130
136
  };
131
137
  }
132
- function paperFiles() {
138
+ /** A minimal LuaLaTeX paper: fontspec, natbib. */
139
+ function plainPaperFiles() {
133
140
  return {
134
141
  '.gitignore': 'out/\n',
135
142
  'paper/main.tex': `\\documentclass[11pt]{article}
@@ -223,3 +230,194 @@ export default z.object({
223
230
  `,
224
231
  };
225
232
  }
233
+ const PAPER_WORKFLOW = (file, name) => `name: Paper
234
+
235
+ on:
236
+ push:
237
+ branches: [main]
238
+ tags: ['v*']
239
+ pull_request:
240
+
241
+ jobs:
242
+ pdf:
243
+ runs-on: ubuntu-latest
244
+ permissions:
245
+ contents: read
246
+ steps:
247
+ - uses: actions/checkout@v4
248
+ with:
249
+ fetch-depth: 0 # the build date comes from the last commit
250
+ - uses: constructive-io/latex-kit/action@v1
251
+ with:
252
+ file: ${file}
253
+ engine: auto
254
+ verify: 'true'
255
+ artifact-name: ${name}.pdf
256
+
257
+ # pushing a tag like v1.0.0 attaches the PDF to a GitHub release
258
+ release:
259
+ needs: pdf
260
+ if: startsWith(github.ref, 'refs/tags/v')
261
+ runs-on: ubuntu-latest
262
+ permissions:
263
+ contents: write
264
+ steps:
265
+ - uses: actions/download-artifact@v4
266
+ with:
267
+ name: ${name}.pdf
268
+ path: pdf
269
+ - env:
270
+ GH_TOKEN: \${{ github.token }}
271
+ run: |
272
+ pdf=$(find pdf -name '*.pdf' | head -n 1)
273
+ cp "$pdf" "${name}-$GITHUB_REF_NAME.pdf"
274
+ gh release create "$GITHUB_REF_NAME" "${name}-$GITHUB_REF_NAME.pdf" -R "$GITHUB_REPOSITORY" --title "$GITHUB_REF_NAME" --generate-notes
275
+ `;
276
+ /**
277
+ * The Constructive whitepaper style (rls-whitepaper, hyperweb-whitepaper):
278
+ * article class, the code colour palette and TypeScript listings style,
279
+ * TikZ and PSTricks, IEEE references. PSTricks means latex → dvips → ps2pdf,
280
+ * which `engine: auto` picks.
281
+ */
282
+ function whitepaperFiles() {
283
+ return {
284
+ '.gitignore': 'out/\n',
285
+ 'paper/main.tex': `% A paper in the Constructive whitepaper style (as rls-whitepaper and
286
+ % hyperweb-whitepaper). It loads PSTricks, so latex-kit builds it with
287
+ % latex -> bibtex -> dvips -> ps2pdf; \`latex-kit render paper/main.tex\` picks that.
288
+ \\documentclass{article}
289
+ \\usepackage{amsmath}
290
+ \\usepackage{graphicx}
291
+ \\usepackage{xcolor}
292
+ \\usepackage{listings}
293
+ \\usepackage{geometry}
294
+ \\usepackage{enumitem}
295
+ \\usepackage{amsfonts}
296
+ \\usepackage{amssymb}
297
+ \\usepackage[hidelinks]{hyperref}
298
+ \\usepackage{cleveref}
299
+
300
+ \\usepackage{pstricks}
301
+ \\usepackage{tikz}
302
+ \\usetikzlibrary{arrows.meta, positioning, shapes, calc}
303
+
304
+ \\input{headers/colors.tex}
305
+ \\input{headers/typescript.tex}
306
+
307
+ \\title{Paper Title: What the Paper Shows}
308
+ \\author{Your Name, A. Co-Author
309
+ \\\\ \\\\
310
+ \\texttt{info@example.com}}
311
+ \\date{v0.0.1 --- \\today}
312
+
313
+ \\begin{document}
314
+
315
+ \\maketitle
316
+
317
+ \\begin{abstract}
318
+ One paragraph: the problem, why existing approaches fall short, what this
319
+ paper presents, and what it achieves.
320
+ \\end{abstract}
321
+
322
+ \\tableofcontents
323
+
324
+ \\input{sections/introduction.tex}
325
+ \\input{sections/design.tex}
326
+ \\input{sections/conclusion.tex}
327
+
328
+ \\newpage
329
+
330
+ \\section{Bibliography}
331
+ \\bibliographystyle{IEEEtran}
332
+ \\bibliography{references}
333
+
334
+ \\end{document}
335
+ `,
336
+ 'paper/headers/colors.tex': paper_style_1.WHITEPAPER_COLORS_TEX,
337
+ 'paper/headers/typescript.tex': paper_style_1.WHITEPAPER_TYPESCRIPT_TEX,
338
+ 'paper/sections/introduction.tex': `\\section{Introduction}
339
+
340
+ State the problem and why it matters. Cite prior work like this~\\cite{stonebraker1986}.
341
+ \\Cref{fig:flow} is drawn with PSTricks.
342
+
343
+ \\begin{figure}[ht]
344
+ \\centering
345
+ \\begin{pspicture}(0,0)(9,3)
346
+ \\psframe[fillstyle=solid,fillcolor=lightpurple,framearc=0.2](0,0.75)(3,2.25)
347
+ \\rput(1.5,1.5){Client}
348
+ \\psline[linewidth=1pt]{->}(3,1.5)(6,1.5)
349
+ \\rput(4.5,1.85){\\small request}
350
+ \\pscircle[fillstyle=solid,fillcolor=codelightgreen](7.5,1.5){1.2}
351
+ \\rput(7.5,1.5){Server}
352
+ \\end{pspicture}
353
+ \\caption{A request flow, drawn with PSTricks.}
354
+ \\label{fig:flow}
355
+ \\end{figure}
356
+ `,
357
+ 'paper/sections/design.tex': `\\section{Design}
358
+
359
+ \\Cref{fig:layers} is drawn with TikZ, and \\cref{lst:counter} uses the
360
+ TypeScript listing style.
361
+
362
+ \\begin{figure}[ht]
363
+ \\centering
364
+ \\begin{tikzpicture}[
365
+ node distance=1.2cm,
366
+ box/.style={rectangle, draw, rounded corners, fill=blue!10, text width=2.8cm, text centered, minimum height=0.9cm},
367
+ store/.style={rectangle, draw, rounded corners, fill=orange!10, text width=2.8cm, text centered, minimum height=0.9cm},
368
+ arrow/.style={-{Stealth}, thick}
369
+ ]
370
+ \\node[box] (api) {API};
371
+ \\node[box, below=of api] (policy) {Policy check};
372
+ \\node[store, right=1.6cm of policy] (data) {Data};
373
+ \\draw[arrow] (api) -- (policy);
374
+ \\draw[arrow] (policy) -- node[above] {\\small allowed} (data);
375
+ \\end{tikzpicture}
376
+ \\caption{Layers, drawn with TikZ.}
377
+ \\label{fig:layers}
378
+ \\end{figure}
379
+
380
+ \\begin{lstlisting}[language=typescript, caption=A small contract, label=lst:counter, style=typescript]
381
+ export default class Counter {
382
+ state = { count: 0 };
383
+
384
+ increment(by: number) {
385
+ this.state.count += by;
386
+ return this.state.count;
387
+ }
388
+ }
389
+ \\end{lstlisting}
390
+ `,
391
+ 'paper/sections/conclusion.tex': `\\section{Conclusion}
392
+
393
+ Summarize what the paper showed and what comes next.
394
+ `,
395
+ 'paper/references.bib': `@techreport{stonebraker1986,
396
+ author = {Michael Stonebraker and Lawrence A. Rowe},
397
+ title = {The Design of {POSTGRES}},
398
+ institution = {University of California, Berkeley},
399
+ number = {UCB/ERL M85/95},
400
+ year = {1986}
401
+ }
402
+ `,
403
+ '.github/workflows/paper.yml': PAPER_WORKFLOW('paper/main.tex', 'paper'),
404
+ 'README.md': `# Paper
405
+
406
+ \`\`\`bash
407
+ npx latex-kit render paper/main.tex --verify # → out/main.pdf, byte-identical on every build
408
+ \`\`\`
409
+
410
+ The Constructive whitepaper style: \`paper/headers/colors.tex\` (code colours)
411
+ and \`paper/headers/typescript.tex\` (\`style=typescript\` listings), TikZ and
412
+ PSTricks figures, IEEE references. PSTricks builds through latex → dvips →
413
+ ps2pdf, which latex-kit picks by itself.
414
+
415
+ CI builds the PDF on every push and attaches it to the run. Pushing a tag
416
+ like \`v1.0.0\` publishes it as a GitHub release.
417
+ `,
418
+ };
419
+ }
420
+ /** Files for `latex-kit init --paper`. */
421
+ function paperFiles(preset = 'whitepaper') {
422
+ return preset === 'plain' ? plainPaperFiles() : whitepaperFiles();
423
+ }
package/cli.js CHANGED
@@ -21,7 +21,7 @@ const app = new inquirerer_1.CLI(commands_1.commands, {
21
21
  minimistOpts: {
22
22
  alias: { h: 'help', v: 'version', o: 'out', e: 'engine' },
23
23
  boolean: ['help', 'version', 'local', 'verify', 'json', 'final', 'strict', 'tex-only', 'force', 'schema', 'paper', 'check'],
24
- string: ['out', 'engine', 'image', 'root', 'platform', 'source-date-epoch', 'variant', 'template', 'name', 'against', 'only', 'locale', 'signatures'],
24
+ string: ['out', 'engine', 'image', 'root', 'platform', 'source-date-epoch', 'variant', 'template', 'name', 'against', 'only', 'locale', 'signatures', 'preset'],
25
25
  default: { strict: undefined, schema: true },
26
26
  },
27
27
  });
@@ -3,6 +3,19 @@
3
3
  * and amount is a placeholder.
4
4
  */
5
5
  export type FileMap = Record<string, string>;
6
+ /** Paper presets for `latex-kit init --paper --preset <name>`. */
7
+ export declare const PAPER_PRESETS: readonly ["whitepaper", "plain"];
8
+ export type PaperPreset = (typeof PAPER_PRESETS)[number];
6
9
  export declare function projectFiles(version: string): FileMap;
7
- export declare function paperFiles(): FileMap;
10
+ /** A minimal LuaLaTeX paper: fontspec, natbib. */
11
+ export declare function plainPaperFiles(): FileMap;
8
12
  export declare function templateFiles(name: string): FileMap;
13
+ /**
14
+ * The Constructive whitepaper style (rls-whitepaper, hyperweb-whitepaper):
15
+ * article class, the code colour palette and TypeScript listings style,
16
+ * TikZ and PSTricks, IEEE references. PSTricks means latex → dvips → ps2pdf,
17
+ * which `engine: auto` picks.
18
+ */
19
+ export declare function whitepaperFiles(): FileMap;
20
+ /** Files for `latex-kit init --paper`. */
21
+ export declare function paperFiles(preset?: PaperPreset): FileMap;
@@ -2,6 +2,9 @@
2
2
  * Files written by `latex-kit init` and `latex-kit new`. Every name, address
3
3
  * and amount is a placeholder.
4
4
  */
5
+ import { WHITEPAPER_COLORS_TEX, WHITEPAPER_TYPESCRIPT_TEX } from './paper-style';
6
+ /** Paper presets for `latex-kit init --paper --preset <name>`. */
7
+ export const PAPER_PRESETS = ['whitepaper', 'plain'];
5
8
  export function projectFiles(version) {
6
9
  return {
7
10
  'package.json': `${JSON.stringify({
@@ -124,7 +127,8 @@ data:
124
127
  `,
125
128
  };
126
129
  }
127
- export function paperFiles() {
130
+ /** A minimal LuaLaTeX paper: fontspec, natbib. */
131
+ export function plainPaperFiles() {
128
132
  return {
129
133
  '.gitignore': 'out/\n',
130
134
  'paper/main.tex': `\\documentclass[11pt]{article}
@@ -218,3 +222,194 @@ export default z.object({
218
222
  `,
219
223
  };
220
224
  }
225
+ const PAPER_WORKFLOW = (file, name) => `name: Paper
226
+
227
+ on:
228
+ push:
229
+ branches: [main]
230
+ tags: ['v*']
231
+ pull_request:
232
+
233
+ jobs:
234
+ pdf:
235
+ runs-on: ubuntu-latest
236
+ permissions:
237
+ contents: read
238
+ steps:
239
+ - uses: actions/checkout@v4
240
+ with:
241
+ fetch-depth: 0 # the build date comes from the last commit
242
+ - uses: constructive-io/latex-kit/action@v1
243
+ with:
244
+ file: ${file}
245
+ engine: auto
246
+ verify: 'true'
247
+ artifact-name: ${name}.pdf
248
+
249
+ # pushing a tag like v1.0.0 attaches the PDF to a GitHub release
250
+ release:
251
+ needs: pdf
252
+ if: startsWith(github.ref, 'refs/tags/v')
253
+ runs-on: ubuntu-latest
254
+ permissions:
255
+ contents: write
256
+ steps:
257
+ - uses: actions/download-artifact@v4
258
+ with:
259
+ name: ${name}.pdf
260
+ path: pdf
261
+ - env:
262
+ GH_TOKEN: \${{ github.token }}
263
+ run: |
264
+ pdf=$(find pdf -name '*.pdf' | head -n 1)
265
+ cp "$pdf" "${name}-$GITHUB_REF_NAME.pdf"
266
+ gh release create "$GITHUB_REF_NAME" "${name}-$GITHUB_REF_NAME.pdf" -R "$GITHUB_REPOSITORY" --title "$GITHUB_REF_NAME" --generate-notes
267
+ `;
268
+ /**
269
+ * The Constructive whitepaper style (rls-whitepaper, hyperweb-whitepaper):
270
+ * article class, the code colour palette and TypeScript listings style,
271
+ * TikZ and PSTricks, IEEE references. PSTricks means latex → dvips → ps2pdf,
272
+ * which `engine: auto` picks.
273
+ */
274
+ export function whitepaperFiles() {
275
+ return {
276
+ '.gitignore': 'out/\n',
277
+ 'paper/main.tex': `% A paper in the Constructive whitepaper style (as rls-whitepaper and
278
+ % hyperweb-whitepaper). It loads PSTricks, so latex-kit builds it with
279
+ % latex -> bibtex -> dvips -> ps2pdf; \`latex-kit render paper/main.tex\` picks that.
280
+ \\documentclass{article}
281
+ \\usepackage{amsmath}
282
+ \\usepackage{graphicx}
283
+ \\usepackage{xcolor}
284
+ \\usepackage{listings}
285
+ \\usepackage{geometry}
286
+ \\usepackage{enumitem}
287
+ \\usepackage{amsfonts}
288
+ \\usepackage{amssymb}
289
+ \\usepackage[hidelinks]{hyperref}
290
+ \\usepackage{cleveref}
291
+
292
+ \\usepackage{pstricks}
293
+ \\usepackage{tikz}
294
+ \\usetikzlibrary{arrows.meta, positioning, shapes, calc}
295
+
296
+ \\input{headers/colors.tex}
297
+ \\input{headers/typescript.tex}
298
+
299
+ \\title{Paper Title: What the Paper Shows}
300
+ \\author{Your Name, A. Co-Author
301
+ \\\\ \\\\
302
+ \\texttt{info@example.com}}
303
+ \\date{v0.0.1 --- \\today}
304
+
305
+ \\begin{document}
306
+
307
+ \\maketitle
308
+
309
+ \\begin{abstract}
310
+ One paragraph: the problem, why existing approaches fall short, what this
311
+ paper presents, and what it achieves.
312
+ \\end{abstract}
313
+
314
+ \\tableofcontents
315
+
316
+ \\input{sections/introduction.tex}
317
+ \\input{sections/design.tex}
318
+ \\input{sections/conclusion.tex}
319
+
320
+ \\newpage
321
+
322
+ \\section{Bibliography}
323
+ \\bibliographystyle{IEEEtran}
324
+ \\bibliography{references}
325
+
326
+ \\end{document}
327
+ `,
328
+ 'paper/headers/colors.tex': WHITEPAPER_COLORS_TEX,
329
+ 'paper/headers/typescript.tex': WHITEPAPER_TYPESCRIPT_TEX,
330
+ 'paper/sections/introduction.tex': `\\section{Introduction}
331
+
332
+ State the problem and why it matters. Cite prior work like this~\\cite{stonebraker1986}.
333
+ \\Cref{fig:flow} is drawn with PSTricks.
334
+
335
+ \\begin{figure}[ht]
336
+ \\centering
337
+ \\begin{pspicture}(0,0)(9,3)
338
+ \\psframe[fillstyle=solid,fillcolor=lightpurple,framearc=0.2](0,0.75)(3,2.25)
339
+ \\rput(1.5,1.5){Client}
340
+ \\psline[linewidth=1pt]{->}(3,1.5)(6,1.5)
341
+ \\rput(4.5,1.85){\\small request}
342
+ \\pscircle[fillstyle=solid,fillcolor=codelightgreen](7.5,1.5){1.2}
343
+ \\rput(7.5,1.5){Server}
344
+ \\end{pspicture}
345
+ \\caption{A request flow, drawn with PSTricks.}
346
+ \\label{fig:flow}
347
+ \\end{figure}
348
+ `,
349
+ 'paper/sections/design.tex': `\\section{Design}
350
+
351
+ \\Cref{fig:layers} is drawn with TikZ, and \\cref{lst:counter} uses the
352
+ TypeScript listing style.
353
+
354
+ \\begin{figure}[ht]
355
+ \\centering
356
+ \\begin{tikzpicture}[
357
+ node distance=1.2cm,
358
+ box/.style={rectangle, draw, rounded corners, fill=blue!10, text width=2.8cm, text centered, minimum height=0.9cm},
359
+ store/.style={rectangle, draw, rounded corners, fill=orange!10, text width=2.8cm, text centered, minimum height=0.9cm},
360
+ arrow/.style={-{Stealth}, thick}
361
+ ]
362
+ \\node[box] (api) {API};
363
+ \\node[box, below=of api] (policy) {Policy check};
364
+ \\node[store, right=1.6cm of policy] (data) {Data};
365
+ \\draw[arrow] (api) -- (policy);
366
+ \\draw[arrow] (policy) -- node[above] {\\small allowed} (data);
367
+ \\end{tikzpicture}
368
+ \\caption{Layers, drawn with TikZ.}
369
+ \\label{fig:layers}
370
+ \\end{figure}
371
+
372
+ \\begin{lstlisting}[language=typescript, caption=A small contract, label=lst:counter, style=typescript]
373
+ export default class Counter {
374
+ state = { count: 0 };
375
+
376
+ increment(by: number) {
377
+ this.state.count += by;
378
+ return this.state.count;
379
+ }
380
+ }
381
+ \\end{lstlisting}
382
+ `,
383
+ 'paper/sections/conclusion.tex': `\\section{Conclusion}
384
+
385
+ Summarize what the paper showed and what comes next.
386
+ `,
387
+ 'paper/references.bib': `@techreport{stonebraker1986,
388
+ author = {Michael Stonebraker and Lawrence A. Rowe},
389
+ title = {The Design of {POSTGRES}},
390
+ institution = {University of California, Berkeley},
391
+ number = {UCB/ERL M85/95},
392
+ year = {1986}
393
+ }
394
+ `,
395
+ '.github/workflows/paper.yml': PAPER_WORKFLOW('paper/main.tex', 'paper'),
396
+ 'README.md': `# Paper
397
+
398
+ \`\`\`bash
399
+ npx latex-kit render paper/main.tex --verify # → out/main.pdf, byte-identical on every build
400
+ \`\`\`
401
+
402
+ The Constructive whitepaper style: \`paper/headers/colors.tex\` (code colours)
403
+ and \`paper/headers/typescript.tex\` (\`style=typescript\` listings), TikZ and
404
+ PSTricks figures, IEEE references. PSTricks builds through latex → dvips →
405
+ ps2pdf, which latex-kit picks by itself.
406
+
407
+ CI builds the PDF on every push and attaches it to the run. Pushing a tag
408
+ like \`v1.0.0\` publishes it as a GitHub release.
409
+ `,
410
+ };
411
+ }
412
+ /** Files for `latex-kit init --paper`. */
413
+ export function paperFiles(preset = 'whitepaper') {
414
+ return preset === 'plain' ? plainPaperFiles() : whitepaperFiles();
415
+ }
package/esm/cli.js CHANGED
@@ -19,7 +19,7 @@ const app = new CLI(commands, {
19
19
  minimistOpts: {
20
20
  alias: { h: 'help', v: 'version', o: 'out', e: 'engine' },
21
21
  boolean: ['help', 'version', 'local', 'verify', 'json', 'final', 'strict', 'tex-only', 'force', 'schema', 'paper', 'check'],
22
- string: ['out', 'engine', 'image', 'root', 'platform', 'source-date-epoch', 'variant', 'template', 'name', 'against', 'only', 'locale', 'signatures'],
22
+ string: ['out', 'engine', 'image', 'root', 'platform', 'source-date-epoch', 'variant', 'template', 'name', 'against', 'only', 'locale', 'signatures', 'preset'],
23
23
  default: { strict: undefined, schema: true },
24
24
  },
25
25
  });
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The Constructive whitepaper style, from constructive-io/rls-whitepaper and
3
+ * hyperweb-whitepaper (tex/headers/): the code colour palette and the
4
+ * TypeScript listings style, copied verbatim so new papers look like ours.
5
+ * Regenerate from those files rather than editing here.
6
+ */
7
+ /** tex/headers/colors.tex */
8
+ export declare const WHITEPAPER_COLORS_TEX = "% Define colors for code highlighting\n\\definecolor{lightpurple}{rgb}{0.85, 0.85, 1}\n\\definecolor{white}{rgb}{1, 1, 1}\n\\definecolor{codegray}{gray}{0.9}\n\\definecolor{codeblue}{rgb}{0,0,0.6}\n\\definecolor{codegreen}{rgb}{0,0.6,0}\n\\definecolor{codepurple}{rgb}{0.58,0,0.82}\n\\definecolor{codebackground}{rgb}{0.95,0.95,0.95}\n\\definecolor{codeorange}{rgb}{1, 0.6, 0.2}\n\\definecolor{codered}{rgb}{0.8, 0, 0}\n\\definecolor{codeyellow}{rgb}{0.9, 0.9, 0.4}\n\\definecolor{codeteal}{rgb}{0, 0.5, 0.5}\n\\definecolor{codepink}{rgb}{1, 0.5, 0.7}\n\\definecolor{codebrown}{rgb}{0.6, 0.4, 0.2}\n\\definecolor{codelightblue}{rgb}{0.7, 0.85, 1}\n\\definecolor{codelightgreen}{rgb}{0.7, 1, 0.7}\n\\definecolor{codedarkblue}{rgb}{0, 0.2, 0.5}\n\\definecolor{codedarkpurple}{rgb}{0.4, 0.2, 0.6}\n\\definecolor{black}{rgb}{0, 0, 0}\n\\pagecolor{white}";
9
+ /** tex/headers/typescript.tex */
10
+ export declare const WHITEPAPER_TYPESCRIPT_TEX = "% Code style definition\n\\lstdefinelanguage{typescript}{\n keywords={abstract, arguments, await, boolean, break, byte, case, catch,\n class, const, continue, debugger, default, delete, do, double, else,\n enum, eval, export, extends, false, final, finally, float, for,\n function, goto, if, implements, import, in, instanceof, int, interface,\n let, long, native, new, null, package, private, protected, public,\n return, short, static, super, switch, synchronized, this, throw,\n throws, transient, true, try, typeof, var, void, volatile, while, with,\n yield, async, from, of},\n keywordstyle=\\color{codeblue},\n sensitive=true,\n comment=[l]{//},\n morecomment=[s]{/*}{*/},\n commentstyle=\\color{codegreen},\n stringstyle=\\color{codepurple},\n morestring=[b]',\n morestring=[b]\"\n}\n\n% Enhanced Code Style Definition for TypeScript and JavaScript\n\\lstdefinestyle{typescript}{\n language=typescript,\n backgroundcolor=\\color{white},\n basicstyle=\\ttfamily\\footnotesize,\n breakatwhitespace=false,\n breaklines=true,\n captionpos=b,\n keepspaces=true,\n numbers=left,\n numbersep=5pt,\n showspaces=false,\n showstringspaces=false,\n showtabs=false,\n tabsize=2,\n numberstyle=\\tiny\\color{black},\n % Additional TypeScript-specific highlighting\n moredelim=[is][\\textcolor{codepurple}]{\\#\\{}{\\}}, % Template literals\n moredelim=[is][\\textcolor{codeblue}]{<}{>}, % Generic types\n literate=\n {=>}{{\\textcolor{codeblue}{=>}}}2 \n {interface}{{\\textcolor{codeblue}{interface}}}9\n {type}{{\\textcolor{codered}{type}}}4\n {export}{{\\textcolor{codegreen}{export}}}6\n {import}{{\\textcolor{codeorange}{import}}}6\n {from}{{\\textcolor{codeblue}{from}}}4\n {return}{{\\textcolor{codeteal}{return}}}6 \n {function}{{\\textcolor{codeblue}{function}}}8\n {string}{{\\textcolor{codepink}{string}}}6 \n {let}{{\\textcolor{codered}{let}}}3 \n% {const}{{\\textcolor{codedarkpurple}{const}}}5 \n {var}{{\\textcolor{codelightblue}{var}}}3 \n {while}{{\\textcolor{codered}{while}}}5 \n {if}{{\\textcolor{codeorange}{if}}}2 \n {else}{{\\textcolor{codeyellow}{else}}}4\n\t{@onlyOwner}{{\\textcolor{codered}{@onlyOwner}}}9\n\t{@instantiate}{{\\textcolor{codered}{@instantiate}}}{10}\n}\n\n";
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The Constructive whitepaper style, from constructive-io/rls-whitepaper and
3
+ * hyperweb-whitepaper (tex/headers/): the code colour palette and the
4
+ * TypeScript listings style, copied verbatim so new papers look like ours.
5
+ * Regenerate from those files rather than editing here.
6
+ */
7
+ /** tex/headers/colors.tex */
8
+ export const WHITEPAPER_COLORS_TEX = '% Define colors for code highlighting\n\\definecolor{lightpurple}{rgb}{0.85, 0.85, 1}\n\\definecolor{white}{rgb}{1, 1, 1}\n\\definecolor{codegray}{gray}{0.9}\n\\definecolor{codeblue}{rgb}{0,0,0.6}\n\\definecolor{codegreen}{rgb}{0,0.6,0}\n\\definecolor{codepurple}{rgb}{0.58,0,0.82}\n\\definecolor{codebackground}{rgb}{0.95,0.95,0.95}\n\\definecolor{codeorange}{rgb}{1, 0.6, 0.2}\n\\definecolor{codered}{rgb}{0.8, 0, 0}\n\\definecolor{codeyellow}{rgb}{0.9, 0.9, 0.4}\n\\definecolor{codeteal}{rgb}{0, 0.5, 0.5}\n\\definecolor{codepink}{rgb}{1, 0.5, 0.7}\n\\definecolor{codebrown}{rgb}{0.6, 0.4, 0.2}\n\\definecolor{codelightblue}{rgb}{0.7, 0.85, 1}\n\\definecolor{codelightgreen}{rgb}{0.7, 1, 0.7}\n\\definecolor{codedarkblue}{rgb}{0, 0.2, 0.5}\n\\definecolor{codedarkpurple}{rgb}{0.4, 0.2, 0.6}\n\\definecolor{black}{rgb}{0, 0, 0}\n\\pagecolor{white}';
9
+ /** tex/headers/typescript.tex */
10
+ export const WHITEPAPER_TYPESCRIPT_TEX = "% Code style definition\n\\lstdefinelanguage{typescript}{\n keywords={abstract, arguments, await, boolean, break, byte, case, catch,\n class, const, continue, debugger, default, delete, do, double, else,\n enum, eval, export, extends, false, final, finally, float, for,\n function, goto, if, implements, import, in, instanceof, int, interface,\n let, long, native, new, null, package, private, protected, public,\n return, short, static, super, switch, synchronized, this, throw,\n throws, transient, true, try, typeof, var, void, volatile, while, with,\n yield, async, from, of},\n keywordstyle=\\color{codeblue},\n sensitive=true,\n comment=[l]{//},\n morecomment=[s]{/*}{*/},\n commentstyle=\\color{codegreen},\n stringstyle=\\color{codepurple},\n morestring=[b]',\n morestring=[b]\"\n}\n\n% Enhanced Code Style Definition for TypeScript and JavaScript\n\\lstdefinestyle{typescript}{\n language=typescript,\n backgroundcolor=\\color{white},\n basicstyle=\\ttfamily\\footnotesize,\n breakatwhitespace=false,\n breaklines=true,\n captionpos=b,\n keepspaces=true,\n numbers=left,\n numbersep=5pt,\n showspaces=false,\n showstringspaces=false,\n showtabs=false,\n tabsize=2,\n numberstyle=\\tiny\\color{black},\n % Additional TypeScript-specific highlighting\n moredelim=[is][\\textcolor{codepurple}]{\\#\\{}{\\}}, % Template literals\n moredelim=[is][\\textcolor{codeblue}]{<}{>}, % Generic types\n literate=\n {=>}{{\\textcolor{codeblue}{=>}}}2 \n {interface}{{\\textcolor{codeblue}{interface}}}9\n {type}{{\\textcolor{codered}{type}}}4\n {export}{{\\textcolor{codegreen}{export}}}6\n {import}{{\\textcolor{codeorange}{import}}}6\n {from}{{\\textcolor{codeblue}{from}}}4\n {return}{{\\textcolor{codeteal}{return}}}6 \n {function}{{\\textcolor{codeblue}{function}}}8\n {string}{{\\textcolor{codepink}{string}}}6 \n {let}{{\\textcolor{codered}{let}}}3 \n% {const}{{\\textcolor{codedarkpurple}{const}}}5 \n {var}{{\\textcolor{codelightblue}{var}}}3 \n {while}{{\\textcolor{codered}{while}}}5 \n {if}{{\\textcolor{codeorange}{if}}}2 \n {else}{{\\textcolor{codeyellow}{else}}}4\n\t{@onlyOwner}{{\\textcolor{codered}{@onlyOwner}}}9\n\t{@instantiate}{{\\textcolor{codered}{@instantiate}}}{10}\n}\n\n";
@@ -5,6 +5,7 @@ import { existsSync, mkdirSync, rmSync, watch as fsWatch, writeFileSync } from '
5
5
  import { isAbsolute, join, relative } from 'path';
6
6
  import chalk from 'yanse';
7
7
  import { UsageError } from './args';
8
+ import { PAPER_PRESETS } from './boilerplates';
8
9
  import { buildBlank, buildDocument, BuildError } from './build';
9
10
  import { checkProject, templateFields } from './check';
10
11
  import { version } from './commands';
@@ -283,7 +284,12 @@ export async function lockCommand(argv) {
283
284
  }
284
285
  export async function initCommand(argv) {
285
286
  const dir = join(process.cwd(), argv._?.[0] ? String(argv._[0]) : '.');
286
- const r = initProject(dir, { paper: Boolean(argv.paper), force: Boolean(argv.force), version: version() });
287
+ const preset = (argv.preset ?? 'whitepaper');
288
+ if (!PAPER_PRESETS.includes(preset))
289
+ throw new UsageError(`--preset must be one of ${PAPER_PRESETS.join(', ')}`);
290
+ if (argv.preset && !argv.paper)
291
+ throw new UsageError('--preset only applies to init --paper');
292
+ const r = initProject(dir, { paper: Boolean(argv.paper), preset, force: Boolean(argv.force), version: version() });
287
293
  if (!argv.paper && !existsSync(join(dir, LOCK_FILE))) {
288
294
  writeLock(dir);
289
295
  r.written.push(join(dir, LOCK_FILE));
package/esm/scaffold.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { FileMap } from './boilerplates';
1
+ import { FileMap, PaperPreset } from './boilerplates';
2
2
  import { Project } from './project';
3
3
  export interface WriteResult {
4
4
  written: string[];
@@ -9,6 +9,7 @@ export declare function writeFiles(dir: string, files: FileMap, force?: boolean)
9
9
  /** Scaffold a latex-kit project (or a paper) in `dir`. */
10
10
  export declare function initProject(dir: string, options: {
11
11
  paper?: boolean;
12
+ preset?: PaperPreset;
12
13
  force?: boolean;
13
14
  version: string;
14
15
  }): WriteResult;
package/esm/scaffold.js CHANGED
@@ -27,7 +27,7 @@ export function initProject(dir, options) {
27
27
  if (existing)
28
28
  throw new Error(`${join(dir, existing)} already exists; use --force to add the starter files anyway`);
29
29
  }
30
- return writeFiles(dir, options.paper ? paperFiles() : projectFiles(options.version), options.force);
30
+ return writeFiles(dir, options.paper ? paperFiles(options.preset) : projectFiles(options.version), options.force);
31
31
  }
32
32
  export function newTemplate(project, name, force = false) {
33
33
  if (!/^[a-z0-9][a-z0-9_-]*$/.test(name))
package/esm/usage.js CHANGED
@@ -5,7 +5,10 @@ Usage
5
5
 
6
6
  Start
7
7
  init [dir] A new project: a letter template, data and a record
8
- init [dir] --paper A paper: main.tex, refs.bib and a GitHub Actions workflow
8
+ init [dir] --paper A paper in the Constructive whitepaper style (TikZ,
9
+ PSTricks, highlighted TypeScript listings, IEEE
10
+ references) with CI and release-on-tag; --preset plain
11
+ for a minimal LuaLaTeX paper
9
12
  new template <name> A template folder with template.tex and schema.ts
10
13
  new document <name> --template <t>
11
14
  A record with every required field, linked to its schema
@@ -44,7 +47,7 @@ Options
44
47
  -o, --out <dir> Output directory, relative to --root (default: out)
45
48
  -e, --engine <name> auto (default), lualatex, xelatex, pdflatex or pdfps
46
49
  --root <dir> Directory TeX can see (default: current directory)
47
- --image <ref> Docker image (default: pinned ghcr.io/constructive-io/latex-kit)
50
+ --image <ref> Docker image (default: pinned constructiveio/latex-kit)
48
51
  --platform <os/arch> Docker --platform (default: native)
49
52
  --local Use latexmk on PATH instead of Docker (not pinned)
50
53
  --source-date-epoch <s> Build timestamp in seconds since 1970
@@ -86,7 +89,7 @@ Options
86
89
  -e, --engine <name> auto (default), lualatex, xelatex, pdflatex or pdfps
87
90
  --local Use latexmk on PATH instead of Docker
88
91
  --image <ref> Docker image (default: latex-kit.lock, else the pinned
89
- ghcr.io/constructive-io/latex-kit)
92
+ constructiveio/latex-kit on Docker Hub)
90
93
  --verify Build twice and fail unless the PDFs are identical
91
94
  --tex-only Write the .tex without running TeX
92
95
  --json JSON results on stdout
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "latex-kit",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Build typed, reproducible LaTeX documents from the command line",
5
5
  "author": "Constructive <developers@constructive.io>",
6
6
  "main": "index.js",
@@ -19,16 +19,6 @@
19
19
  "bugs": {
20
20
  "url": "https://github.com/constructive-io/latex-kit/issues"
21
21
  },
22
- "scripts": {
23
- "copy": "makage assets",
24
- "clean": "makage clean",
25
- "prepublishOnly": "npm run build",
26
- "build": "makage build",
27
- "build:dev": "makage build --dev",
28
- "lint": "eslint . --fix",
29
- "test": "NODE_OPTIONS=--experimental-vm-modules jest",
30
- "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch"
31
- },
32
22
  "devDependencies": {
33
23
  "@types/minimist": "^1.2.5",
34
24
  "makage": "^0.8.0"
@@ -44,13 +34,21 @@
44
34
  "latex-kit": "cli.js"
45
35
  },
46
36
  "dependencies": {
47
- "@latex-kit/components": "0.2.0",
48
- "@latex-kit/render": "0.5.0",
49
- "@latex-kit/schema": "0.4.0",
50
- "@latex-kit/template": "0.4.0",
51
37
  "inquirerer": "^4.9.5",
52
38
  "minimist": "^1.2.8",
53
- "yanse": "^0.2.3"
39
+ "yanse": "^0.2.3",
40
+ "@latex-kit/schema": "0.4.1",
41
+ "@latex-kit/components": "0.2.1",
42
+ "@latex-kit/render": "0.5.1",
43
+ "@latex-kit/template": "0.4.1"
54
44
  },
55
- "gitHead": "b169d7b7a018ec26e5099e021b3529dcf6c006fa"
56
- }
45
+ "scripts": {
46
+ "copy": "makage assets",
47
+ "clean": "makage clean",
48
+ "build": "makage build",
49
+ "build:dev": "makage build --dev",
50
+ "lint": "eslint . --fix",
51
+ "test": "NODE_OPTIONS=--experimental-vm-modules jest",
52
+ "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch"
53
+ }
54
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The Constructive whitepaper style, from constructive-io/rls-whitepaper and
3
+ * hyperweb-whitepaper (tex/headers/): the code colour palette and the
4
+ * TypeScript listings style, copied verbatim so new papers look like ours.
5
+ * Regenerate from those files rather than editing here.
6
+ */
7
+ /** tex/headers/colors.tex */
8
+ export declare const WHITEPAPER_COLORS_TEX = "% Define colors for code highlighting\n\\definecolor{lightpurple}{rgb}{0.85, 0.85, 1}\n\\definecolor{white}{rgb}{1, 1, 1}\n\\definecolor{codegray}{gray}{0.9}\n\\definecolor{codeblue}{rgb}{0,0,0.6}\n\\definecolor{codegreen}{rgb}{0,0.6,0}\n\\definecolor{codepurple}{rgb}{0.58,0,0.82}\n\\definecolor{codebackground}{rgb}{0.95,0.95,0.95}\n\\definecolor{codeorange}{rgb}{1, 0.6, 0.2}\n\\definecolor{codered}{rgb}{0.8, 0, 0}\n\\definecolor{codeyellow}{rgb}{0.9, 0.9, 0.4}\n\\definecolor{codeteal}{rgb}{0, 0.5, 0.5}\n\\definecolor{codepink}{rgb}{1, 0.5, 0.7}\n\\definecolor{codebrown}{rgb}{0.6, 0.4, 0.2}\n\\definecolor{codelightblue}{rgb}{0.7, 0.85, 1}\n\\definecolor{codelightgreen}{rgb}{0.7, 1, 0.7}\n\\definecolor{codedarkblue}{rgb}{0, 0.2, 0.5}\n\\definecolor{codedarkpurple}{rgb}{0.4, 0.2, 0.6}\n\\definecolor{black}{rgb}{0, 0, 0}\n\\pagecolor{white}";
9
+ /** tex/headers/typescript.tex */
10
+ export declare const WHITEPAPER_TYPESCRIPT_TEX = "% Code style definition\n\\lstdefinelanguage{typescript}{\n keywords={abstract, arguments, await, boolean, break, byte, case, catch,\n class, const, continue, debugger, default, delete, do, double, else,\n enum, eval, export, extends, false, final, finally, float, for,\n function, goto, if, implements, import, in, instanceof, int, interface,\n let, long, native, new, null, package, private, protected, public,\n return, short, static, super, switch, synchronized, this, throw,\n throws, transient, true, try, typeof, var, void, volatile, while, with,\n yield, async, from, of},\n keywordstyle=\\color{codeblue},\n sensitive=true,\n comment=[l]{//},\n morecomment=[s]{/*}{*/},\n commentstyle=\\color{codegreen},\n stringstyle=\\color{codepurple},\n morestring=[b]',\n morestring=[b]\"\n}\n\n% Enhanced Code Style Definition for TypeScript and JavaScript\n\\lstdefinestyle{typescript}{\n language=typescript,\n backgroundcolor=\\color{white},\n basicstyle=\\ttfamily\\footnotesize,\n breakatwhitespace=false,\n breaklines=true,\n captionpos=b,\n keepspaces=true,\n numbers=left,\n numbersep=5pt,\n showspaces=false,\n showstringspaces=false,\n showtabs=false,\n tabsize=2,\n numberstyle=\\tiny\\color{black},\n % Additional TypeScript-specific highlighting\n moredelim=[is][\\textcolor{codepurple}]{\\#\\{}{\\}}, % Template literals\n moredelim=[is][\\textcolor{codeblue}]{<}{>}, % Generic types\n literate=\n {=>}{{\\textcolor{codeblue}{=>}}}2 \n {interface}{{\\textcolor{codeblue}{interface}}}9\n {type}{{\\textcolor{codered}{type}}}4\n {export}{{\\textcolor{codegreen}{export}}}6\n {import}{{\\textcolor{codeorange}{import}}}6\n {from}{{\\textcolor{codeblue}{from}}}4\n {return}{{\\textcolor{codeteal}{return}}}6 \n {function}{{\\textcolor{codeblue}{function}}}8\n {string}{{\\textcolor{codepink}{string}}}6 \n {let}{{\\textcolor{codered}{let}}}3 \n% {const}{{\\textcolor{codedarkpurple}{const}}}5 \n {var}{{\\textcolor{codelightblue}{var}}}3 \n {while}{{\\textcolor{codered}{while}}}5 \n {if}{{\\textcolor{codeorange}{if}}}2 \n {else}{{\\textcolor{codeyellow}{else}}}4\n\t{@onlyOwner}{{\\textcolor{codered}{@onlyOwner}}}9\n\t{@instantiate}{{\\textcolor{codered}{@instantiate}}}{10}\n}\n\n";
package/paper-style.js ADDED
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ /**
3
+ * The Constructive whitepaper style, from constructive-io/rls-whitepaper and
4
+ * hyperweb-whitepaper (tex/headers/): the code colour palette and the
5
+ * TypeScript listings style, copied verbatim so new papers look like ours.
6
+ * Regenerate from those files rather than editing here.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.WHITEPAPER_TYPESCRIPT_TEX = exports.WHITEPAPER_COLORS_TEX = void 0;
10
+ /** tex/headers/colors.tex */
11
+ exports.WHITEPAPER_COLORS_TEX = '% Define colors for code highlighting\n\\definecolor{lightpurple}{rgb}{0.85, 0.85, 1}\n\\definecolor{white}{rgb}{1, 1, 1}\n\\definecolor{codegray}{gray}{0.9}\n\\definecolor{codeblue}{rgb}{0,0,0.6}\n\\definecolor{codegreen}{rgb}{0,0.6,0}\n\\definecolor{codepurple}{rgb}{0.58,0,0.82}\n\\definecolor{codebackground}{rgb}{0.95,0.95,0.95}\n\\definecolor{codeorange}{rgb}{1, 0.6, 0.2}\n\\definecolor{codered}{rgb}{0.8, 0, 0}\n\\definecolor{codeyellow}{rgb}{0.9, 0.9, 0.4}\n\\definecolor{codeteal}{rgb}{0, 0.5, 0.5}\n\\definecolor{codepink}{rgb}{1, 0.5, 0.7}\n\\definecolor{codebrown}{rgb}{0.6, 0.4, 0.2}\n\\definecolor{codelightblue}{rgb}{0.7, 0.85, 1}\n\\definecolor{codelightgreen}{rgb}{0.7, 1, 0.7}\n\\definecolor{codedarkblue}{rgb}{0, 0.2, 0.5}\n\\definecolor{codedarkpurple}{rgb}{0.4, 0.2, 0.6}\n\\definecolor{black}{rgb}{0, 0, 0}\n\\pagecolor{white}';
12
+ /** tex/headers/typescript.tex */
13
+ exports.WHITEPAPER_TYPESCRIPT_TEX = "% Code style definition\n\\lstdefinelanguage{typescript}{\n keywords={abstract, arguments, await, boolean, break, byte, case, catch,\n class, const, continue, debugger, default, delete, do, double, else,\n enum, eval, export, extends, false, final, finally, float, for,\n function, goto, if, implements, import, in, instanceof, int, interface,\n let, long, native, new, null, package, private, protected, public,\n return, short, static, super, switch, synchronized, this, throw,\n throws, transient, true, try, typeof, var, void, volatile, while, with,\n yield, async, from, of},\n keywordstyle=\\color{codeblue},\n sensitive=true,\n comment=[l]{//},\n morecomment=[s]{/*}{*/},\n commentstyle=\\color{codegreen},\n stringstyle=\\color{codepurple},\n morestring=[b]',\n morestring=[b]\"\n}\n\n% Enhanced Code Style Definition for TypeScript and JavaScript\n\\lstdefinestyle{typescript}{\n language=typescript,\n backgroundcolor=\\color{white},\n basicstyle=\\ttfamily\\footnotesize,\n breakatwhitespace=false,\n breaklines=true,\n captionpos=b,\n keepspaces=true,\n numbers=left,\n numbersep=5pt,\n showspaces=false,\n showstringspaces=false,\n showtabs=false,\n tabsize=2,\n numberstyle=\\tiny\\color{black},\n % Additional TypeScript-specific highlighting\n moredelim=[is][\\textcolor{codepurple}]{\\#\\{}{\\}}, % Template literals\n moredelim=[is][\\textcolor{codeblue}]{<}{>}, % Generic types\n literate=\n {=>}{{\\textcolor{codeblue}{=>}}}2 \n {interface}{{\\textcolor{codeblue}{interface}}}9\n {type}{{\\textcolor{codered}{type}}}4\n {export}{{\\textcolor{codegreen}{export}}}6\n {import}{{\\textcolor{codeorange}{import}}}6\n {from}{{\\textcolor{codeblue}{from}}}4\n {return}{{\\textcolor{codeteal}{return}}}6 \n {function}{{\\textcolor{codeblue}{function}}}8\n {string}{{\\textcolor{codepink}{string}}}6 \n {let}{{\\textcolor{codered}{let}}}3 \n% {const}{{\\textcolor{codedarkpurple}{const}}}5 \n {var}{{\\textcolor{codelightblue}{var}}}3 \n {while}{{\\textcolor{codered}{while}}}5 \n {if}{{\\textcolor{codeorange}{if}}}2 \n {else}{{\\textcolor{codeyellow}{else}}}4\n\t{@onlyOwner}{{\\textcolor{codered}{@onlyOwner}}}9\n\t{@instantiate}{{\\textcolor{codered}{@instantiate}}}{10}\n}\n\n";
@@ -23,6 +23,7 @@ const fs_1 = require("fs");
23
23
  const path_1 = require("path");
24
24
  const yanse_1 = __importDefault(require("yanse"));
25
25
  const args_1 = require("./args");
26
+ const boilerplates_1 = require("./boilerplates");
26
27
  const build_1 = require("./build");
27
28
  const check_1 = require("./check");
28
29
  const commands_1 = require("./commands");
@@ -301,7 +302,12 @@ async function lockCommand(argv) {
301
302
  }
302
303
  async function initCommand(argv) {
303
304
  const dir = (0, path_1.join)(process.cwd(), argv._?.[0] ? String(argv._[0]) : '.');
304
- const r = (0, scaffold_1.initProject)(dir, { paper: Boolean(argv.paper), force: Boolean(argv.force), version: (0, commands_1.version)() });
305
+ const preset = (argv.preset ?? 'whitepaper');
306
+ if (!boilerplates_1.PAPER_PRESETS.includes(preset))
307
+ throw new args_1.UsageError(`--preset must be one of ${boilerplates_1.PAPER_PRESETS.join(', ')}`);
308
+ if (argv.preset && !argv.paper)
309
+ throw new args_1.UsageError('--preset only applies to init --paper');
310
+ const r = (0, scaffold_1.initProject)(dir, { paper: Boolean(argv.paper), preset, force: Boolean(argv.force), version: (0, commands_1.version)() });
305
311
  if (!argv.paper && !(0, fs_1.existsSync)((0, path_1.join)(dir, lock_1.LOCK_FILE))) {
306
312
  (0, lock_1.writeLock)(dir);
307
313
  r.written.push((0, path_1.join)(dir, lock_1.LOCK_FILE));
package/scaffold.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { FileMap } from './boilerplates';
1
+ import { FileMap, PaperPreset } from './boilerplates';
2
2
  import { Project } from './project';
3
3
  export interface WriteResult {
4
4
  written: string[];
@@ -9,6 +9,7 @@ export declare function writeFiles(dir: string, files: FileMap, force?: boolean)
9
9
  /** Scaffold a latex-kit project (or a paper) in `dir`. */
10
10
  export declare function initProject(dir: string, options: {
11
11
  paper?: boolean;
12
+ preset?: PaperPreset;
12
13
  force?: boolean;
13
14
  version: string;
14
15
  }): WriteResult;
package/scaffold.js CHANGED
@@ -34,7 +34,7 @@ function initProject(dir, options) {
34
34
  if (existing)
35
35
  throw new Error(`${(0, path_1.join)(dir, existing)} already exists; use --force to add the starter files anyway`);
36
36
  }
37
- return writeFiles(dir, options.paper ? (0, boilerplates_1.paperFiles)() : (0, boilerplates_1.projectFiles)(options.version), options.force);
37
+ return writeFiles(dir, options.paper ? (0, boilerplates_1.paperFiles)(options.preset) : (0, boilerplates_1.projectFiles)(options.version), options.force);
38
38
  }
39
39
  function newTemplate(project, name, force = false) {
40
40
  if (!/^[a-z0-9][a-z0-9_-]*$/.test(name))
package/usage.js CHANGED
@@ -8,7 +8,10 @@ Usage
8
8
 
9
9
  Start
10
10
  init [dir] A new project: a letter template, data and a record
11
- init [dir] --paper A paper: main.tex, refs.bib and a GitHub Actions workflow
11
+ init [dir] --paper A paper in the Constructive whitepaper style (TikZ,
12
+ PSTricks, highlighted TypeScript listings, IEEE
13
+ references) with CI and release-on-tag; --preset plain
14
+ for a minimal LuaLaTeX paper
12
15
  new template <name> A template folder with template.tex and schema.ts
13
16
  new document <name> --template <t>
14
17
  A record with every required field, linked to its schema
@@ -47,7 +50,7 @@ Options
47
50
  -o, --out <dir> Output directory, relative to --root (default: out)
48
51
  -e, --engine <name> auto (default), lualatex, xelatex, pdflatex or pdfps
49
52
  --root <dir> Directory TeX can see (default: current directory)
50
- --image <ref> Docker image (default: pinned ghcr.io/constructive-io/latex-kit)
53
+ --image <ref> Docker image (default: pinned constructiveio/latex-kit)
51
54
  --platform <os/arch> Docker --platform (default: native)
52
55
  --local Use latexmk on PATH instead of Docker (not pinned)
53
56
  --source-date-epoch <s> Build timestamp in seconds since 1970
@@ -89,7 +92,7 @@ Options
89
92
  -e, --engine <name> auto (default), lualatex, xelatex, pdflatex or pdfps
90
93
  --local Use latexmk on PATH instead of Docker
91
94
  --image <ref> Docker image (default: latex-kit.lock, else the pinned
92
- ghcr.io/constructive-io/latex-kit)
95
+ constructiveio/latex-kit on Docker Hub)
93
96
  --verify Build twice and fail unless the PDFs are identical
94
97
  --tex-only Write the .tex without running TeX
95
98
  --json JSON results on stdout