8000 GitHub - pachterlab/docnimble · GitHub
[go: up one dir, main page]

Skip to content
pachterlabPublic

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

Docnimble

A macOS app for writing LaTeX documents. Like Overleaf, it shows the LaTeX source on the left and the typeset page on the right. Unlike Overleaf, you can also edit the page directly, the way you would in Word or Google Docs, and saving writes your edits back into the LaTeX. A terminal under the two panes runs an AI agent (Claude Code, Codex, Gemini CLI) that edits the same .tex file. Docnimble is a sibling of Fignimble and Manimble.

How it works

  • The .tex files are the document. Nothing is stored anywhere else.
  • Source (middle): the LaTeX, with syntax colouring, line numbers, and spelling and grammar checking that skips commands, maths and labels. The sidebar lists the project's files and the document's outline.
  • Page (right): the document typeset as a page you edit like Word or Google Docs. The maths is drawn by KaTeX, and section, equation, figure and theorem numbers, \refs and citations are filled in. Its toolbar has:
    • paragraph style, text size, bold, italic, underline, strikethrough, superscript, subscript, monospace and colour;
    • alignment, bulleted and numbered lists, and indent;
    • links, inline maths, equations, footnotes, citations from your .bib and cross-references to sections, figures, tables and equations;
    • tables (cells, rows and columns) and figures (drop a picture on the page, drag to resize, edit the caption);
    • comments, and Suggesting (the toggle on the toolbar, ⇧⌘E): your edits become tracked changes you or a co-author accept or reject, one by one in the margin or with Accept all / Reject all. Both are written with the changes package (\added, \deleted, \replaced, \highlight[comment=…]), so they typeset too;
    • Insert (the menu and the toolbar), as in Google Docs: pictures, tables, equations, footnotes, citations, cross-references, links, comments, lists, quotations, code, theorems, lemmas, definitions and proofs (declared in the preamble when they aren't), special characters, today's date, a horizontal line, a page break and a table of contents;
    • the document's font: LaTeX's own, the TeX Gyre fonts, any font on the Mac, or one of Microsoft Office's (Aptos, Calibri, ...), which Docnimble installs in ~/Library/Fonts when you choose it. It is set with fontspec, so the document typesets with LuaLaTeX;
    • find and replace, ⌘A for the whole page, and its own undo.
  • The same shortcuts in both panes (Format menu): ⌘B, ⌘I, ⌘U, ⌘⇧X, ⌘. and ⌘, (superscript and subscript), ⌘⇧8 and ⌘⇧7 (lists), ⌘K (link), ⌘M and ⌘⇧M (maths), ⌘⌥F (footnote), ⌘⌥M (comment). In the source they wrap the selected LaTeX (\textbf{…}; again to take it off) and add a package it needs.
  • Counts: the words and characters in the document, and in the selection when there is one (in either pane).
  • The two panes stay in step as you type. An edit on the page becomes LaTeX in the source. Only the paragraphs you touched are rewritten, and they keep their line breaks; everything else stays exactly as written. Packages your edits need are added to the preamble. An edit in the source redraws the page. Click a paragraph to find its LaTeX, or press ⌘J to go the other way. ⌘S writes the files.
  • Projects with several files: \input and \include files are drawn in place on the page and saved back to their own files. Open a chapter and Docnimble finds the main file (or reads % !TEX root = …).
  • Typeset (⌘T): runs latexmk and shows the exact PDF in the PDF tab. ⌘-click the PDF to jump to the source, or press ⌥⌘J to find the source line in the PDF (SyncTeX). Errors and warnings are listed under Messages and marked on their lines, with the app's notes (typeset, exported, the agent's edits, fonts installed).
  • Terminal (bottom): a shell in the document's folder, with a Run button for your agent (Claude Code, Codex, Gemini CLI, or a command of your own; the default is set in Settings, ⌘,, which can also start it when a document opens). While a document is open, Docnimble writes instructions for the agent (CLAUDE.md, AGENTS.md, GEMINI.md, only where the folder has none) and removes them on close. When the agent changes a file, both panes show it.
  • Versions (⌥⌘S, ⌥⇧⌘H): name the current version, as in Google Docs, and go back to any named version later (the text as it is then is kept as a version first). In Version History, choose one version to read it, or two (⌘-click) to see a redline of what changed: added text in red and underlined, removed text in red and struck through, with buttons to step through the changes. Export Redline saves it as a PDF as shown, as a Word document with the changes as tracked changes, or typeset by latexdiff (PDF, or its marked-up LaTeX for a journal). Versions are kept in the document's folder, in .docnimble/versions/.
  • The agent's edits as suggestions. Select a passage, on the page or in the source, and press ✦ Ask (⇧⌘A): pick Tighten, Fix grammar, Clarify, Check the maths or Explain, or type a request. It goes to the agent in the terminal with the file, the lines and the passage. When the agent (or anything else outside Docnimble) changes a file, its edits appear on the page as suggestions by the agent, to accept or reject like a co-author's; your unsaved edits stay as they are. Turn this off with Agent edits as suggestions on the page's toolbar.
  • Word round trip. File ▸ Export as Word Document makes a .docx for co-authors: headings with their numbers, formatting, lists, tables, figures and captions, footnotes, the references, equations as Word equations, and your suggestions and comments as Word's tracked changes and comments. When their copy comes back, File ▸ Import Word Edits compares it with the copy that was sent and puts everything they changed on the page as suggestions under their name, with their comments. Only what they changed is touched: citations, references, equations and the LaTeX around their edits stay as written. Opening a .docx (File ▸ Open) makes a new LaTeX document from it. No pandoc or Word is needed.
  • git: the Git tab under the panes shows the branch and the files changed, and commits, pulls and pushes (GitHub, or Overleaf's git address). It can create a repository too. Commits appear in Version History, to read, compare and restore like named versions.
  • Export for arXiv makes <main>-arxiv.zip: one .tex file with the \input files merged in and comments removed, suggestions typeset as accepted, the .bbl, and only the pictures and style files it uses. It is checked for what arXiv rejects (missing pictures, file names, .eps mixed with .pdf, size) and typeset on its own first.
  • Journal templates: PNAS, Nature, Cell Press, bioRxiv, Elsevier (elsarticle), IEEE (IEEEtran), APS (revtex), ACM (acmart) and mathematics papers (amsart). File ▸ Switch to a Journal Template puts an existing document into one, as a new main file beside it.
  • New Document starts from a template: article, article with bibliography, report or thesis (chapters in their own files), letter, Beamer presentation, NIH Specific Aims, NSF Project Description.

Building

cd apps/macos && ./build_app.sh        # Docnimble.app, universal (DOCNIMBLE_ARCHS=arm64 for one slice)
open Docnimble.app --args path/to/main.tex

You need Xcode or the Command Line Tools (Swift 5.9 or later). Typesetting needs MacTeX or TeX Live.

Tests

cd tests && npm install && npm test   # the LaTeX <-> page converter, with jsdom
tests/run_webkit.sh                   # real edits in the app's page, saved; prints the diff of the .tex
tests/run_webkit.sh features          # \input files, citations, suggesting, comments, tables, undo, find, ...
tests/run_webkit.sh versions          # two named versions, their redline, and the first restored
tests/run_webkit.sh agent             # an agent's edits of a chapter come back as suggestions
tests/run_webkit.sh word              # to Word and back: a co-author's edits as suggestions
tests/run_webkit.sh arxiv             # the arXiv upload, typeset on its own
tests/run_webkit.sh ask               # what ✦ Ask sends to the agent
tests/run_webkit.sh templates         # every template, and a document switched into each journal's, typeset
tests/run_webkit.sh tools             # fonts, Insert, special characters, counts, messages, redline exports

Layout

Path What
apps/macos/Sources/Docnimble/ the app (Swift/AppKit): window, project, sidebar, source editor, page view, PDF and SyncTeX, terminal and messages, settings, fonts, templates
apps/macos/Resources/web/latex.js LaTeX → blocks → editable page, and the page → LaTeX
apps/macos/Resources/web/redline.js, redline.html the redline of two versions, and the version history's page
apps/macos/Resources/web/merge.js someone else's edits (an agent's, a co-author's) as suggestions on the page
apps/macos/Resources/web/docx.js Word documents: the page to .docx, and .docx back to LaTeX (equations both ways)
apps/macos/Resources/web/editor.js the page's editing: toolbar, popovers, suggesting, comments, tables, find, undo; the bridge to Swift
apps/macos/Resources/web/katex/ KaTeX 0.16.11 (MIT)
tests/ converter, redline, merge and Word tests (Node), the WebKit tests, sample documents

Releasing

./set_version.sh X.Y.Z, commit, then push a tag vX.Y.Z. The release workflow builds, signs and notarizes the app and publishes Docnimble-macOS.dmg and .zip. It needs the same Apple secrets as Fignimble and Manimble (see the top of .github/workflows/release.yml).

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages

2BDC
0