Directory paths in LaMD builds
LaMD projects declare several directory fields in _lamd.yml. They look interchangeable
(slidesdir, diagramsdir, …) but each answers a different question and is resolved
relative to a different anchor. Mixing them up is the usual cause of “the file was
built but pandoc cannot find it” failures.
This guide documents current field semantics (as implemented in mdpp,
dependencies, makefiles, and copy_web_diagrams.sh). Planned changes are described
in CIP-0010: Unified Diagram Path Resolution.
Authoring uses the gpp macro \diagramsDir (set at preprocess time). Content refers to
diagrams as \diagramsDir/ml/foo000, which becomes a path in generated markdown
(for example ../slides/diagrams//ml/foo000.emf for PPTX).
Consumer |
What it needs |
Typical anchor |
|---|---|---|
Inkscape / make |
Build |
cwd when |
pandoc |
Open the path embedded in markdown |
|
dependencies |
List files for makefile prerequisites |
Same as make (relative to cwd) |
Published HTML |
Browser URL for |
Site root ( |
For local builds (pptx, docx, tex, …), paths resolve from the build cwd. baseurl
affects \diagramsDir only when mdpp --to html or mdpp --to ipynb.
Anchor: where is the build?
Most course/talk repos use this layout:
project/
├── _lamd/ ← maketalk / make run here (cwd)
│ ├── _lamd.yml
│ ├── talk.md
│ └── makefile ← generated
├── slides/ ← slide HTML outputs + diagram sources
│ └── diagrams/
│ └── ml/
│ └── foo000.svg
└── _lectures/ ← published lecture HTML (posts)
Rule of thumb: paths in _lamd.yml are usually written relative to _lamd/
(the build cwd), not relative to the repository root and not relative to baseurl.
For the layout above:
slidesdir: ../slides/
diagramsdir: ../slides/diagrams/
Using ./slides/diagrams/ is wrong here: that resolves to _lamd/slides/diagrams/,
which is not where SVG sources live.
Field reference
diagramsdir
Purpose: Directory containing diagram sources and converted assets (SVG, EMF,
PDF, PNG) that macros reference via \diagramsDir.
Used by:
Tool |
How |
|---|---|
|
Sets gpp |
|
Substitutes |
Make ( |
Inkscape rules build |
|
Locates source files to copy into publish trees |
Dual behaviour in mdpp (lamd/mdpp.py):
url = diagramsurl or (url + baseurl)
diagrams_dir = url + diagramsdir # when --to html or ipynb
diagrams_dir = diagramsdir # when --to pptx, docx, tex, …
# Makefile always passes --diagrams-dir $(DIAGRAMSDIR), overriding the above
Local formats (pptx, docx, tex, …):
\diagramsDiris the filesystem path from config (or--diagrams-dir). Must be valid from_lamd/cwd.HTML / ipynb:
\diagramsDirbecomes a URL prefix unless--diagrams-diroverrides it. Prefer explicitdiagramsurlwhen the published path differs from the filesystem layout.
Not the same as: slidesdir (outputs and resource-path only), writediagramsdir
(generated diagrams), or baseurl alone.
diagramsurl (optional)
Purpose: Override the URL prefix used for \diagramsDir in HTML/ipynb when
url + baseurl + diagramsdir would be wrong.
Example: site at https://example.org/course/ with diagrams served at
https://example.org/course/slides/diagrams/:
url: https://example.org/
baseurl: course/
diagramsurl: https://example.org/course/slides/
diagramsdir: diagrams/ # URL suffix after diagramsurl, or filesystem path for local builds
If unset, mdpp uses url + baseurl as the URL prefix.
slidesdir
Purpose: Where built slide HTML is copied (cp … ${SLIDESDIR}/…) and a root
for pandoc --resource-path (with . and includes).
Used by:
Tool |
How |
|---|---|
|
|
|
|
|
Second argument pair: publish target under slides tree |
Relationship to diagrams: In many projects, diagramsdir is slidesdir +
diagrams/ (e.g. ../slides/ + diagrams/ → ../slides/diagrams/). That keeps
diagram assets next to slide outputs. They are still separate keys with separate
roles; duplicating the path in config is intentional.
Not combined with baseurl for local file lookup. baseurl does not appear in
makefile diagram rules or dependencies.
writediagramsdir
Purpose: Where generated diagrams are written (e.g. manim, dynamic figures),
via gpp -DwriteDiagramsDir=….
Default: . (often _lamd/ itself).
Distinct from diagramsdir: diagramsdir is for checked-in SVG/EMF assets;
writediagramsdir is for outputs produced during build.
url and baseurl
Purpose: Jekyll/GitHub Pages site location for published lecture pages.
Used by:
Tool |
How |
|---|---|
|
Prefix for |
|
|
Not used by: pptx/docx build, inkscape conversion, or dependencies batch (local
paths only).
Example from a course site:
url: "https://mlatcl.github.io/"
baseurl: mlfc/
Published pages live under https://mlatcl.github.io/mlfc/…. That is unrelated to
../slides/diagrams/ on disk except that you usually copy diagrams into the tree
that GitHub Pages serves (copy_web_diagrams.sh → ${SLIDESDIR}/diagrams/).
Other output directories
Field |
Role |
|---|---|
|
Destination for compiled lecture/practical HTML |
|
PDF notes output |
|
Jupyter notebook output |
|
|
|
Bibliography files |
|
gpp macro definitions |
These do not substitute for diagramsdir.
End-to-end flow (PPTX example)
Authoring:
\includediagram{\diagramsDir/ml/quadratic_basis000}{…}in snippets.dependencies batch (with
--diagrams-dir $(DIAGRAMSDIR)): lists../slides/diagrams//ml/quadratic_basis000.emfaspptxdiagramsprerequisite.make-figures.mk:
../slides/diagrams//ml/quadratic_basis000.emfbuilt from.svgvia Inkscape.mdpp (
--diagrams-dir ../slides/diagrams/): markdown contains.pandoc (
--resource-path .:includes:../slides/): resolves path from_lamd/cwd; EMF must exist at that relative path.
All five steps must agree on the same filesystem path for \diagramsDir.
Configuration checklist
When diagram paths fail, verify in order:
cwd: Are you building from
_lamd/(where_lamd.ymland generated makefile live)?diagramsdir: From_lamd/, doesls $(diagramsdir)/ml/*.svgshow sources?Consistency: Does
dependencies batch … --diagrams-dir $(diagramsdir)list the same.emfpaths that appear in*.slides.pptx.markdown?Regenerate: After changing
_lamd.yml, runmaketalkagain so the makefile picks up newDIAGRAMSDIR/PPTXDEPS.HTML only: If slides render locally but not on the site, check
url/baseurl/diagramsurl, notdiagramsdiralone.