Skip to main content
Version: 0.5.0

Dynamic Reference Signs

The references module provides a rich set of helper functions and preset packages that automatically fetch, format, and translate document metadata for display in the invoice's reference / Leitzeichen block.

This offers fine-grained control over which fields are displayed, their layout order, custom label or value overrides, and automatic omission of unpopulated fields.

Importing the Moduleโ€‹

The references module is exported directly from the package root:

#import "@preview/invoice-pro:0.5.0": invoice, references

Preset Packagesโ€‹

Preset packages bundle the most common reference combinations for specific business workflows. Any reference field that resolves to none is automatically omitted, so you can use presets safely without worrying about empty fields appearing on the invoice.

Every preset prints what the law requires on an invoice besides the parties and the items (ยง 14 Abs. 4 UStG in Germany, Art. 226 of the VAT Directive): the date of the supply (service-time), the seller's tax number and VAT ID and the buyer's VAT ID (seller-tax-nr, seller-vat-id, buyer-vat-id, which on a self-billed invoice are the recipient's and the sender's) and the payee, each if it is given. Earlier versions printed none of them with preset-din-5008.

references.preset-b2bโ€‹

The standard reference configuration for business-to-business invoicing.

references: references.preset-b2b()
// Evaluates to: [invoice-nr, customer-nr, order-nr, invoice-date, service-time, due-date, seller-tax-nr, seller-vat-id, buyer-vat-id, payee]

references.preset-b2gโ€‹

Optimized for public administration and government procurement (B2G / XRechnung / Peppol).

references: references.preset-b2g()
// Evaluates to: [invoice-nr, buyer-reference, order-nr, invoice-date, service-time, due-date, seller-tax-nr, seller-vat-id, buyer-vat-id, payee]

references.preset-projectโ€‹

Tailored for agencies, freelancers, and service contractors billing against specific projects.

references: references.preset-project()
// Evaluates to: [invoice-nr, customer-nr, project, invoice-date, service-time, due-date, seller-tax-nr, seller-vat-id, buyer-vat-id, payee]

references.preset-din-5008โ€‹

Follows the classical German DIN 5008 business letter Leitbereich structure ("Ihre Zeichen / Ihre Nachricht vom / Unsere Zeichen / Tag"), followed by what the law requires on an invoice.

references: references.preset-din-5008()
// Evaluates to: [order-nr, order-date, contact-person, invoice-date, service-time, seller-tax-nr, seller-vat-id, buyer-vat-id, payee]

Available Reference Signsโ€‹

All reference builders accept optional label and value parameters (e.g. references.order-nr(label: "PO #", value: "PO-123")). If left as auto, both the label and value are automatically retrieved, formatted, and localized based on the document context and active locale.

Document & Coreโ€‹

FunctionDefault Source / LogicDescription
references.invoice-nrctx.invoice-nrInvoice identifier / number.
references.invoice-datectx.invoice-date (date)Invoice issue date, formatted according to locale.
references.due-datectx.due-date or derived from #payment-goal()Payment deadline date.
references.service-timeThe invoice's service-period, else the earliest and latest date of the itemsPeriod or date of service delivery, as the e-invoice states it (BT-72 / BG-14). Items without a date do not count; the invoice date is used if no item has a date, except on a credit note or a prepayment invoice, which then print none. A value given as a datetime or a period (start, end) is printed in the date format of the locale. The e-invoice compares the printed service period with the one it states (IP-PERIOD-01), whatever its label.

Customer & Recipientโ€‹

FunctionDefault Source / LogicDescription
references.customer-nrctx.customer-nr, recipient.customer-nr, or recipient.idCustomer account or client identifier. An identifier of the id module (e.g. id: id.gln(..)) prints its id.
references.buyer-referencerecipient.buyer-reference or recipient.leitweg-idBuyer reference or Leitweg-ID (EN 16931 BT-10).
references.recipient-vat-idrecipient.vat-idRecipient's VAT identification number (essential for EU Reverse Charge).
references.recipient-tax-nrrecipient.tax-nrRecipient's national tax number.

Orders, Projects & Procurementโ€‹

FunctionDefault Source / LogicDescription
references.order-nrctx.order-nr, recipient.order-nr, or po-nrCustomer purchase order / PO number (BT-13).
references.order-datectx.order-date or recipient.order-dateDate the order was placed.
references.projectctx.project or ctx.project-nrProject name or tracking reference (BT-11).
references.contract-nrctx.contract-nr or recipient.contract-nrFramework agreement or contract number (BT-12).
references.quote-nrctx.quote-nr or ctx.offer-nrPreceding quotation or estimate reference number.
references.delivery-note-nrctx.delivery-note-nr or recipient.delivery-note-nrDespatch advice / delivery note number (BT-16).
references.delivery-addressctx.delivery-address or recipient.delivery-addressSeparate delivery / shipping destination address (BG-13 / BT-56-79).
references.preceding-invoice-nrctx.preceding-invoice-nr or original-invoice-nrPreceding invoice reference for credit notes or correction invoices (BT-25).
references.preceding-invoice-datectx.preceding-invoice-dateDate of the preceding invoice, formatted according to locale (BT-26).

Sender, Contacts & Bankingโ€‹

FunctionDefault Source / LogicDescription
references.tax-nrsender.tax-nrSender's tax identifier.
references.vat-idsender.vat-idSender's VAT ID.
references.seller-tax-nrsender.tax-nr, or recipient.tax-nr on a self-billed invoiceThe seller's tax number (BT-32), which the law requires on the invoice unless its VAT ID is printed (ยง 14 Abs. 4 Satz 1 Nr. 2 UStG), with the label of the party it belongs to.
references.seller-vat-idsender.vat-id, or recipient.vat-id on a self-billed invoiceThe seller's VAT ID (BT-31, Art. 226 No. 3 VAT Directive), with the label of the party it belongs to.
references.buyer-vat-idrecipient.vat-id, or sender.vat-id on a self-billed invoiceThe buyer's VAT ID (BT-48), which a reverse charge and an intra-community supply state (Art. 226 No. 4).
references.payeepayee.nameWho receives the payment instead of the seller, e.g. a factoring company (BG-10).
references.payment-referencebank-details reference / text, ctx.payment-reference, or ctx.invoice-nrBank transfer purpose (Verwendungszweck), identical to the bank details and ZUGFeRD BT-83.
references.contact-personsender.contact.name, sender.contact-name, or clerkName of the clerk or account manager who issued the invoice.
references.contact-phonesender.contact.phone or sender.phoneDirect telephone number of the contact person.
references.contact-emailsender.contact.email or sender.emailEmail address of the contact person.

Customizing Labels & Valuesโ€‹

All reference builder functions can be customized with explicit overrides:

// Custom label with automatic value resolution:
references.customer-nr(label: "Client ID")

// Custom value with automatic label translation:
references.order-nr(value: "PO-2026-99")

// Complete override:
references.due-date(label: "Pay Before", value: "31.12.2026")

Usage Stylesโ€‹

You can pass references using three flexible patterns:

1. Using a Preset Packโ€‹

#show: invoice.with(
references: references.preset-b2b(),
customer-nr: "KD-12345",
order-nr: "PO-9988",
// ...
)

2. Ordered Array (Custom Selection & Order)โ€‹

Array elements can be builder functions, preset packs, or static (label, value) tuples. Elements with none values are automatically filtered out.

#show: invoice.with(
references: (
references.invoice-nr(),
references.customer-nr(),
references.order-nr(),
("Custom Note", "Approved by Management"),
references.due-date(),
),
// ...
)

3. Key-Value Dictionaryโ€‹

#show: invoice.with(
references: (
"Our Reference": references.invoice-nr,
"Your Account": references.customer-nr,
"Direct Dial": references.contact-phone,
),
// ...
)