Skip to content

Fix oup_v1 render failure after upstream CTAN \authormark removal#604

Merged
cderv merged 7 commits into
mainfrom
fix-oup
May 15, 2026
Merged

Fix oup_v1 render failure after upstream CTAN \authormark removal#604
cderv merged 7 commits into
mainfrom
fix-oup

Conversation

@cderv
Copy link
Copy Markdown
Collaborator

@cderv cderv commented May 15, 2026

Rendering oup_v1 (and all R-CMD-check jobs that exercise it) fails on fresh TinyTeX installs:

! Undefined control sequence.
l.241 \authormark
                 {Alice Anonymous et al.}

Root cause

The January 3 2026 CTAN release of oup-authoring-template v1.2 removed the \authormark macro definition (the cls file's internal \lastmodifieddate is 2025/11/17, but CI broke when the package was published on CTAN and TinyTeX started auto-installing the new version).

\authormark was an internal macro of the class, never part of its documented public API. The rticles oup_v1 template still emitted \authormark{...} for the running head, so every render fails on TinyTeX (which auto-installs the latest CTAN version at render time).

The documented running-head mechanism in v1.2 is the optional argument of \title (\title[short]{long}), which the template already uses (\title[$short_title$]{$title$} in template.tex:340). That routes through \short@title\titlemark, never through the path that calls \authormark. OUP's own example file on CTAN no longer references \authormark either.

A structural diff of v1.1 → v1.2 confirms \authormark is the only macro definition removed; ~40 new macros were added (sideways figures/tables, box environments, \figalttext, \wordcount, etc.), none required by our template.

Fix

Drop the template block that emitted \authormark{...}. On TeX Live ≤ 2024 (cls v1.1), the only visible effect is that the even-page running head changes from "Author et al." to the short title — which is what OUP's v1.2 docs now prescribe on both pages anyway.

The YAML authormark key was undocumented but accepted by the Pandoc template before this change, so users who discovered it would silently lose the value after the upgrade. Add a pre_knit hook — mirroring the pattern in ams_article(), tf_article(), and the springer warning in R/article.R — that warns at render time when YAML still sets authormark.

Verification

End-to-end local render with the patched template against a freshly auto-installed v1.2 cls produces a valid PDF (no LaTeX errors).

Tests added:

  • Unit tests for the pre_knit hook (warns on authormark, silent on unrelated metadata).
  • A render-based test (knit-only, run_pandoc = FALSE) covering the rmarkdown→hook wiring end-to-end.
  • Regression guard asserting the template no longer contains the literal \authormark string.

Fixes #603

cderv added 7 commits May 15, 2026 14:19
The November 2025 update to oup-authoring-template.cls on CTAN (v1.2)
removed the \authormark macro definition while still referencing it
from the class' own \@@title. Documents using the rticles oup_v1
template fail to compile with "! Undefined control sequence \authormark"
because the template emits \authormark{...} for the running head and
the class no longer defines it.

Add a \providecommand\authormark[1]{} fallback so rendering works
whether or not the upstream macro is available.
Replaces the no-op \providecommand fallback with simply removing the
template block that emitted \authormark{...}. \authormark was an
internal macro of oup-authoring-template.cls that was never part of
the class' documented public API, and it was removed in the v1.2
update (17 November 2025).

The documented running-head mechanism in v1.2 is the optional argument
of \title (\title[short]{long}), which the template already uses. This
matches OUP's own example file on CTAN, which no longer references
\authormark either.

Cosmetic side effect on TeX Live <= 2024 (cls v1.1): the even-page
running head changes from "Author et al." to the short title, which
is what OUP's v1.2 docs now prescribe on both pages anyway.
Mirrors the existing pattern in `ams_article()`, `tf_article()`, and the
springer-related warning in `R/article.R`: attach a `pre_knit` hook that
checks the parsed YAML metadata and emits an immediate warning when the
user supplies a field that is no longer wired up.

Since the YAML `authormark` key was undocumented but accepted by the
oup_v1 Pandoc template before this fix, users who discovered it would
otherwise silently lose the value after the upgrade. The warning makes
the removal visible.

Adds three testthat tests:
- warning fires when metadata contains `authormark`
- no warning for unrelated metadata
- template no longer contains the literal `\authormark` string (guards
  against re-introduction)
The direct `fmt$pre_knit(...)` unit test verifies the warning logic but
not that rmarkdown actually invokes the hook with the parsed YAML
metadata. Add a knit-only render (run_pandoc = FALSE) of an Rmd whose
YAML sets `authormark`, asserting the warning surfaces — covers the
hook-wiring contract regardless of rmarkdown internals.

Skips when pandoc <2.10 (the format already requires it).
`oup_article(oup_version = 1)` rejects construction below pandoc 2.10,
so the direct pre_knit unit tests can't even build the format object on
older runners. Mirrors the existing skip on the render-based test in
the same file, and matches the package-wide convention in
`tests/testit/test-formats.R` where `oup_v1` is skipped under the same
constraint.
@cderv cderv merged commit 2e55e74 into main May 15, 2026
19 checks passed
@cderv cderv deleted the fix-oup branch May 15, 2026 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI: oup_v1 render fails with '! Undefined control sequence \authormark' after upstream CTAN update

1 participant