Skip to content

include-in-header recipe may leave \v as the LaTeX caron accent, contrary to README (unverified) #88

Description

@d-morrison

Claim

Under the include-in-header: macros.qmd recipe that README.md:55 recommends for PDF ("definitions go into the preamble and all macros work"), \v specifically may not work: LaTeX's fontspec/unicode-math encoding setup re-establishes \v as the built-in caron/háček accent at \begin{document} time, after the preamble's \renewcommand{\v}[1]{\vecf{#1}} has run — so \v{x} produces no vector notation at all.

The {{< include >}} shortcode recipe is unaffected, because pandoc's latex_macros extension expands \v{x} to \tilde{x} in the document body before LaTeX ever sees it. d-morrison/rme uses the shortcode recipe (via chapters/shared-config.qmd), so it is not exposed.

Status of this report

Not independently reproduced. This surfaced as a side observation from a review subagent working on #87, which reported reproducing it with real quarto + lualatex. I am filing it rather than dropping it, but the reproduction should be redone before anyone acts on it.

What I did measure directly, and which makes the mechanism plausible: pandoc expands macros only when they are defined in the same document. Appending $\v0$ $\v1$ to a file with no definitions present gives verbatim \v0 \v1 out of quarto pandoc -t latex. include-in-header content is not in the document body, so the expansion pass that protects the shortcode recipe does not run for it — which leaves \v to LaTeX, where the accent-vs-macro conflict is real.

Why it matters beyond \v

\v is unusual in being the only macro in macros.qmd whose name collides with a LaTeX built-in, which is also why it needed \renewcommand rather than \providecommand in the first place. If the mechanism above holds, any such future collision would behave the same way, and the README's "all macros work" would be wrong in a way that is silent — no error, just missing notation.

Suggested next steps

  1. Reproduce: minimal Quarto doc, include-in-header: macros.qmd, format: pdf, body containing $\v{x}$, and check the output.
  2. If confirmed, either qualify the README claim, or make macros.qmd re-assert \v at \begin{document} (\AtBeginDocument{\renewcommand{\v}[1]{\vecf{#1}}}).

Pre-existing; not introduced by #87, which is a strict improvement on this axis (it removes the \def\v1 that broke \v on both recipes).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions