Skip to contents

inst/extensions/quartifyr/ is the shell-generation piece: a dynamic title page (with a draft/final status stamp), a fax-cover-sheet-style memo cover page, contributor/approval signature pages, a synopsis summary table, and numbered appendices, layered on top of quarto-plus’s ToC/List of Figures/List of Tables/abbreviations/caption machinery. Install both:

quarto add A2-ai/quarto-plus
quarto add jprybylski/quartifyr

Or, if the quartifyr R package is installed: quarto add A2-ai/quarto-plus plus quartifyr::install_quartifyr_extension() (which also runs check_quarto_extensions() as a nudge if quarto-plus is still missing). render_report() checks for it too, before rendering.

Quick look

Rendering the shell needs nothing but Quarto and a reference-doc: no R, no Python, no reportifyr. {rpfy}: placeholders and \gls{} abbreviation markers stay unresolved in the output; that’s expected, pass 2 hasn’t run.

Terminal recording of quarto render building a report shell from report.qmd and a committed org-reference.docx, producing a styled docx with title page, signature pages, and unresolved {rpfy}: placeholders

Frontmatter

---
title: "Population PK Analysis of Compound X"
subtitle: "Final Report"
report-type: "Clinical Study Report"
document-status: "draft"   # or "final"
date: "2026-08-11"
lead-scientist: "Jane Doe, PharmD"
version: "1.0"
confidentiality: "Confidential — Do Not Distribute"
logo: "assets/logo.png"          # optional
project: "ACME-001"               # feeds header-format, not shown on its own
report_number: &report_number "RPT-2026-014"   # feeds header-format below
header-format: "{project} - {report_number}"   # optional
title-page-extra:
  - label: "Sponsor"
    value: "Acme Pharma"
  - label: "Report Number"
    value: *report_number            # reuses report_number above, not retyped
contributors:
  authors:
    - name: "Jane Doe, PharmD"
      title: "Lead Scientist"
  reviewers:
    - name: "John Smith, PhD"
      title: "Senior Biostatistician"
approvers:
  - name: "Alice Lee, MD"
    title: "Medical Director"
synopsis:
  - label: "Objectives"
    value: "..."
format: docx
filters:
  - quarto-plus
  - quartifyr
---

All fields except title are optional; the title page only renders the rows that are actually set. document-status is the exception: it’s always shown as a bordered, bold, uppercase stamp under the title, defaulting to DRAFT if omitted.

title-page-extra:/synopsis:/address: are YAML lists, not maps. Deliberate, since pandoc’s Lua metadata tables don’t preserve map key order (confirmed by testing), so a list is what keeps row order reliable across renders.

A value that’s also used elsewhere (like report_number above, reused by header-format:) doesn’t need to be written out twice: declare it once with a YAML anchor (&report_number) and reuse it with an alias (*report_number) in the title-page-extra row below, plain YAML, resolved before Quarto/pandoc/Lua ever see the data. The anchor must be declared before any alias that references it; a YAML alias can only resolve to an anchor already seen earlier in the same document (confirmed: PyYAML raises found undefined alias if the order is reversed), so report_number: &report_number ... has to come before value: *report_number below it, not after. This is a plain YAML mechanism, not the {{< meta ... >}} shortcode; that one only substitutes inside document body content, never frontmatter itself.

Memo cover page

An alternative to the title page for short, loose-structure documents: a left-aligned MEMORANDUM banner over a To/From/Date/Re/Cc grid, instead of a centered title/subtitle/info-table title page:

memo:
  to: "Jane Doe, CFO"
  from: "John Smith, Controller"
  date: "2026-08-12"
  re: "Q3 Budget Review"
  cc: "Finance Committee"    # optional
memo_number: &memo_number "MEMO-2026-014"   # feeds header-format below
header-format: "{project} - {memo_number}"   # optional
title-page-extra:
  - label: "Memo Number"
    value: *memo_number            # reuses memo_number above, not retyped

Activates only when memo: is present; never set title: on a memo project. title-page-extra: is the same field the title page reads (see above); the memo cover appends its rows after the fixed To/From/Date/ Re/Cc grid, so a value like a memo number can show up on the cover without a second, cover-specific frontmatter key. See examples/memo-example/ for a complete, minimal reference project built this way, and its rendered output on the Examples page.

Signature page

contributors: (authors:/reviewers:) and top-level approvers: render a single “Signatures” section: one heading, one ToC entry. Each person gets a bordered signature block: signing space, printed name, title, and role. When physical signatures aren’t the actual workflow (e.g. a validated e-signature system):

signature-mode: "note"
signature-note: "Approved electronically in the XYZ system"

Synopsis

Synopsis

::: .synopsis
:::

Renders a label/value summary from a synopsis: frontmatter block: any number of rows, any labels, in whatever order you write them. A “Title” row is prepended automatically.

value: also accepts a YAML list instead of a plain string, letting a row mix paragraphs and an inline figure:

synopsis:
  - label: "Results"
    value:
      - "Peak concentrations are summarized in Figure 1."
      - image: "summary-plot.png"
        width: "3in"

image: is a bare filename within OUTPUTS/figures/; it emits a {rpfy}: magic string, so the figure only actually appears after pass 2 fills it in.

synopsis-style: picks the rendered layout – default definition-list:

synopsis-style: definition-list   # default
Style Look
definition-list Label bold on its own line, value indented beneath it.
inline **Label:** runs into the row’s first value line. A row with more than one line, or whose one line is an image, falls back to standing the label alone (still bold/one point larger/colon-suffixed) with the rest following flush – indentation is a definition-list trait only, inline never indents.
table A real two-column, bordered Word table. Reintroduces the problem definition-list/inline exist to avoid: reportifyr’s auto-generated footnote for a figure embedded in a table cell lands after the whole table, not tucked under that specific figure (reportifyr groups cell footnotes per table element). A quarto.log.warning() fires whenever this style is selected, not just when a row currently has an image.
false synopsis: is still parsed (so the data can stay written in frontmatter) but nothing renders – not even a blank paragraph, just an empty div.

All four rendered from the same synopsis: data (the demo report’s actual content, including a multi-line Results row with an embedded figure) for direct comparison:

synopsis-style: definition-list -- every label bold on its own line, every value indented beneath it

definition-list

synopsis-style: inline -- label runs into the first value line on the same line, continuation lines flush, not indented

inline

synopsis-style: table -- a real bordered two-column Word table, with the Results row's embedded figure inside its cell

table

Omit synopsis: entirely (or set synopsis-style: false) to turn the section off; the div then renders nothing, so a shared shell template can leave the ::: .synopsis ::: marker in unconditionally and let each project’s frontmatter decide.

Bibliography / references

Ordinary Quarto/pandoc citeproc support, nothing quartifyr-specific beyond the standard frontmatter field:

bibliography: references.bib

Citation style defaults to NLM/Vancouver (numbered, bracketed: [1], [2], …) via a bundled nlm.csl. To control where the generated reference list lands (by default citeproc appends it to the very end, after any appendices), add a heading and an empty {#refs} Div at the location you want instead:

::: {custom-style="Heading 1"}
References
:::

::: {#refs}
:::

Appendices

{{< appendix "StatsAppendix" "Statistical Analysis Details" >}}

... appendix body ...

Each {{< appendix "BookmarkId" "Title" >}} renders an “Appendix A: …”, “Appendix B: …” heading using a native Word SEQ Appendix \* ALPHABETIC field: reordering, adding, or removing appendices never requires manual relettering, just a field recalculation. Reference one from body text with {{< appendix_crossref "BookmarkId" >}}.

The designator style is configurable document-wide:

appendix-numbering: alphabetic   # default -- A, B, C, ...
appendix-numbering: arabic       # 1, 2, 3, ...
appendix-numbering: roman        # I, II, III, ...

Figures, tables, and cross-references

quarto-plus’s own machinery, not something this extension adds:

{{< fig_caption "FigConcTime" "Concentration-time profile" >}}
{{< tbl_caption "TblPkSummary" "Per-subject PK summary statistics" >}}

See {{< crossref "TblPkSummary" >}} for the full profile.

crossref-hyperlinks: in frontmatter controls whether a resolved cross-reference is a clickable hyperlink, document-wide:

crossref-hyperlinks: true          # default -- always a hyperlink
crossref-hyperlinks: false         # never a hyperlink
crossref-hyperlinks: "same-page"   # hyperlink only when the target is on a different page

true/false are handled by quartifyr-styling apply-layout / styling_apply_layout(). "same-page" needs a further opt-in post-reportifyr step; see Styling.

Scoped figure/table numbering

An additive alternative to fig_caption/tbl_caption above, for when figure/table numbering should restart within an appendix, section, or subsection instead of running continuously through the document:

{{< appendix "SupplementaryFigures" "Supplementary Figures" >}}

{{< appendix_fig_caption "FigResiduals" "Residual plot" >}}

See {{< scoped_crossref "FigResiduals" >}}.

Numbers “Figure A.1” – the appendix’s own letter, a period, then a number that restarts at each {{< appendix >}}. section_fig_caption/ subsection_fig_caption (with table equivalents) do the same for ordinary headings, numbered “Figure 3.1”/“Figure 3.2.1” in the main body; since a #/## heading isn’t a shortcode, each needs an explicit {{< section_break >}}/{{< subsection_break >}} placed next to it to mark where numbering restarts:

{{< section_break >}}

# Results

{{< section_fig_caption "FigDoseResponse" "Dose-response curve" >}}

{{< subsection_break >}}

## Subgroup Analysis

{{< subsection_fig_caption "FigSubgroup" "Subgroup analysis" >}}

Used after an {{< appendix >}} call instead, they nest that appendix’s own designator in too (“Figure C.3.1”), so a figure numbered mid-appendix never reads as though it belongs to the main body’s own third section. scoped_crossref resolves any of these six shortcodes’ bookmarks. See the extension’s own README for the full shortcode list.

Continuous (“Figure 1”) and scoped (“Figure 3.1”) numbers are two entirely separate counters – a continuous “Figure 2” has no relationship to a scoped “Figure 2.1” that happens to share a leading digit, or to any particular section. Mixing both conventions for the same figure/table type in one document is legal but reads as though the numbers relate when they don’t; pick one convention per type and use it throughout. Appendix-scoped numbers (“Figure C.1”) don’t have this problem – the letter already marks them as a different sequence. See the extension’s own README for the full explanation.

None of these six show up in fig_caption/tbl_caption’s own .list_of_figures/.list_of_tables div (above). For a combined list that does include them – alongside the continuous captions, in true document order – use .quartifyr_list_of_figures/ .quartifyr_list_of_tables instead:

::: .quartifyr_list_of_figures
:::

::: .quartifyr_list_of_tables
:::

Additive, not a replacement – .list_of_figures/.list_of_tables themselves keep working unchanged. See the extension’s own README’s “Combined List of Figures/Tables” section for how it’s built.

Page header/footer and page numbering

project: "ACME-001"
report_number: "RPT-2026-014"
header-format: "{project} - {report_number}"

Everything here requires quartifyr-styling apply-layout / styling_apply_layout() (run automatically by render_report()); an independent second header/footer means adding new parts to the docx package, which a Lua filter’s RawBlock injection can’t do. Without that step, header-format:, confidentiality:, and {{< body-start >}} are all inert: no error, just no visible effect. See Styling’s apply-layout section for what it adds.

A pStyle gotcha (if you’re extending this extension)

<w:pStyle w:val="..."> must reference a style’s ID (e.g. Heading1, TableGrid, no spaces), not its display name (Heading 1, Table Grid). Word/LibreOffice render the display-name form visually fine via a fallback lookup, which makes this easy to miss, but Word’s ToC field silently fails to recognize such a paragraph as a heading at all, and a wrong table style reference silently drops the reference-doc’s customized borders/shading.

The opposite is true from the .qmd body. Pandoc’s custom-style Div attribute matches by a style’s name (Heading 1, with the space), not its ID. Get this backwards and pandoc doesn’t error: it silently fabricates a new, blank style with that literal name, so the text renders in plain body formatting with no indication anything’s wrong.

Styling

Pair with a docx reference-doc: generated by the Python engine so the Title/Subtitle/Heading N styles this filter emits actually carry your org’s fonts/colors.