Creating Cookbooks
CookCLI exports a recipe as LaTeX or Typst, which you compile into a professional PDF. Ingredients, cookware, and timers are color-coded automatically.
Two things to know before you start:
cook recipe -f latexexports one recipe as a complete, standalone document (\documentclass{article}through\end{document}). It is not a fragment, so you cannot simply concatenate several exports into one file.- To build a whole cookbook — chapters, title page, table of contents, index, images — use the cookbook-creator script (sample PDF). It calls
cook recipe -f latexper recipe and assembles the results. If you'd rather assemble the book yourself, see Building a cookbook by hand.
Prerequisites
CookCLI installed (Installation guide)
A typesetter. Typst is a single ~40 MB binary and needs nothing else, so reach for it first unless you specifically want LaTeX:
For LaTeX, install a subset, not the full distribution.
texlive-fullis 7.9 GB on Debian; the packages CookCLI's export actually needs come to 495 MB:texlive-latex-extrapulls intexlive-latex-baseandtexlive-latex-recommended, which together cover every package the export loads. Omitting--no-install-recommendstriples the install to 1.4 GB for documentation and GUI tools you don't need. If a compile still stops at a missing.sty, install just that package rather than escalating totexlive-full.Your recipes organized in folders (folders become chapters):
Exporting a Single Recipe
Page setup is controlled with two options that apply to latex and typst output:
--paper-size accepts a4 (default), letter, a5, and legal. --margin takes centimetres (default 2.5) and applies to all four sides.
Building a Full Cookbook
Use the cookbook-creator script. It walks your recipe directory, turns each subdirectory into a chapter, and generates a book document with a title page, table of contents, a tag-based recipe index, and recipe images.
The script requires Python 3 and a cook binary on your PATH. Options:
| Option | Description |
|---|---|
--title TITLE | Cookbook title (default: My Cookbook) |
--author AUTHOR | Author name for the title page |
--no-index | Skip the recipe index |
--no-toc | Skip the table of contents |
Including Images
Place an image next to each recipe with a matching base name and cookbook-creator will include it:
Supported formats: PNG, JPG, JPEG. Note that images are added by cookbook-creator, not by cook recipe -f latex — the CookCLI export itself never emits \includegraphics.
Building a Cookbook by Hand
If you want your own layout, extract the recipe body from each export and wrap the bodies in a document of your own. Every LaTeX export marks its body with comments:
Within that block, % BEGIN_TITLE/% END_TITLE wraps the recipe title (drop it if you emit your own \section), and % TAGS:, % SERVINGS:, and % SOURCE: comments carry metadata you can reuse.
Extract the bodies, one chapter per directory:
Your wrapper document must define everything the extracted bodies rely on — the same packages and the three \ingredient, \cookware, \timer commands the exporter would otherwise have defined itself:
Compile:
Dropping multicol or textcomp is the most common cause of a failed build — the exported bodies use \begin{multicols} for ingredient lists and \textdegree for temperatures.
For an index, add \usepackage{makeidx}, \makeindex, and \printindex to your wrapper and emit an \index{...} line per recipe in the loop above. The CookCLI export does not generate index entries on its own.
Customization
Scaling for Events
Export scaled versions for different occasions:
Different Versions
Point cookbook-creator at different directories to build different books:
Recipe Metadata
Add metadata to your .cook files for richer output:
Tags become index entries in cookbook-creator, and servings appear under the recipe title.
Typst Instead of LaTeX
cook recipe -f typst produces the same layout for Typst, which compiles in a fraction of the time and needs no TeX distribution:
Typst output is standalone too, and carries the same // BEGIN_RECIPE_CONTENT markers, so the by-hand approach above works the same way.
Other Output Formats
CookCLI also exports to Markdown, YAML, JSON, and Schema.org. For web-based cookbooks, Markdown or HTML via the report system may be simpler than LaTeX.
Troubleshooting
| Problem | Solution |
|---|---|
| "LaTeX command not found" | Install the packages listed under Prerequisites — you do not need texlive-full |
File 'foo.sty' not found | Install the one package that provides it (sudo apt-get install --no-install-recommends texlive-... or sudo tlmgr install foo), rather than the full distribution |
Environment multicols undefined | Add \usepackage{multicol} to your wrapper preamble |
Command \textdegree unavailable | Add \usepackage{textcomp} to your wrapper preamble |
Undefined control sequence \ingredient | Define \ingredient, \cookware, and \timer in your wrapper preamble |
Can be used only in preamble | You concatenated whole exports — extract the % BEGIN_RECIPE_CONTENT block instead |
| Table of contents empty | Run pdflatex a second time |
| Index not generated | Run makeindex between compilations, and check you emit \index{} entries |
| Images not showing | Ensure image files sit next to the recipe with a matching base name |
See Also
- CookCLI Recipe Command — output format reference
- Reports — custom template-based exports
- Publishing Your Recipes — share with the community