# dfg-crc — Collaborative Research Centre proposal class

Current release: **0.4.0 (2026-11-24)**.

Release 0.4.0 extracts eight reusable LaTeX packages for plots, workpackages,
timelines, distributions, registered icons, bibliography highlighting, and
the thumbindex. The class uses the same packages as standalone documents.
The manual includes complete examples and DTX-style command/option references.

The `dfg-crc` LuaLaTeX class provides the proposal and CV structure for a
German Research Foundation (DFG) Collaborative Research Centre (CRC). It uses
structured metadata to generate project heads, staff and funding tables,
project lists, collaboration plots, Gantt charts, and proposal-wide totals.

This is an independent, unofficial template. It is not published, endorsed,
or maintained by the DFG; applicants remain responsible for checking the
current DFG forms and programme rules.

The PDF manual combines this introduction with the detailed user and code
documentation. Its Change history appendix is generated by LaTeX from
`\changes` entries in the documented source.

The supplied proposal template is designed for five calendar years and
supports one or more applicant universities. The project types `research`,
`service`, `mgk`, and `admin` are supported; see the documentation for the
corresponding metadata and generated sections.

It is appreciated when in the colophon of your proposal a reference to this
template and its author is given.

## Requirements

The class requires LuaLaTeX and a LaTeX kernel dated 2022-06-01 or newer.
Biber is required for bibliographies. The default setup uses Arimo, Roboto
for the explicitly configured sansserif font variants, and the example
images supplied by the `mwe` bundle. A full
[TeX Live](https://tug.org/texlive/) installation is recommended and contains
the class's runtime dependencies.

Repository: <https://gitlab.git.nrw/rpdm/projects-and-services/dfg-crc-template>

Issue tracker:
<https://gitlab.git.nrw/rpdm/projects-and-services/dfg-crc-template/-/issues>

## Installation

TeX Live and MiKTeX installations obtained after the first CTAN release can
install `dfg-crc` through their normal package managers. To install from the
CTAN source archive manually, run:

```
luatex dfg-crc.ins
```

This generates `dfg-crc.cls`, its independent `dfg-*.sty` module packages,
the standalone guide `dfg-modules.md`, and sixteen complete
`dfg-*-example.tex` documents with their companion data and build helper.
The PDF manual starts with the proposal/CV user guide, followed by the
implementation reference and the independent package chapters. Keep the class and packages together
beside the proposal's main `.tex` file, or install them in a TeX search directory. The complete generated example
proposal is maintained in the repository and can be extracted with
`make files`.

## Start the program from the repository

For a first local compile, generate the derived files and then compile the
proposal and CV examples from the `local/` folder.

```
make files
cd local
latexmk -lualatex crc-proposal.tex
latexmk -lualatex crc-cv.tex
```

The class is designed for LuaLaTeX. Use `lualatex` or `latexmk -lualatex`;
do not call `LaTeX` with a capital `L`.

Keep static metadata as plain text and apply presentation settings in tables
or reference commands. Avoid formatting macros such as `\mbox`, `\textbf`
or `\emph` in IDs, person names and roles. Even one macro-valued person name
or role disables the name-disambiguation index for the entire person database,
causing a full scan for every PI reference. Macro-valued IDs also use the
original row lookup. These fallbacks can substantially increase every compile
pass. Use `firstname={Verena}` and control wrapping in the table layout.

The default base font size is KOMA-Script's nominal `11pt` setting.
Two-sided pages reserve 25 mm on the binding edge by default: a 20 mm inner
margin plus `BCOR=5mm`. Pass a different KOMA `BCOR` class option to adjust
the binding correction; `BCOR=8mm` gives 28 mm on the inner edge and a 162 mm
text block. The default 165 mm text block leaves a 20 mm outer margin for the
rotated thumb index and marginal notes.
The top and bottom margins are 20 mm and 15 mm, respectively. The footer is
included in the page layout; `footskip=12mm` leaves a 250 mm high text block.
Paragraphs have no first-line indentation and a 3.5 pt gap
(`3.5pt plus 1pt minus 0.5pt`), configurable with KOMA-Script's `\setparsizes`.
To override settings for one project, put setup code in the optional argument
of its head, for example
`\printProject[\changeSettings{journalTitle=shortjournal}]{{Head}{B02}}`.
The matching `\printProject{{Tail}}` restores the previous settings. This
applies to settings read during rendering; bibliography styles and font-family
setup must still be configured before the class loads the relevant packages.
Projects with metadata `project-status=E` automatically use
`emphasizeAuthors=true,emphasizeEntries=false`. Explicit project setup runs
after these defaults and can override either setting.
By default, the thumb-index tabs span the text block from top to bottom and
divide its current height into equal slots. Set `thumbindex@topmargin` or
`thumbindex@bottommargin` to a page-edge distance to override either end.
Use `\changeSettings{thumbindex@orientation=inwards}` to turn the labels
180 degrees towards the text block. The default `outwards` points the tops
of the letters towards the outer page edge on both left and right pages.
Labels sit 2 mm towards the text block from the center of each tab.
Use `\printThumbIndex[bg=black!20,fg=black]{1}` to set the background and
label colours for one tab and its following pages. A bare colour remains
background shorthand: `\printThumbIndex[blue-100]{A01}` equals
`\printThumbIndex[bg=blue-100]{A01}`. Each call restores unspecified colours
from `color@thumbindex@bg` and `color@thumbindex@font`; overrides do not carry
over to the next tab or alter those configured defaults. With no options or
`[]`, both configured colours are used.
Tabs and their labels are drawn in the page background, below document text
and graphics. Tab positions are correct on the first LuaLaTeX pass; no extra
pass is needed for saved TikZ coordinates. The table of contents, cross-references and
bibliography may still require further compilation runs.
Project metadata accept an optional `short-title` alongside the full `name`.
Use `\changeSettings{projectTitle={runningHead=short}}` for short running-head
titles only. The independent `toc`, `runningHead` and `projectStart` choices
all default to `full`; `short` falls back to `name` when no short title is
provided. These settings also support local project setup overrides.
With `theme=main`, wrapped table remarks (including `\printTable[note=...]`)
have no hanging indent; continuation lines start at the remark's left edge.
Left-aligned table cells use standard `\raggedright` through the shared
theme setup; choose `halign=l`, `halign=c` or `halign=r` and keep `font`
for typography. Main-theme headers use `valign=m` for vertical centring,
including multirow headings.
Numbered section and subsection titles start at the same horizontal position
after a shared 12 mm number column. Section, subsection, and subsubsection
headings have one baseline of space above them; following text starts on the
next line without an additional blank line. The paragraph gap immediately
after a heading is rigid; ordinary paragraph gaps retain their stretch and shrink.
Tables, including `FundingDirectCostsTable` breakdowns, share the normal
subsection-to-text gap, including the requested-funding staff roster.
Direct-cost breakdowns can continue across pages between rows; their optional
unnumbered heading stays with the first row. Individual rows stay together.
The class derives it from the final document fonts and paragraph spacing.
Set a nonnegative `\dfgTablePreSep` in the customization file or preamble
(e.g. `\setlength{\dfgTablePreSep}{12pt}`) to use a fixed gap instead.
Do not insert `\null` before `\printTable`: its extra interline gap would
make the spacing inconsistent.

Add a call-specific table note with, for example,
`\printTable[note={Additional information.}]{{RequestedFunding}{A01}}`.
The footnote-sized `Note:` appears below the last part of the table, before
any roster legend or job descriptions. It adds to existing table notes;
`note={}` adds no text or spacing. Footnotes within a note retain their
text and hyperlinks in the normal page footer without a wrapper environment.
Notes can be combined with target options,
for example `\printTable[all-sexes,note={Additional information.}]{GenderEqualityProjectLeaders}`.

Personnel category names are written out by default. Use
`\changeSettings{categoryAbbreviations=true}` for compact English labels
such as Postdoc and Prof.; `false` restores the full names. This applies
to project funding tables, the Category column of the project staff roster,
and CV category fallbacks. In the staff roster, an omitted `positionText`
inherits the person's position text or uses the category label if no position
text is available. That automatic position label follows the same abbreviation
setting. Explicit or inherited `positionText` values retain their supplied text;
an explicitly empty roster value hides the position line. Metadata keep the
same category IDs in either mode.

Useful make targets:

> `make files`: extracts `dfg-crc.cls` and the local template files from
the documented source. <br>
> `make update-class TARGET_DIR=/path/to/proposal-worktree`: regenerates and
copies `dfg-crc.cls` and its `dfg-*.sty` packages into a separate Git worktree. <br>
> `make update-all TARGET_DIR=/path/to/proposal-worktree`: rebuilds and copies
`dfg-crc.cls`, `dfg-crc.pdf`, and the standalone
`dfg-crc-proposal-example.pdf` and `dfg-crc-cv-example.pdf` into that worktree. <br>
> `make test`: compiles the generated template test document. <br>
> `make test-table-notes`: checks table notes, option forwarding, pagination,
and early-career row styles and former-project references. <br>
> `make test-contract-information`: checks conditional PI contract dates and
funding sources for single and multiple project leaders. <br>
> `make test-plot-section-order`: checks collaboration/Gantt plots below their
> preceding headings at page boundaries, including both caption forms and fast
> project builds with images. <br>
> `make test-direct-costs`: compiles the focused two-pass regression for DFG
> table 2.1.1. <br>
> `make test-workpackage-metadata`: checks old and grouped WP keys, mixed-key
> precedence, empty labels, deferred values, headings and nested references in
> normal, focused/image and focused/text compilation.
>
> `make test-project-short-titles`: checks full/short selection independently
> in TOC, running heads and project-start titles, formatted values, missing/blank
> fallback, scoped setup and frozen two-pass TOC writes. <br>
> `make test-project-head-layout`: compares body positions and counters after
> recorded header placeholders, including page breaks, repeated fast builds and
> missing or outdated page dimensions. It checks that header metadata stay unloaded. <br>
> `make test-workpackage-references`: compiles the focused nested-work-package
reference and range-formatting regression. <br>
> `make test-aim-references`: checks custom aim labels, forward references,
plural references, ranges, and list option scope. <br>
> `make test-bibliography-highlights`: checks frame and project entry
highlighting, font sizes, options, and isolation from ordinary lists. <br>
> `make proposal-example`: compiles the generated local proposal example. <br>
> `make cv-example`: compiles the generated local CV example. <br>
> `make check`: runs the test and compiles both examples. <br>
> `make proposal-doc-example`: builds the complete documentation consortium proposal in final
mode as `dfg-crc-proposal-example.pdf`. <br>
> `make cv-doc-example`: builds the complete twelve-PI CV appendix in final
mode as `dfg-crc-cv-example.pdf`. <br>
> `make doc`: builds both PDFs first, then includes all their pages in the user
documentation, followed by the implementation reference. <br>
> `make ctan-check`: builds the curated CTAN archive and verifies a clean
installer extraction and minimal LuaLaTeX compile. <br>
> `make ctan-validate`: runs the official online CTAN validator without
submitting the archive.

For a focused project-text build, select the project with `\includeonly` and
use these class options:

```tex
\documentclass[
  fastcompile-project=true,
  fastcompile-project-show-images=false,
  fastcompile-project-show-publications=false,
  fastcompile-project-show-funding-tables=true,
  english
]{dfg-crc}
```

`fastcompile-project` skips metadata loading and most `\addEntry` execution,
calculated project heads, generated tables/lists and plots, embedded graphics,
and other front-matter work while retaining authored sections,
paragraphs, aims, work packages, labels, and citation commands. Skipped
generated tables and lists retain the same visible placeholder and
log note as ordinary `fastcompile` builds. Project identifiers in focused
fast compilation are red typewriter placeholders such as `<A03>`.

A normal build records each complete project header's occupied space in its
ordinary `.aux` file. Focused builds reuse that space for a single labeled
`<Q02-header>` placeholder, with one block on each page for a multi-page
header. They retain the following text's position and section numbering
without reading header metadata or laying out the real title, names, research
areas or contact details. Keep the auxiliary files when switching modes.
After changing header metadata, fonts or layout, run normally again until the
header layout settles. The record is a snapshot; fast mode does not inspect
those changes. A different text width or height rejects the snapshot. Without
a matching record, the placeholder reserves half of the current `\textheight`
and is explicitly marked `approximate half text height`. A warning identifies
the fallback; its space is then only an estimate.
For example, build once with `fastcompile-project=false` (repeat if the normal
PI-card layout still changes), then use the focused options above with the
same auxiliary files. No extra cache file or metadata declaration is needed.

Set
`fastcompile-project-show-images=true` to load the project metadata and render
images and generated plots encountered in the selected project while retaining
the other fast-mode reductions. Set
`fastcompile-project-show-publications=true` when the selected project's publication headings,
explicit `\nocite` entries, and bibliography should be included. Use
`\printProjectBibliography` for project publication lists; plain
`\printbibliography` uses biblatex's normal font and bypasses the
project-publication switch.

Journal names use `journaltitle` by default. Store an established abbreviation
in the standard BibLaTeX field `shortjournal` and select it with
`\changeSettings{journalTitle=shortjournal}`. Missing abbreviations fall back to
the full title. Use `\changeSettings{journalTitle=journaltitle}` to return to
full titles. The choice also applies to full citations, can be grouped locally,
and preserves the bibliography style's typography. It performs no online
lookups during compilation.

To use footnote-sized text and remove extra space between bibliography entries,
add this hook to `preamble/dfg-customization.tex` (outside `\changeSettings`):

```latex
\AddToHook{package/biblatex/after}{%
  \renewcommand*{\bibfont}{\normalfont\footnotesize}%
  \setlength{\bibitemsep}{0pt}%
}
```

The hook waits until `biblatex` has loaded because the customization file is
read earlier. `\bibitemsep` controls the extra gap between entries; change
`0pt` to `2pt`, for example, for a small gap. It does not change line spacing
within an entry. Without an override, the bibliography style supplies its
spacing; the alphabetic styles inherit the current `\itemsep` when
`biblatex` loads. Depending on the class and list configuration, this may
already be zero. Other styles can supply different defaults. The CV's
custom `DFGlist` already uses `nosep` and is configured separately through
its `itemsep` list option.

With `emphasizeEntries=true`, a full project bibliography entry is bold when
its `.bib` keywords include the current project ID followed by `-highlight`,
for example `B06-highlight`. One such keyword is enough even if two PIs from
Project B06 coauthor the entry. An entry may also carry another project's
highlight keyword when it should be bold in that project's list. The
`B06-project` keyword is optional project metadata; it does not trigger bold
type. Other keywords, including CV selectors such as `pabst-A`, can remain in
the same field. To use only whole-entry highlighting, set
`emphasizeAuthors=false` and `emphasizeEntries=true`.

For the frame-text references in chapter 1, use `\printFrameBibliography`
with the same options as `\printbibliography`. With `emphasizeEntries=true`,
entries tagged `frametext-highlight` are bold in this list. Project-specific
highlight keywords do not affect it, and the normal bibliography font size
is preserved. For example:

```latex
\changeSettings{emphasizeEntries=true}
\defbibnote{frame-references}{%
  \usekomafont{subsection}%
  \bfseries\sffamily References
}
\printFrameBibliography[prenote={frame-references},heading=none]
```

The `.bib` entry may combine keywords, for example
`keywords = {pabst-A,B06-highlight,frametext-highlight}`. The keyword selects
formatting only; cite the entry or use `\nocite` to include it as usual.
Existing chapter 1 files need the command replacement above because template
updates preserve edited chapter files.

Wrap optional
metadata and front matter with `\dfgIfFastCompileProjectF{...}` so those files
are not even read in this mode. With publications disabled, bibliography source
files and stale `.bbl` data are also left unread; inline citations display their
keys as lightweight drafting markers. The three project-local funding tables
remain visible by default. Set
`fastcompile-project-show-funding-tables=false` to suppress them too. Focused
mode processes their local rows and sums but does not restore or populate
proposal-wide overview databases. Compile a document using these options
with its own build command; the template Makefile deliberately operates only on
the generated test and example documents in `local/`.

## Template validation workflow

Run `make check` to regenerate the template files, compile the test document,
and compile both local examples. Run `make all` to perform those checks and
build the complete implementation and user documentation. These targets use
only files maintained or generated by this repository.

GitLab CI runs the same compile-based checks for branches and merge requests.
After a successful default-branch pipeline, GitLab Pages publishes the newest
generated `local/crc-proposal.pdf`. The Pages site is rebuilt from an empty
`public/` directory each time and therefore exposes only the latest dummy
proposal, not an archive of earlier PDFs. CI job artifacts retain the current
logs and example outputs temporarily for diagnosing failed pipelines.

## Updating a separate proposal repository

Edit the maintained `.dtx` source, then install the regenerated class into a
separately controlled proposal worktree:

```
make update-class TARGET_DIR=/path/to/proposal-worktree
# Or update the class, compiled manual, and complete example PDF:
make update-all TARGET_DIR=/path/to/proposal-worktree
```

Both targets verify that `TARGET_DIR` is the root of a different Git worktree,
copy the requested release files, and show their resulting Git status.
`update-class` copies `dfg-crc.cls` and its `dfg-*.sty` packages; `update-all` first rebuilds the manual
and then copies the class and packages, `dfg-crc.pdf`, and
`dfg-crc-proposal-example.pdf` and `dfg-crc-cv-example.pdf`. Neither
target overwrites the proposal repository's README, changelog, or licence. They
do not store the destination, inspect its remote, commit, or push. Review and
commit the updates from inside that proposal repository.

## Repository boundary

This repository is intentionally limited to the reusable proposal template.
Project-specific source, synchronization configuration, credentials, remote
identifiers, and private working copies must remain in separately controlled
repositories or local worktrees and must not be added here as submodules.

## Structure of the files and folders

The maintained source is `dfg-crc.dtx`.
Generated files such as `local/dfg-crc.cls`,
`local/test-existing-funds-direct-costs.tex`,
`local/test-project-collaboration.tex`,
`local/test-workpackage-references.tex`, `local/test-participating-institutions.tex`,
`local/test-command-options.tex`, `local/test-reference-lookups.tex`,
`README.md` and the local example files are extracted from that source.
Edit the `.dtx` for template or documentation changes, then regenerate the
derived files with `make files` or by building the documentation.

The manual uses `dfg-crc` itself, with `documentation=true` to load only its
explicit fictional fixtures. The DTX driver maintains executable `dfgExample`
boxes: code on the left, rendered output on the right. Add `[dfg wide]` for
wide results below their code. `make doc` regenerates the fixtures and compiles
the examples; incomplete setup fragments remain code-only. This does not
read or overwrite the manual scratch file `local/test.tex`.

The manual and local examples share the DTX `meta` records: twelve PIs, six institutions,
four affiliations, and fifteen active projects (A01--A06, B01--B06, Q01--Q03),
plus a former project. The embedded proposal uses these same metadata in
`local/`, with individual files for all fifteen active projects and the former
project A00. The local CV uses the same twelve PIs, with matching career records
and explicitly fictional publications for each person. Examples use `dfg project=A03` when they need the context
normally established by a project heading. Project overviews and the PI roster follow their code boxes at normal size
and may span pages; collaboration plots retain the available text width.

`make test-participating-institutions` checks flowing/raster column widths,
active-PI filtering, shared-institution deduplication, sorting, spacing above
columns, and option scope. `make test-command-options` checks omitted/empty,
leading/legacy options, precedence, grouped command specifications, mandatory
arguments, custom databases, boolean flags, and per-call defaults for lists,
tables, plots, and PI rasters. `make test-reference-lookups` covers generic
reference paths, branching ID lists, destination deduplication, diagnostics,
and focused-build placeholders.
`make test-animal-totals` checks custom animal types, grouped/separate
subtotals, direct count/cost queries, legacy rates, independent databases,
missing values, and pagination.

The standalone regression document is maintained in `ci/test-template.tex`.
`make test` copies it to `local/test-template.tex` before compiling it.
`local/test.tex` is reserved for manual experiments and is neither generated
nor compiled by the template checks.

## Generated project templates

The generated `local/content/03_project.tex` is a small master file that loads
separate, complete project examples. They are intended to be copied and adapted
rather than reduced to a list of headings:

`03_project_A01.tex`: continuing research project (`project-status=C`).

`03_project_A02.tex`: new research project (`project-status=N`).

`03_project_B01.tex`: second continuing research-project example.

`03_project_B02.tex`: ending project (`project-status=E`), including the report
bibliography, the three published-result categories, and the staff roster for
the ending funding period.

`03_project_Q01.tex`: continuing service project.

`03_project_Q02.tex`: continuing Integrated Research Training Group
(`project-type=mgk`), including existing funds, fellowships, and global funds.

`03_project_Q03.tex`: central administrative project with its dedicated
documentation and funding structure.

Every example starts with `\printProjectHead{<id>}`. That command already
generates the general-information heading, project title, project leaders, and
the applicable contract and legal-information blocks from metadata. The source
files therefore begin with the first status-specific authored heading: `Summary`
for active projects and `Project history` for ending projects.

The generated proposal-wide example follows the February 2026 continuation
template, including the ecological-sustainability section, separate
coordinating and co-applicant universities, the current legal-issues wording,
and one rector, chancellor, or president signature per applicant university.

> `bib/`: all bibliography files.  <br>
> `content/`: all files which are part of the actual content of the proposal,
e.g. all project textfiles.  <br>
>  `figures`: folder contains all figures of the projects.  <br>
>  `img`: folder can be used for logo files etc.  <br>
>  `metadata`: if you collect all database entries in specific external
  files, they are placed in this folder (e.g. `dfg-metadata.tex`).  <br>
> `preamble`: all files for the proposal and CV setup, especially
  `dfg-customization.tex` for customized things or re-newed settings.<br>

## Minimal metadata relationship

Most commands resolve data by following ids through the small databases:

```
person.ref-institution-id -> institution.id
institution.ref-affiliation-id -> affiliation.id
project.collaborations -> project.id
```

For example, a person may list one or more institution ids in
`ref-institution-id`. Each institution points to its parent affiliation via
`ref-affiliation-id`. Once this relationship exists, commands such as
`\printList{{Institutions}{<person-id>}}` can print the institution and affiliation
data without further manual wiring.  Each institution can also provide an
`abbreviation`; generated table cells use this compact label while descriptive
lists and legends retain the full `name`.

The same relationship is reused by `RequestedFundingStaff`: when a staff row
contains `ref-person-id`, its category and institution are taken from the
person's `position` and `ref-institution-id` fields unless the staff row
explicitly overrides them. The legend below the table prints each institution
once as `abbreviation: full institution name (affiliation abbreviation)`.
The note then expands affiliation abbreviations as
`affiliation abbreviation: full affiliation name`. All entries use semicolon
separators. Existing- and requested-staff tables share this footnote-size
`Abbreviations:` note, including its regular font weight and spacing.
A row without `ref-person-id` must provide
`ref-institution-id`; otherwise the class warns because it cannot resolve the
institution or assign existing staff to an affiliation in the proposal-wide
overview. Existing and requested non-research staff may omit
`field-of-research`; that empty table cell is then greyed out as not applicable
without a warning. Empty
staff positions are omitted without a warning or an empty line. The job
descriptions printed below each requested-funding staff table use flush-left
number labels and a hanging indent so continuation lines align with the first
line of description text. A normal interword space separates the bold name
from the description.

Project collaboration plots follow the comma-separated project ids stored in
each project's `collaboration` key (`collaborations` remains an alias).
Relations are undirected, so declaring
the same pair in both project rows is harmless but unnecessary. Ending,
reference-only, and list-excluded project rows remain available elsewhere but
are omitted from these plots.

## Information retrieval command overview

The following commands can be used directly in proposal text and tables. In
the signatures below, square brackets are optional and braces are mandatory.
The complete descriptions and examples are in
`dfg-crc.pdf`.

### General database access

Command `\get[database]{id}{field}` prints a metadata field. Add reference
steps to retrieve fields from linked rows, for example
`\get[person]{MM}{institution}{name}` or
`\get[person]{MM}{institution}{affiliation}{name}`. Each step follows
`ref-<database>-id`; the full key spelling is also accepted, as in
`\get[person]{MM}{ref-institution-id}{name}`. This works from any source
database, including named databases populated with a separate keyset.
Multiple reference IDs are followed in their stored order and the resulting
values are separated by commas. A destination row reached more than once is
printed only once; different rows with identical names remain separate.
Missing or empty references warn and contribute no value. The terminal field
keeps its formatting and `showtags` annotation. Focused fast compilation uses
the source ID placeholder, as with `\getEntry`. `\get*` retains the starred
multi-field assignment syntax of `\getEntry*`.

Command `\getEntry` with `[database]` `{id}` `{field}` `[id-field]` prints one field from one
  database row.

Starred command `\getEntry*` with `[database]` `{id}`
`{assignments}` `[id-field]` fetches several fields in one lookup and assigns
them without printing. For example, fetch person `MM` with
`\getEntry*[person]{MM}` and pass the third argument
`{\theFirstName=firstname,\theLastName=lastname}`.

Command `\compareEntry` with `[database]` `{id}` `{field}` `{value}` `{true}`
  `{false}` chooses text or
  code according to a field comparison.

### People, institutions, and projects

Commands `\getName` and `\getFullName*` with `{person-id}` print the last name or full name;
  the star adds the academic degree.

Command `\getPI*` with `{person-id-list}` `[text]` prints a linked PI reference; the star includes
  first names. Unstarred references distinguish shared PI surnames with the first given-name
  initial (K. Schneider / C. Schneider), or the full given name when initials also match.
  This rule applies across projects and funding periods, including project-first references.
  Explicit display text bypasses it; starred references retain full given names.

Command `\getORCiD` with `[database]` `{person-id}` prints a linked, formatted ORCiD from a person row.

Command `\getORCiDvalue` with `[database]` `{person-id}` stores the unformatted ORCiD in
  `\theORCiDValue`.

Command `\printList{{Institutions}{<person-id>}}` prints institutions and
  parent affiliations assigned to a person. Put formatting and database options
  before the specification, for example
  `\printList[database=person,abbreviation,narrow]{{Institutions}{MM}}`.

Command `\printList{ParticipatingInstitutions}` lists participating institutions
  across the proposal, with affiliation names in bold. Use `columns=2` (or
  `columns=3`, etc.) to flow whole affiliation groups down balanced columns.
  Short groups follow one another without being padded to the height of a
  neighbouring group. Groups stay together; reading order is down each column.
  `column sep=16pt` changes the gap (default: 12 pt). Flowing lists start a
  new paragraph with a medium vertical skip above the columns.
  The default layout remains a one-column raster, with 12 pt between columns
  and 10 pt between rows. For aligned rows, pass `raster columns=2` or another
  `tcbraster` option through the optional list argument. Sorting defaults to
  `order=count`; use `order=alpha` for alphabetical affiliation order. The
  legacy bare `count` and `alpha` options remain supported.

Put all list options before the specification, as with `\printPlot`.
Plain and grouped list names are both accepted. Older trailing options remain
supported; leading settings take precedence when the same key occurs twice.

```latex
\printList[columns=2]{ParticipatingInstitutions}
\printList[columns=3,column sep=16pt,order=alpha]{ParticipatingInstitutions}
\printList[order=alpha,raster columns=2]{{ParticipatingInstitutions}}
```

Command `\getPersonInformation` with `[database]` `{person-id-list}` prints complete formatted
  PI/contact-information blocks. Project heads use a full-width one-column raster
  for one PI and a two-column raster with a 12 pt column gap for several PIs.
  Both use the same spacing below the project-leader heading.

Command `\getPIsWithRole` with `[options]` `{role}` prints formatted current-period people
  carrying a given role. Put database and raster settings in the leading options,
  for example `\getPIsWithRole[database=person,raster columns=2]{PI}`.
  Use `\getPIsWithRole[academicdegree-below]{steering-committee-member}`
  to put the degree on a separate line below the name within the same PI box.
  The option applies only to that call; the default (or `academicdegree-below=false`)
  keeps the degree inline after the name.
  The default three-column raster has a 12 pt column gap;
  rows and the following content are separated by 20 pt. Explicit raster options
  can override that spacing.

PI-box titles are ragged right and top-aligned. All titles within one raster
reserve the height of its tallest title, so wrapped names or academic degrees
do not misalign the contact information. Recompile until the equal-height
layout settles; a clean build can require three LaTeX passes. Phone and email
stay individually unbroken, with a one-em gap that permits a line break
between them when they do not fit together.

Use `\getPIWithProject*` with `{person-id-list}` to print each PI with their
  assigned project identifiers in parentheses, without repeating the projects'
  PI names; the star includes first names. The older
  `\getPIProject` command remains available but warns that it is deprecated.

Use `\getProjectWithPI*` with `{project-id-list}` to print each project with
  its assigned PIs; the star includes first names. The older `\getProjectPI`
  command remains available but warns that it is deprecated. By default, the
  shared first `\getProject` or
  `\getProjectPI` reference to a project within one section includes its PIs;
  later references print only the project. Set
  `projectPIOncePerSection=false` in `\changeSettings` to repeat the PI names.

Command `\getPIofProject` with `[properties]` `{project-id}` `[delimiter]` prints selected PI name
  properties for one project. The starred form defaults to first and last names,
  separating earlier names with commas and only the last with “and”.

Command `\getProject*` with `{project-id-list}` `[text]` prints a linked project
  reference. The star always prints project identifiers only, independently of
  `projectPIOncePerSection`. Optional `text` replaces the displayed project number while
  retaining its link target and is best used with a single project. A
  reference-only project is marked and deliberately left unlinked. Multiple
  projects are joined with commas and a final `and` in prose, but use compact
  slash separators inside table cells, for example `A02/B01`. With the
  default `projectPIOncePerSection=true`, this command shares
  `\getProjectPI`'s first-reference PI expansion and per-section state.

Command `\getProjectCount` with `[area]` prints the active, list-considered
project count; omit `area` for all projects. Any explicit or ID-derived
`project-area` value is accepted.

Command `\printPlot{{collaboration}{A01}}` prints the default
full-width arc layout for A01, with project nodes and unlabelled area rules.
Its boxes align with the text edge on both sides of a two-sided page.
Its caption appears below the plot by default; a final optional argument adds
caption text.
Add `[arcs=true]` before the plot specification to draw the connecting arcs,
or use `[layout=heatmap]` for the heatmap. The optional
`project-area` field creates rows dynamically and falls back to the first
character of the project ID. Configure proposal-wide colors with
`collaborationAreaColors` and `collaborationAreaPalette` in `\changeSettings`,
or use the per-plot `area-colors` and `area-palette` options. Gantt charts use
the same dispatcher as `\printPlot{{gantt}{A01}}`. Inside a project, omit
the ID: `\printPlot{{gantt}}` and `\printPlot{{collaboration}}` use the
current project. Options precede the plot specification, for example
`\printPlot[caption={Additional details}]{{gantt}}` or
`\printPlot[arcs=true]{{collaboration}{B06}}`. With an explicit ID, use the
same leading caption option:
`\printPlot[caption={Additional details}]{{gantt}{B06}}`. The older `Gantt` and
`ProjectCollaboration` type names remain available. Use the singular
`collaboration` for the plot type, project metadata key, and local connection
override; `collaborations` remains a compatibility alias. The optional
`show-projects={A01,A02}` filters displayed nodes, always including the focus;
its former `projects` spelling remains an alias. In project source files,
`caption={}` marks where optional caption text can be added to either plot;
left empty, the default caption is still printed.
Use `plotOptions`, `ganttPlotOptions`, and `collaborationPlotOptions` in
`\changeSettings` to set shared and type-specific defaults, including native
`hvFloat` options such as `floatPos`, `capPos`, and `style`. Precedence is
built-in defaults, shared defaults, type-specific defaults, then per-call
options. For example:

```latex
\changeSettings{
  plotOptions={floatPos=!t,capPos=bottom},
  ganttPlotOptions={floatCapSep=8pt},
  collaborationPlotOptions={layout=heatmap,arcs=true}
}
\printPlot[capPos=top]{{gantt}{Q01}}
```

The class also supplies the native `hvFloat` style `proposalPlots`
(`floatPos=!t,capPos=top,floatCapSep=8pt`). Select it with
`\changeSettings{plotOptions={style=proposalPlots}}`; its definition is
provided by the class, so no hook is needed in customization.

Gantt charts always use `fig:gantt-<project-id>` as their figure label,
for example `\cref{fig:gantt-A02}`, with or without additional caption text.
This also applies to the compatibility command `\printGantt`.
Update older caption-free references such as `fig:ganttA02` to `fig:gantt-A02`.

Command `\dfgResearchAreasList` with `{code}` prints a DFG research-area code and its description.
`\printList{ResearchAreasFromProjects}` collects the codes from non-ending
research and service projects, matching the project tables. Projects excluded
from lists and explicitly excluded project numbers are omitted. Each call
rebuilds the list, sorts the codes, and removes duplicates.
The project tables center these codes as text in a 15 mm column, including
cells with several codes.

Commands `\getAim` and `\getWP` with `[project-id]` `{id-list}`
  cross-references to project aims or work packages; the current project is
  the default. `\getWP` places a narrow, unbreakable space after `WP` or `WPs`.

The `aims` environment accepts a custom prefix shared by the numbered items
and references:

```tex
\begin{aims}[label={RDM Aims}]
  \addAim{data} Document research data.
  \addAim{reuse} Publish reusable datasets.
\end{aims}
See \getAim{data,reuse}.
```

This prints `RDM Aims 1:` and `RDM Aims 2:`, with `RDM Aims 1 and 2` in
the reference. `\cref` and `\Cref` also use the custom prefix. Its text is
used unchanged for single and multiple references; ordinary `aims` lists
retain `Aim`/`Aims`. Other list options, such as `start=3`, remain available.
Compile twice after changing labels to update forward references.

Use `resume` to continue numbering from the previous `aims` list. Repeat
the custom label to keep it in both the items and their cross-references:

```tex
\begin{aims}[label={RDM Aims},resume]
  \addAim{archive} Archive the datasets for long-term access.
\end{aims}
See \getAim{archive}.
```

Following the two-item list above, this prints `RDM Aims 3:` and references
it as `RDM Aims 3`. `[resume]` alone continues the number with the default
`Aim`/`Aims` prefix. Numbering resumes from the previous `aims` list,
regardless of its label text; custom labels do not create separate counters.

### Person statistics

Command `\getPositionGenderPhaseAmount` with `[database]` `{position}` `{gender}` `{period}` prints the number
  of people for one position/gender/period tuple.

Command `\getPositionPhaseTotal` with `[database]` `{position}` `{period}` prints the all-gender total for a
  position and funding period.

Command `\getGenderPhaseTotal` with `[database]` `{gender}` `{period}` prints the all-position total for a
  gender and funding period.

Command `\getPositionGenderPhasePercentage` with `[database]` `{position}` `{gender}` `{period}` prints the
  rounded integer percentage within one position.

Command `\getGenderPhasePercentage` with `[database]` `{gender}` `{period}` prints the rounded integer
  percentage across all counted positions.

The optional database defaults to `person`. Counts include people whose
`role` list contains `PI` and whose `period` list contains the requested
funding period. The total-row commands sum `postDoc`, `groupLeader`,
`prof-W2`, and `prof-W3`. Gender is `f`, `m`, or `d`; percentages are rounded
integers without a percent sign and return zero when the denominator is zero.

```tex
\getGenderPhaseTotal{f}{1}
\getGenderPhasePercentage{f}{1}\%
\getPositionGenderPhaseAmount{prof-W3}{f}{1}
\getPositionGenderPhasePercentage{prof-W3}{f}{1}\%
\getPositionPhaseTotal{prof-W3}{1}
```

Change the last argument to `2` or `3` to query another funding period.
These commands are available independently of the current proposal period.
Section 1.4.2 B adds the first-period Number and Percentage columns only for
proposals with `fundingPeriodNumeral = {3}`. Maintain historical PI records
with their appropriate `period` membership to populate these columns.
The statistics count people; the share of projects with female leadership
requires a separate calculation.

The project-leader table defaults to the female-only DFG layout. For a
third-period proposal, periods 1 and 2 each show Number/Percentage; period 3
shows its original objective (from `future-objective-percentage-female`) and
current Number/Percentage. The person records' period-3 membership supplies
these current counts. Percentages always use all genders as the denominator.
Select the expanded f/m/d comparison, including third-period counts and
percentages alongside its objective columns, for a single table:

```tex
\printTable{GenderEqualityProjectLeaders}            % female-only DFG view
\printTable[all-sexes]{GenderEqualityProjectLeaders} % expanded f/m/d view
```

Each call starts in female-only mode; `[all-sexes]` affects only that table.
Put options before the table name. Combine `database=MyObjectives,all-sexes`
to use a custom
objectives database. The prose count and percentage commands are unaffected.

### Funding and staff totals

The similarly named funding commands have different scopes: names ending in
`RequestedFunding` use the proposal-wide overview by default, while names
ending in `RequestedFunds` use project-level funding rows and require a
project id.

Command `\getCountRequestedStaff` with `[project]` `{year}` `{category}` prints the requested staff
  quantity for a category, optionally restricted to a project.

Command `\getSumRequestedFunding` with `[database]` `{year}` `{type}` prints the proposal-wide total for one
  funding type and one year; `{all}` as the year totals all five years.

Command `\getTotalSumRequestedFunding` with `[database]` `{year}` `{type}` prints the proposal-wide total
  with `{all}` as the type available for a grand total.

Command `\getSumPreviousRequestedFunding` with `[database]` `{year}` `{fields}` prints the previous-period
  total for one year row, or all rows with `{all}` as the year.

Command `\getSumRequestedFunds` with `[database]` `{project}` `{type}` `{sum-fields}` prints the project total
  for one funding type and one or several `sum-yearN` fields.

Command `\getTotalSumRequestedFunds` with `[database]` `{project}` `{sum-fields}` prints the project total
  across all funding types for the supplied `sum-yearN` fields.

Command `\getSumRequestedFundsInstrumentation` with `[project]` `{sum-fields}` prints the instrumentation
  total, proposal-wide or for the optional project.

Command `\getSumRequestedFundingDirectCosts` with `[database]` `{year}` `{group}` prints the direct-cost
  total for `applicant`, `participant`, `other-funds`, or `all`. Its default
  database is the auxiliary-file-backed
  `RequestedAndExistingFundingDirectCostsOverview`, and its displayed result
  is a full euro amount without decimal places.

Command `\getSumExistingFunds` with `[database]` `{project}` `{sum-fields}` prints the existing direct-cost
  funding for a project and the supplied year fields.

Typical calls are:

```tex
\getProjectCount[A]                            % active A projects
\getSumRequestedFunding{all}{staff}            % proposal-wide staff total
\getTotalSumRequestedFunding{all}{all}         % proposal-wide grand total
\getSumRequestedFunds{A02}{staff}{sum-year1}   % A02 staff total, year 1
\getTotalSumRequestedFunds{A02}{sum-year1}     % A02 grand total, year 1
```

Funding entries, including requested instrumentation, use EUR as their input
unit. Their tables state `Figures in EUR.` and display whole euro amounts with
thousands separators. The non-aggregated `existingInstrumentation/cost` field
instead uses thousands of EUR and its table states `Figures in thousands`;
one decimal place is retained when supplied. Explicitly fractional
animal-housing rates and per-animal purchase prices also retain decimals.
The requested/existing funding columns remain whole euros.

### Laboratory-animal types and totals

The animal table derives its subtotals and grand total from its own rows.
Only represented groups appear. The built-in types are `mouse`,
`mouse-gnotobiotic`, and `rat`; gnotobiotic mice count toward `mouse`.
Declare additional types in `preamble/dfg-customization.tex`:

~~~latex
\DeclareAnimalType{zebrafish}{
  label={Zebrafish},
  label-plural={Zebrafish},
  housing-rate=0.12
}
\DeclareAnimalType{mouse-gnotobiotic}{total-group=mouse}
~~~

`total-group` names the type itself or an already registered type; that type
supplies the subtotal's plural label, without changing the row's own label or
housing rate.
When omitted for a new type, it defaults to that type's own ID. IDs use lowercase
letters, digits, and hyphens, starting with a letter. Redeclaring a type updates
only the supplied fields. New types require a label and a non-negative housing
rate in EUR per animal per week; the plural defaults to the label.
Declarations and rates respect TeX groups. Existing `animalHousing@...`
settings and `\dfgMouseHousing`/`\dfgRatHousing` accessors remain supported.

Keep existing `\addEntry{UpkeepLaboratoryAnimals}{...}` records and the usual
`\printTable{UpkeepLaboratoryAnimals}` call. To separate housing types, use
`\printTable[totals-by=type]{UpkeepLaboratoryAnimals}`. A custom database can
be selected with `database=MyAnimals`; the old bare `[MyAnimals]` argument also
works. All totals are rebuilt per call, using only that database's rows.
Funding totals sum the supplied requested/existing amounts, without inferring
them from animal counts or unit costs. Blank or invalid numbers print a dash;
affected subtotals/totals carry an asterisk and a note explaining that only
known valid amounts are included. Explicit zero is retained. A row without a
registered species remains visible and contributes to `Unclassified`.

Read counts and costs directly after declaring the data, without printing a table:
~~~latex
\getAnimalCount                       % All animals
\getAnimalCount[group=mouse]          % Mouse group, including gnotobiotic mice
\getAnimalCount[type=mouse]           % Only the mouse type
\getAnimalCosts[group=mouse,cost=requested] % Default cost selection
\getAnimalCosts[group=mouse,cost=existing]
\getAnimalCosts[group=mouse,cost=purchase]
\getAnimalCosts[group=mouse,cost=housing]
\getAnimalCosts[group=mouse,cost=total]
~~~
Both commands accept `database=MyAnimals` and either `group` or `type`.
Omit the selector for the entire database. Purchase costs are quantity times
unit purchase price; housing costs are quantity times weeks times each row's
own housing rate. `total` combines these calculated costs. Requested/existing
funds remain the supplied amounts. Funding displays use whole EUR; calculated
costs retain up to two decimal places. Add the currency unit in surrounding text.
Missing inputs mark partial results with an asterisk; only known components
are summed. Unknown IDs/options produce a warning and a dash.

### Existing direct-cost support in section 2.1.1

Declare institutional and other existing direct-cost support once, next to
the corresponding project table:

```tex
\addEntry[funding]{RequestedAndExistingFundingDirectCosts}{
  ref-project-id     = {B06},
  ref-affiliation-id = {aff1},
  financed-by        = {Faculty core support},
  sum = {
    year1 = {5000},
    year2 = {5000},
    year3 = {5000},
    year4 = {5000},
    year5 = {5000}
  }
}
```

The sums are stored and displayed in euros. Table 2.1.1 therefore prints
`5000` as `5,000`; monetary values are rounded to the nearest euro for display
and never acquire a redundant decimal part. An affiliation listed in
`meta/crc.ref-affiliation-id` contributes to the applicant-university column;
another affiliation contributes to the other-participating-institutions
column; and the special value `other-funds` contributes to Other funds.
`financed-by` is the human-readable funding-source description and does not
select the aggregate column.

The declarations may remain in project files even though section 2.1.1 comes
earlier. They are restored into a separate overview database through the
LaTeX auxiliary files. A normal multipass build such as `latexmk` is therefore
required after adding or changing a row; no duplicate chapter-2 declaration
is needed.

## Open-access markers in bibliography entries

The class loads `biblatex-ext-oa` so bibliography entries can show
open-access markers in final documents. The DOI API integration is only
available with LuaLaTeX. With LuaTeX 1.17.0 or newer, the socket library must
also be enabled on the command line, for example with `lualatex --socket`.
Provide the contact address required by the API in the customization file:

```tex
\changeSettings{
  doiAPIMail = researcher@example.org
}
```

The class enables DOI lookups only when `final=true`, `doiAPIMail` is not
empty, and LuaSocket is available. Otherwise it retains manual open-access
annotations without making network requests.

The open-access symbol links to the detected accessible version. The class
suppresses the package's additional `open access version at` text and URL;
ordinary DOI, eprint, and URL output follows the bibliography style. The
suppression is applied only when the DOI API backend is enabled.

If the API-based open-access request does not work for a publication, add the
manual fallback annotation to the relevant `.bib` entry:

```
options         = {openaccess=auto},
doi+an:default  = {=openaccess},
```

## Troubleshooting

Use `latexmk -lualatex ...` or `lualatex ...`. The command `LaTeX` asks TeX for
a format named `LaTeX.fmt` and will usually fail.

If you see `Not allowed in LR mode`, check whether vertical material such as
`\vspace`, `\addvspace`, or a paragraph break was inserted inside a table cell
that only accepts horizontal material. Prefer the documented commands and
options instead of adding raw vertical spacing in table cells.

`Unknown database name` means the requested database has not been loaded or the
database name was misspelled. Check the relevant file in `metadata/` and make
sure it is input by the document class.

Missing-key or empty-value warnings mean the row exists, but the requested
field is empty. This is intentional for fields where the template needs to
alert you, such as missing ORCiD values.

If a change has no visible effect, check which `dfg-crc.cls` is being used.
Regenerate the class and local examples with `make files`, then compile the
relevant example again.

## Maintainer release checklist

1. Update `\dfgVersion`, `\dfgVersionDate`, the README release line,
   add a `\changes{version}{date}{description}` entry, and update
   `dfg-crc.pkg` in one commit.
2. For CTAN updates after the initial release, set `\update{true}` in
   `dfg-crc.pkg`. Keep the CTAN path
   `/macros/luatex/latex/dfg-crc`, and omit `\home` when it duplicates
   the repository URL.
3. Do not include the generated `dfg-crc.cls` in the CTAN archive. CTAN
   requires files generated from a documented source and installer to be
   omitted; the PDF manual and example PDF are documentation exceptions.
   Licensing is recorded at the top of the DTX; change history is generated
   with `\changes` and included in the manual. Do not ship separate
   generated changelog or license files.
4. Confirm that `bossert@itc.rwth-aachen.de` is registered as the second
   address of CTAN member `lukascbossert`. Keep release information in
   separate Announcement and Note fields; CTAN explicitly accepted that
   structure for the initial release.
5. Build the documentation and the CTAN archive, then run the portable
   installer and minimal-class smoke test:

   ```
   make ctan-check
   ```

6. Run at least one proposal/CV smoke build from `local/`:

   ```
   cd local
   latexmk -lualatex -g -halt-on-error crc-cv.tex
   ```

7. Before a public release, run the complete template check:

   ```
   make check
   ```

8. Run the official online validator with
   `make ctan-validate`.
9. Review `git status --short`, `git diff --check`, and the archive file
   list before committing and tagging the exact release version.

## Support

The current maintainer is
[Lukas C. Bossert](mailto:bossert@itc.rwth-aachen.de).

## License

This material is subject to the LaTeX Project Public License 1.3c or later.
The work has the LPPL maintenance status *maintained*. The complete notice
is at the top of `dfg-crc.dtx`; the current
maintainer is Lukas C. Bossert.
