quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.98k stars 328 forks source link

Option for parentheses around equation numbers reference in addition to `eq-prefix` #2439

Open cderv opened 2 years ago

cderv commented 2 years ago

Discussed in https://github.com/quarto-dev/quarto-cli/discussions/2413

Originally posted by **jordan-melendez** September 12, 2022 In certain journals it is common to format references to equations like `Eq. (1.1)` with parentheses around the equation number. Quarto supports modifying `Eq.` with `eq-prefix`, but would it be possible to either 1. Add a parameter similar to `eq-prefix` that allows one to customize the reference further, and/or 2. Ensure that, when compiled to PDF, `\eqref` gets used rather than `\ref` for equation references. This would require `amsmath` I suppose, but would automatically add parentheses and permit further customization. Thanks!
cderv commented 2 years ago

Some notes:

\eqref is defined in amsmath, and seems widely use for referencing equation as it adds the parenthesis (https://en.wikibooks.org/wiki/LaTeX/Labels_and_Cross-referencing#eqref). Maybe we could add an option so that \ref can be replaced by \eqref for equations ? https://github.com/quarto-dev/quarto-cli/blob/c16212ca786f4c915af8fa3ab938f6ba66959aa3/src/resources/filters/crossref/refs.lua#L68-L70

This would be for LaTeX output only, possibly useful in Quarto Journals - Allowing to tweak that through a Lua filter could also be a way to solves this for PDF only.

More generally, support parenthesis around reference for equation in HTML and PDF requires some specific formatting work for HTML outputs.

cscheid commented 2 years ago

Re-milestoning it to match the rest of our crossref work (even if we eventually choose to move it to 1.3, this seems like a natural thing for us to support)