Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider adding a macro for semantic cross references #4937

Closed
JohelEGP opened this issue Sep 26, 2021 · 3 comments
Closed

Consider adding a macro for semantic cross references #4937

JohelEGP opened this issue Sep 26, 2021 · 3 comments
Assignees

Comments

@JohelEGP
Copy link
Contributor

JohelEGP commented Sep 26, 2021

#4936 shows that when wording is refactored, it is necessary to manually keep in sync cross references, and that unfortunate references are left semantically dangling. For that particular case, #4832 was going to copy some dangling references. #4866 also fixed references to that subclause within [basic].

It seems like there is benefit to be found in a macro for doing semantic cross references. This means that they refer not to a fixed subclause label, but something closer to what is semantically cross referenced. The obvious candidate for this are indexed entities.

I am thinking of something along the lines of

\reference{matter involving an \grammarterm{id-expression}}{\grammarterm{id-expression}}

Is it possible to do that with LaTeX?

@jensmaurer
Copy link
Member

jensmaurer commented Sep 26, 2021

Is it possible to do that with LaTeX?

Conceptually, what we need is a way to add \refs (or \irefs) to a named list of things in a first LaTeX pass, and then we expand a macro to that list in a later pass (not unlike what \ref does in the first place). We would then use a special marker when we use (e.g.) "unevaluated operand" in a way that complements the definition, and that special marker would add to the named list.

I don't think we should tie this to indexed things too tightly; we'd like to keep the option to index mentions of a term that we don't want to cross-reference like that.

@godbyk , any pointers would be much appreciated.

@jensmaurer
Copy link
Member

I've misunderstood the original desire, I believe. It seems just \label and \ref will do what we want.

@jensmaurer
Copy link
Member

Documented on the styles wiki:

For some defined terms (e.g. "odr-use"), we customarily add a cross-reference after a use of the term. In order to make that cross-reference stable against section moves of the definition of the term, create a \label{term.this.name} at the start of the paragraph defining the term, and use \ref or \iref referencing term.this.name`.

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

No branches or pull requests

2 participants