بنقرة واحدة
book-creation
PaperLab skill for book creation workflows in scientific writing and book production.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
PaperLab skill for book creation workflows in scientific writing and book production.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
NeqSim API patterns and code recipes. USE WHEN: writing Java or Python code that uses NeqSim for thermodynamic calculations, process simulation, or property retrieval. Covers EOS selection, fluid creation, flash calculations, property access, equipment patterns, and unit conventions.
Production platform process modeling patterns for NeqSim. USE WHEN: building full topside process models for oil & gas platforms (FPSO, fixed, semi-sub) from design documents, P&IDs, or operational data. Covers fluid creation with TBP fractions, multi-stage separation with recycles, recompression trains with compressor curves and anti-surge, export/injection compression, oil stabilization, scrubber liquid recovery, iteration strategies, and structured result extraction. Derived from 15+ production NCS platform models.
Power generation patterns for NeqSim. USE WHEN: modeling gas turbines, steam turbines, HRSG, combined cycle systems, waste heat recovery, or calculating fuel gas consumption and thermal efficiency. Covers GasTurbine, SteamTurbine, HRSG, CombinedCycleSystem classes and heat integration with PinchAnalysis.
Structured inventory of NeqSim's capabilities by engineering discipline. USE WHEN: checking what NeqSim can do, planning implementations, assessing gaps for engineering tasks, or routing work to the right agent. Covers thermodynamics, process equipment, PVT, standards, mechanical design, flow assurance, safety, and economics.
Jupyter notebook patterns for NeqSim. USE WHEN: creating or reviewing Jupyter notebooks that use NeqSim for process simulation, thermodynamics, or PVT analysis. Covers devtools workspace setup, class imports, notebook structure, visualization requirements, and results.json schema.
Extracts process simulation data from unstructured sources (text, tables, PFDs, data sheets, STID/E3D line lists) and converts it to NeqSim JSON builder format or PipingRouteBuilder route models. USE WHEN: a user provides a process description, PFD, operating data, line-list table, or design document and wants a running NeqSim simulation. Covers equipment mapping, stream wiring, route hydraulics, unit conversion, composition normalization, and confidence scoring.
| name | book_creation |
| description | PaperLab skill for book creation workflows in scientific writing and book production. |
USE WHEN: creating a new scientific book project, writing chapter content,
running book notebooks, building/rendering a book, or troubleshooting the book
pipeline. This skill covers the complete lifecycle from book-new to final
rendered outputs in HTML/Word/PDF/ODF.
DO NOT USE for: paper writing workflows (use write_methods_section,
journal_formatting, etc. instead).
Every book lives under neqsim-paperlab/books/<slug>_<year>/. The critical
file is book.yaml — it defines metadata, chapter ordering, parts, and
rendering settings.
books/<book_slug>/
├── book.yaml # Master manifest — defines EVERYTHING
├── refs.bib # Master bibliography
├── nomenclature.yaml # Symbol definitions
├── frontmatter/
│ ├── title_page.md
│ ├── copyright.md
│ ├── dedication.md
│ └── preface.md
├── chapters/
│ ├── ch01_introduction/
│ │ ├── chapter.md # Chapter text (markdown with LaTeX math)
│ │ ├── figures/ # Generated figures (PNG)
│ │ └── notebooks/ # Jupyter notebooks that generate figures
│ ├── ch02_topic_name/
│ │ ├── chapter.md
│ │ ├── figures/
│ │ └── notebooks/
│ └── ...
├── backmatter/
│ ├── glossary.md
│ └── author_bio.md
└── submission/ # Rendered outputs
├── book.html
├── book.docx
├── book.pdf
├── book.odt
└── figures_chNN/ # PDF renderer copies figures here for Typst
title: "Book Title"
subtitle: "Subtitle"
authors:
- name: "Author Name"
affiliation: "Institution"
email: "email@example.com"
edition: "1st"
year: 2026
publisher: "springer" # springer | wiley | crc | self
language: "en"
settings:
book_type: "textbook" # simple | technical | textbook (see §1.1)
page_size: "b5" # b5 | a4
font_size: 10
line_spacing: 1.2
two_sided: true
chapter_numbering: true
equation_numbering: "chapter" # chapter-scoped: Eq. 3.1, 3.2, ...
# Optional content toggles (override the book_type profile, see §1.1):
# include_copyright: true
# include_learning_objectives: true
# include_exercises: true
# exclude_sections: ["Review Questions", "Problems"]
frontmatter:
- title_page
- copyright
- dedication
- preface
parts:
- title: "Part I: Foundations"
chapters:
- dir: "ch01_introduction" # MUST match exact dir name
title: "Introduction and Context"
- dir: "ch02_topic_name"
title: "Topic Name"
- title: "Part II: Advanced"
chapters:
- dir: "ch03_another_topic"
title: "Another Topic"
backmatter:
- glossary
- author_bio
nomenclature:
file: "nomenclature.yaml"
position: "after_toc"
bibliography:
style: "numeric"
file: "refs.bib"
dir values MUST match actual directory names under chapters/.
Mismatches cause the renderer to silently skip chapters.ch03_cubic_eos vs
ch03_cubic_equations_of_state). Only the dir listed in book.yaml
is used. Remove unused dirs to avoid confusion.books/_publisher_profiles/ define page size,
margins, and fonts. The publisher key selects which profile to load.The following top-level keys are optional. Omit or leave them blank and the
renderers degrade gracefully (no author line, no publisher imprint, etc.):
authors, publisher, year, language, isbn.
settings.book_type selects how much pedagogical scaffolding is included so
the same manuscript can be published at three different levels. It controls
whether the copyright page, learning objectives, exercises, and review sections
are rendered.
book_type | Audience / purpose | Learning Objectives | Exercises | Review Questions / Problems | Further Reading | Copyright page |
|---|---|---|---|---|---|---|
simple | Concise reference / handout | ✗ | ✗ | ✗ | ✗ | ✗ |
technical | Engineering description | ✗ | ✗ | ✗ | ✓ | ✓ |
textbook | Full university textbook | ✓ | ✓ | ✓ | ✓ | ✓ |
textbook (everything included). Omitting book_type
reproduces the historic full-content behaviour, so existing books are
unaffected.## <Heading> sections are stripped from each
chapter.md at render time. The chapter source files are never modified —
authors can keep all sections in the source and switch the output level from
book.yaml alone.Explicit settings.include_* and settings.exclude_sections keys always win
over the book_type profile. This lets you start from a profile and tweak a
single aspect:
settings:
book_type: technical # baseline: no pedagogy, keeps copyright
include_copyright: false # …but drop the copyright page anyway
settings:
book_type: simple # baseline: strip everything
include_learning_objectives: true # …but keep Learning Objectives
Resolution order for each toggle: explicit settings key → book_type
profile default → built-in default (include). Accepted boolean strings are
case-insensitive: true/yes/1/on and false/no/0/off.
exclude_sections is additive — the titles you list are removed in
addition to whatever the profile already strips. Matching is case-insensitive
and ignores leading numbers (## 5.3 Problems matches Problems).
cd neqsim-paperlab
python paperflow.py book-new "Book Title" --publisher springer --chapters 12
This creates the scaffold with empty chapters (ch01 through ch12).
Use --type to pick the content level (writes settings.book_type into the
generated book.yaml, see §1.1). Defaults to textbook:
python paperflow.py book-new "Field Handbook" --type technical --chapters 8
python paperflow.py book-new "Quick Reference" --type simple --chapters 4
Rename chapter directories to descriptive names:
ch01 → ch01_introduction
ch02 → ch02_thermodynamic_foundations
Update book.yaml to match the new directory names and set real titles.
Organize into parts by editing the parts: section in book.yaml.
Fill frontmatter — at minimum: title_page.md (title, authors), preface.md (motivation, audience, acknowledgements).
Deep Literature Review and refs.bib (DO THIS BEFORE WRITING CHAPTERS):
This step is non-negotiable — a book with sparse references signals shallow scholarship. Complete the bibliography BEFORE writing chapter content.
a. Build master refs.bib at the book root with 100+ entries minimum. Organize into clearly commented sections by topic:
% ─── Foundational thermodynamics ───
@book{Prausnitz1999, ... }
% ─── Equations of state ───
@article{Soave1972, ... }
b. Mine existing PaperLab papers — Search papers/*/refs.bib for
related citations. Reuse BibTeX entries for consistency:
grep -rl "keyword" papers/*/refs.bib
c. Ensure coverage per chapter — Each chapter should have 10–20+ unique references identified before writing begins. d. Include all categories: seminal/foundational works, recent advances (last 5 years), textbooks, experimental data sources, competing methods, review articles.
See PAPER_WRITING_GUIDELINES.md "MANDATORY: Literature Review and Citation
Collection First" for the complete workflow and quality rules.
Import content from PaperLab papers (MANDATORY) — Before writing each
chapter, check papers/ for papers that cover the same topic:
grep -rl "chapter_keyword" papers/*/paper.md papers/*/plan.json
For each matching paper:
papers/<paper>/figures/*.png to chapters/chNN/figures/paper.md into chapter.mdThis step ensures the book benefits from the detailed research already done
in PaperLab papers. See PAPER_WRITING_GUIDELINES.md for the full workflow.
Create chapter content — each chapter.md uses markdown with:
$$...$$ for display equations (rendered as OMML in Word, KaTeX in HTML)$...$ for inline math\cite{key} tags for every claim, equation origin, and data source for figuresDisplay equations use $$...$$ delimiters. They are automatically numbered
per-chapter (Eq. 1.1, 1.2, ..., Eq. 2.1, 2.2, ...).
The cubic equation of state is:
$$
P = \frac{RT}{V_m - b} - \frac{a(T)}{(V_m + \epsilon b)(V_m + \sigma b)}
$$
For the SRK model, the alpha function is:
$$
\alpha(T) = \left[1 + m\left(1 - \sqrt{T_r}\right)\right]^2
$$
Inline math uses $...$:
The acentric factor $\omega$ affects the alpha function $\alpha(T_r, \omega)$.
| Renderer | Display Equations | Inline Math |
|---|---|---|
| Word (.docx) | LaTeX → MathML (latex2mathml) → OMML (MML2OMML.XSL) → native Word | Same OMML pipeline |
| HTML | KaTeX auto-render ($$...$$ blocks) | KaTeX inline |
| Pandoc → Typst (native math support) | Native Typst | |
| ODF | Unicode fallback (Greek, sub/superscript) | Unicode fallback |
Word renderer dependency: Requires MML2OMML.XSL from Microsoft Office.
Location: C:\Program Files\Microsoft Office\root\Office16\MML2OMML.XSL.
The math_utils.py module handles the conversion pipeline.
Figures are generated by Jupyter notebooks in chapters/chNN/notebooks/ and
saved to chapters/chNN/figures/. Reference them in chapter.md as:

The renderers handle figure numbering automatically (Figure 1.1, 1.2, ...).
Use standard markdown tables. The Word renderer applies booktabs-style formatting (horizontal rules only, no vertical lines):
| Component | Tc (K) | Pc (kPa) | ω |
|-----------|--------|----------|------|
| Methane | 190.56 | 4599 | 0.0115 |
| Ethane | 305.32 | 4872 | 0.0995 |
Use fenced code blocks with language specifiers:
```python
from neqsim import jneqsim
fluid = jneqsim.thermo.system.SystemSrkEos(298.15, 50.0)
```
Each chapter has a notebooks/ directory containing .ipynb files that
generate the chapter's figures.
import importlib, subprocess, sys
try:
from neqsim_dev_setup import neqsim_init, neqsim_classes
ns = neqsim_init(recompile=False)
ns = neqsim_classes(ns)
NEQSIM_MODE = "devtools"
print("NeqSim loaded via devtools (local dev mode)")
except Exception:
try:
import neqsim
except ImportError:
subprocess.check_call([sys.executable, "-m", "pip", "install", "-q", "neqsim"])
from neqsim import jneqsim
NEQSIM_MODE = "pip"
print("NeqSim loaded via pip package")
import matplotlib.pyplot as plt
from pathlib import Path
# Resolve to chapter figures/ directory
NOTEBOOK_DIR = Path(globals().get(
"__vsc_ipynb_file__", __file__
)).resolve().parent
FIGURES_DIR = NOTEBOOK_DIR.parent / "figures"
FIGURES_DIR.mkdir(exist_ok=True)
fig, ax = plt.subplots(figsize=(6, 4))
# ... plotting code ...
fig.savefig(FIGURES_DIR / "figure_name.png", dpi=150, bbox_inches="tight")
plt.show()
# Run all book notebooks (compiles NeqSim first)
python paperflow.py book-run-notebooks books/<book_dir>
# Run specific chapter's notebooks
python paperflow.py book-run-notebooks books/<book_dir> --chapter ch04_association_theory
# Skip compilation if already up to date
python paperflow.py book-run-notebooks books/<book_dir> --no-compile
# Full build (compile + notebooks + check + render)
python paperflow.py book-build books/<book_dir> --format all
cd neqsim-paperlab
# Full build: compile → notebooks → quality checks → render all formats
python paperflow.py book-build books/<book_dir> --format all
# Skip notebooks (use existing figure outputs)
python paperflow.py book-build books/<book_dir> --format all --skip-notebooks
# Skip compilation (notebooks still run using existing classes)
python paperflow.py book-build books/<book_dir> --format all --no-compile
# Skip both (render only — fastest for formatting iterations)
python paperflow.py book-build books/<book_dir> --format all --skip-notebooks --no-compile
# Single format
python paperflow.py book-render books/<book_dir> --format docx
python paperflow.py book-render books/<book_dir> --format html
python paperflow.py book-render books/<book_dir> --format pdf
python paperflow.py book-render books/<book_dir> --format odf
The book-build command runs these steps in order:
mvnw compile (ensures Java classes are current).ipynb files, capturing errors| Format | Output Path | Size Guide |
|---|---|---|
| HTML | submission/book.html | Single-page with sidebar navigation, KaTeX |
| Word | submission/book.docx | Native OMML equations, TOC, page numbers |
submission/book.pdf | Via Typst, publisher page size | |
| ODT | submission/book.odt | Unicode equation fallback |
The PDF renderer copies chapter figures to submission/figures_chNN/ because
Typst needs them alongside the master .typ file. This is by design — the
copies are build artifacts in submission/ and should not be committed.
python paperflow.py book-check books/<book_dir>
Checks: structure (dirs exist), completeness (word counts), consistency (cross-references), bibliography, figure references, nomenclature.
Cause: The dir value in book.yaml doesn't match the actual directory name.
Fix: Verify ls chapters/ matches every dir: entry in book.yaml.
Cause: MML2OMML.XSL not found (no Office installed) or latex2mathml
not installed.
Fix: Install Office or ensure MML2OMML.XSL is on the system. Install
dependencies: pip install latex2mathml lxml.
Expected: ODF renderer uses Unicode Greek/subscript/superscript as fallback. Full equation rendering in ODF requires a dedicated math library.
Cause: Chapters renamed but old directories not deleted.
Fix: Only the dir listed in book.yaml is used. Delete unused directories.
Cause: __pycache__ holds old versions of modified tools.
Fix: Delete tools/__pycache__/ and re-run.
Cause: Figure path in chapter.md doesn't match actual filename.
Fix: Use  — paths are relative to
the chapter directory.
Cause: Missing pandoc or typst package.
Fix: Install pandoc (system package) and pip install typst.
unexpected underscoreCause: Bibliography entries from refs.bib contain LaTeX-style fragments
such as $_2$, {CO, or \textit{...}. When inserted into a Typst content
block these $...$ segments are read as math mode, where a leading _ has no
base.
Fix: The bibliography renderer in tools/book_render_pdf.py escapes
\ # $ { } _ * @ < > [ ] \``. Do not remove that escape table. If you add a new bibliography style, make sure the entry text is escaped before being embedded into a #par[...]` block.
expected alignment or auto, found stringCause: #set page(binding: "left") no longer accepts a string in Typst
0.14. The keyword expects an alignment value (left / right).
Fix: Use binding: left (no quotes) in the generated preamble.
The PDF renderer (tools/book_render_pdf.py, function
build_book_typst_preamble) emits a Typst preamble that produces a
publisher-quality book layout. When you modify the preamble, preserve the
following features and verify against the checklist below.
| Feature | Implementation in preamble |
|---|---|
| Trim size | Parsed from publisher profile trim_size: "WxHmm" |
| Two-sided binding | binding: left + inside/outside margins |
| Running headers | #set page(header: context { ... }), querying nearest level-1 heading; suppressed on page 1; left-aligned on even pages, right-aligned on odd pages, in tracked smallcaps |
| Chapter opener | Smallcaps "Chapter N", thin colored rule, large coloured chapter title (level-1 #show rule) |
| Chapter forced to recto | pagebreak(weak: true, to: "odd") inside the level-1 rule |
| Equation numbering | (chapter.eq) via #set math.equation(numbering: ...) and counter reset at each level-1 heading |
| Booktabs tables | #set table(stroke: none, ...) plus a #show table: rule that wraps tables in a block with thin top/bottom rules and 9 pt text |
| Microtypography | #set text(hyphenate: true, ligatures: true, number-type: "lining") and justified paragraphs with leading: 0.78em |
| First-line indent | #set par(first-line-indent: (amount: 1.2em, all: false)) |
| Hanging-indent bib | Bib block sets hanging-indent: 1.6em and emits each entry as #par[#text(weight: "bold")[[N]] #h(0.5em) text] |
| Special-char escaping | Bib entries escape `\ # $ { } _ * @ < > [ ] `` to avoid Typst math/code triggers |
Publisher profile (books/_publisher_profiles/<name>.yaml) exists for the
value of publisher: in book.yaml. If missing, the renderer falls back
to A4 / generic margins — set the profile explicitly.
trim_size follows the format "WxHmm" (e.g. "155x235mm").
font is installed on the host (default "New Computer Modern"). On
Windows, install via the New Computer Modern release zip.
After running book-render --format pdf, open the PDF and verify:
(1.1), (2.1), ... and reset at every chapter.Run the consistency checker:
python paperflow.py book-check books/<book_dir>
The generated submission/book.typ is a build artifact. Do not edit it
by hand — change tools/book_render_pdf.py and re-render.
If you add new Typst rules to build_book_typst_preamble:
{ and } must be doubled
({{ / }}).python paperflow.py book-render books/<small_book> --format pdf.unexpected underscore from a bib entry), bisect by chapter — write _test.typ
inside submission/ so figure paths still resolve.binding: takes an alignment, not a string.#set page(width: ..., height: ...) uses keyword args, not a tuple.pagebreak(to: ...) accepts "odd" / "even" strings or omit the arg.query(heading.where(level: 1).before(here())) for running headers
(avoid shadowing the built-in here function with a local variable).The fastest iteration loop for writing/editing chapters:
chapter.md (add equations, text, figure references)python paperflow.py book-build books/<book_dir> --format html --skip-notebooks --no-compile
submission/book.html in browser — instant feedbackpython paperflow.py book-build books/<book_dir> --format all --skip-notebooks
For notebook development:
python paperflow.py book-build books/<book_dir> --format all --skip-notebooks --no-compile
| Tool | Purpose |
|---|---|
tools/book_builder.py | Config loading, chapter iteration, scaffolding |
tools/book_notebook_runner.py | Notebook execution, figure injection, full build pipeline |
tools/book_render_html.py | HTML renderer (KaTeX, sidebar nav) |
tools/book_render_word.py | Word renderer (OMML equations, TOC, booktabs tables) |
tools/book_render_pdf.py | PDF renderer (Pandoc → Typst pipeline) |
tools/book_render_odf.py | ODF renderer (Unicode math fallback) |
tools/book_render_epub.py | EPUB 3 renderer (Pandoc → epub3 pipeline) |
tools/book_preview.py | Live HTML preview server with auto-reload |
tools/book_checker.py | Quality checks (structure, completeness, consistency, accessibility) |
tools/bib_enrich.py | Crossref DOI validation / enrichment for refs.bib |
tools/book_pdfx_postpass.py | PDF/X-1a or PDF/A conversion via Ghostscript |
tools/math_utils.py | LaTeX → OMML/Unicode conversion |
python paperflow.py book-preview books/<book_dir>
# opens http://127.0.0.1:8765 ; auto-reloads on every chapter.md or book.yaml save
Add to book.yaml:
bibliography:
file: refs.bib
csl: styles/elsevier-harvard.csl # any CSL 1.0.2 file
The PDF, HTML and EPUB renderers will route citations through Pandoc's
--citeproc engine when both files exist.
python paperflow.py book-render books/<book_dir> --format epub
# requires pandoc on PATH; reads book.yaml metadata + cover.png if present
python paperflow.py book-enrich-bib books/<book_dir> # writes refs.enriched.bib
python paperflow.py book-enrich-bib books/<book_dir> --in-place # overwrites refs.bib
Validates every DOI, warns on title/year mismatches, and adds DOIs to entries that don't have one when Crossref's top match exceeds the threshold.
If a publisher profile sets:
print_specs:
pdf_standard: PDF/X-1a:2003
color_profile: CMYK
then the PDF renderer automatically post-processes book.pdf with
Ghostscript. The original is kept as book.pre-pdfx.pdf.
For chapters that defend numbers via NeqSim simulation, load the companion
skill skills/neqsim_in_writing/SKILL.md. It covers the dual-boot setup
cell, claim-to-test linkage (@neqsim:claim), equation-to-Java method
cross-references (@neqsim:eq), units enforcement against
nomenclature.yaml, and notebook-driven figure / results-table injection
(@neqsim:figure, @neqsim:table).
# 1. Create project
cd neqsim-paperlab
python paperflow.py book-new "Thermodynamic Modeling" --publisher springer --chapters 8
# 2. Edit book.yaml — rename chapters, set titles, organize parts
# 3. Write chapter content in chapters/ch01_xxx/chapter.md
# 4. Create notebooks in chapters/ch01_xxx/notebooks/
# 5. Run notebooks to generate figures
python paperflow.py book-run-notebooks books/thermodynamic_modeling_2026/
# 6. Build all formats
python paperflow.py book-build books/thermodynamic_modeling_2026/ --format all
# 7. Check quality
python paperflow.py book-check books/thermodynamic_modeling_2026/
# 8. Iterate — edit, rebuild, review
python paperflow.py book-build books/thermodynamic_modeling_2026/ --format html --skip-notebooks --no-compile