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

\defnc and \defna #3880

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

\defnc and \defna #3880

wants to merge 2 commits into from

Conversation

opensdh
Copy link
Contributor

@opensdh opensdh commented Mar 17, 2020

New macros to handle the common case where the displayed defined term is a child or parent of another in the index. Each has about the same number of uses; I found them to make the actual prose in the source more readable (since the other {foo} can be read as a kind of gloss), but it's up to edit@ to decide whether it's worth having more macro names.

@opensdh
Copy link
Contributor Author

opensdh commented Mar 17, 2020

@zygoloid, @jensmaurer: Please review/judge.

@tkoeppe
Copy link
Contributor

tkoeppe commented Mar 17, 2020

I'd only mildly wonder about the name "defnc", which sounds like "def but no italics correction" (given how we use "nc" elsewhere (or maybe a "non-copying def", if you look elsewhere yet). But that's fairly minor.

@opensdh
Copy link
Contributor Author

opensdh commented Mar 17, 2020

@tkoeppe: I used the short names mostly to parallel the \defnx; we could obviously use \defnctx and still have the usage be much shorter than the status quo, but \defnadj is already taken.

@tkoeppe
Copy link
Contributor

tkoeppe commented Mar 17, 2020

I understand why you did it; I just wanted to point out that this is increasinlgy crowding the space of "nc" in names.

We can also consider renaming "defnadj" first if that name is better suited to the proposed facility. But that one seems to definitlely adjoin some precendent for multiletter "defn"-suffixes!

Note also that we also already have "defncontext" :-)

@opensdh
Copy link
Contributor Author

opensdh commented Mar 17, 2020

More ideas: \defnc and \defna could be \defnpar and \defnsub?

@tkoeppe
Copy link
Contributor

tkoeppe commented Mar 17, 2020

That sounds good!

@@ -833,7 +833,7 @@
\pnum
For a given declarative region \placeholder{R}
and a point \placeholder{P} outside \placeholder{R},
the set of \defnx{intervening}{region!declarative!intervening} declarative regions
the set of \defna{intervening}{region!declarative} declarative regions
Copy link
Member

@zygoloid zygoloid Mar 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be \defnadjx{intervening}{declarative regions}{region!declarative}? Similar question for various other uses of \defna below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use ! in the third argument to \defnadjx (i.e., in the see{} in \indextext)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'd need some magic to turn !s into , s. I don't know if \see does that for us but it seems relatively straightforward to build.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That said, should we really be indexing "declarative region" under "region" rather than under "declarative region" in the first place?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We provide "a b, see b, a" because it's standard to look up "noun, adjective", so maybe people do look for "region, declarative" even though the generic word "region" is not useful here? (I also haven't checked to see whether the other uses of \defna are "misuses" like this.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, we don't have index entries for "binding, structured" or "operand, unevaluated". I think that's somewhat appropriate: these aren't "adjective noun" so much as an atomic noun phrase.

I think the right thing here is:

  • This should be \defnadj{intervening}{declarative region}
  • The "region, declarative" index entry should be changed to say "see declarative region" so that it points to this index sub-entry

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean \defnadjx{intervening}{declarative regions}{declarative region} for this case, right? And are you saying that (\defnadj and) \defnadjx should be changed to always index adjective noun and generate a see for noun, adjective?

@@ -2863,7 +2863,7 @@
\end{example}
As a consequence of these rules,
all declarations of an entity are attached to the same module;
the entity is said to be \defnx{attached}{attached!entity} to that module.
the entity is said to be \defnc{attached}{entity} to that module.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe \defnctx; this is really the same thing as \defncontext but for an inline definition rather than a Terms and Definitions definition, so using a similar macro seems reasonable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, the syntax is a bit different, but you're right about the parallel. Do you have a suggestion for \defna?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well... should \defna{x}{y} be an alias for \defnadjx{x}{}{y}? (I think we probably always want the see entry, so I'm inclined to say yes.) If so, perhaps we could use \defnadjx{x}{}{y} directly rather than introducing a new macro?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\defnadjx{x}{}{y} renders as "x ", which would be problematic at least if punctuation follows. I'm sure we could teach it to not do so; maybe #1 #2\unskip would be enough.

Copy link
Member

@zygoloid zygoloid Mar 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another idea for \defnctx: use an optional argument: \defn[entity]{attached}. That seems pretty clean. Although now I come to think of it, that might instead be a nice way to get rid of the \...x macros instead.

Maybe:

  • \defnx{bodytext}{indextext} -> \defn[indextext]{bodytext}
  • \defnc{bodytext}{indexgroup} -> \defnctx[indexgroup]{bodytext}
  • \defnadjx{bodyadj}{bodynoun}{indexnoun} -> \defnadj{bodyadj}[indexnoun]{bodynoun}
  • \defna{bodyadj}{indexnoun} -> \defnadj{bodyadj}[indexnoun]{}
    ? (Leaving room for \defnadj[indexadj]{bodyadj}{bodynoun} if we ever want that.)

General idea: the text in braces always appears in the document; the text in brackets is only used to form the index entry.

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, that seems like an improvement: fewer magic names and less in the way of argument-order guesswork. \newcommand supports only leading optional arguments, but we could certainly use a raw \def for your first \defnadj. We still have to deal with emitting a space only if the bodynoun is non-empty. I don't immediately know how to support optional arguments in two different places, but I'm sure something like \expandafter can be used to do it if it ever matters.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a standard trick for an optional argument after a mandatory argument: \defnadj would be a two-parameter command with an optional argument that saves its arguments in some scratch space then expands to another two-parameter command with an optional argument.

@zygoloid zygoloid added the decision-required A decision of the editorial group (or the Project Editor) is required. label Oct 17, 2020
@jensmaurer jensmaurer added the needs rebase The pull request needs a git rebase to resolve merge conflicts. label Dec 4, 2020
@jensmaurer
Copy link
Member

Editorial meeting: Introduce \defnadj{arithmetic}[type]{types} and apply it for the cases here.

@jensmaurer jensmaurer removed the decision-required A decision of the editorial group (or the Project Editor) is required. label Dec 4, 2020
@tkoeppe
Copy link
Contributor

tkoeppe commented Sep 4, 2022

@opensdh I think we're still interested in this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs rebase The pull request needs a git rebase to resolve merge conflicts.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants