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

\ShowHook does not recognize generic hooks #1220

Open
jlaurens opened this issue Dec 23, 2023 · 7 comments
Open

\ShowHook does not recognize generic hooks #1220

jlaurens opened this issue Dec 23, 2023 · 7 comments

Comments

@jlaurens
Copy link
Contributor

Brief outline of the bug

According to section 2.6 Generic hooks provided by packages of lthooks.pdf, babel/⟨language⟩/afterextras is a generic hook, but that is not what gives \ShowHook

Actually, hooks are either

  • non generic.
  • generic

Either \ActivateGenericHook should make the hook generic if it is not already a generic hook, or the correct hook categorization should be

  • non generic.
  • generic
    • builtin
    • other

and \ShowHook only recognizes the builtin generic.

The documentation should be amended in both cases.

Minimal example showing the bug

\nonstopmode
\RequirePackage{latexbug}       % <--should be always the first line (see CONTRIBUTING)!
\documentclass{article}
\begin{document}
\ShowHook{babel/french/afterextras}
\ActivateGenericHook{babel/french/afterextras}
\ShowHook{babel/french/afterextras}
\end{document}

Log file (required) and possibly PDF file

2.log

Copy link

This issue has been automatically marked as stale because it has not had recent activity.

@josephwright
Copy link
Member

Did one of your suggested improvements to \ShowHooks touch on this?

@muzimuzhi
Copy link
Contributor

According to section 2.6 Generic hooks provided by packages of lthooks.pdf, babel/⟨language⟩/afterextras is a generic hook, but that is not what gives \ShowHook

The last paragraph of section 2.6 Generic hooks says (bold style added by me)

Generic hooks defined in this way are always normal hooks (i.e., you can’t implement reversed hooks this way). This is a deliberate limitation, because it speeds up the processing considerably.

So it seems to me it works as expected that code

\ShowHook{babel/french/afterextras}
\ActivateGenericHook{babel/french/afterextras}
\ShowHook{babel/french/afterextras}

writes to log

-> The hook 'babel/french/afterextras':
> The hook is not declared.
> The hook is empty.
<recently read> }
                 
l.5 \ShowHook{babel/french/afterextras}
                                       


-> The hook 'babel/french/afterextras':
> The hook is empty.
<recently read> }
                 
l.7 \ShowHook{babel/french/afterextras}

@jlaurens
Copy link
Contributor Author

@josephwright
PR #1250 is related to this bug/feature request but does not fix it.
PR #1250 is still a draft PR as long as I have no positive agreement on the concept there.
The documentation must be modified accordingly because it also refers to the output of the old \ShowHook and IIRC some test files are missing.

@muzimuzhi
Paragraph 2.6 is not crystal clear, my interpretation is that locally "normal hook" only means "non reversed", it does not mean "non generic". In particular, applying \ActivateGenericHook to a hook that is not generic seems contradictory provided the command name does refer to "activating a generic hook".

@josephwright
Copy link
Member

@jlaurens I think we had no issue with the core idea in #1250 - but it needs to be focussed just on that change.

@muzimuzhi
Copy link
Contributor

@muzimuzhi
Paragraph 2.6 is not crystal clear, my interpretation is that locally "normal hook" only means "non reversed", it does not mean "non generic". In particular, applying \ActivateGenericHook to a hook that is not generic seems contradictory provided the command name does refer to "activating a generic hook".

Maybe "generic" hooks other than cmd, env, file, include, package, and class need a new name, like semi-generic hooks or so.

@jlaurens
Copy link
Contributor Author

Or call cmd, env, file, include, package, and class related hook "builtin generic hooks" and call the other generic ones "custom generic hooks"?

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

No branches or pull requests

3 participants