Questions tagged [hooks]

{hooks} are macros (or placeholders) stored at specific locations inside other macros that can be redefined to the user's specifications, thereby "hooking into" the macro at that specific point.

are macros (or placeholders) stored in specific locations inside other macros that can be redefined to the user's specifications, thereby "hooking into" the macro at that specific point.

Common hooks used in documents include \AtBeginDocument and \AtEndDocument that adds contents to the hooks \@begindocumenthook and \@enddocumenthook, respectively. The etoolbox package provides a number of tools to hook into macros (via \patchcmd, say) and environments, amongst other pre-defined hooks.

118 questions
16
votes
3 answers

Why won't \AtEndDocument execute at the *end* of the document?

I must be doing something incredibly stupid, but I've boiled it down just as far as it can go with no luck. I'm working on a bug that's cropped up in a recent commit in pagectrl @ca7dc3. I have the following minimal…
Sean Allred
  • 27,421
10
votes
1 answer

What is a hook - everypage package

The everypage package speaks of hooks. What exactly is meant by this and how could it be used?
6
votes
2 answers

Purpose of AtEndDocument{\def}

I am currently researching how to generate a recompilation warning from Latex if somthing in the auxfile changes and found this solution. However I find it rather confusing, it uses: \AtEndDocument{\def\newreference#1#2{...}} Which looks to me as…
ted
  • 3,377
4
votes
0 answers

Use shipout hooks to manipulate global state

I think that the recently introduced hook interface is an exciting extension of the interactions with LaTeX internals. They motivated me to resume my efforts to convince LaTeX to process page contents dependent on page number. Previously, I messed…
4
votes
2 answers

How can I output before the final clearpage using AtEndDocument or similar?

I would like to output a single line of text at the end of all the documents generated using a particular coustom package file. I assumed \AtEndDocument would do the trick as I have used it before to do things like closing environments that were…
Caleb
  • 1,988