The everypage package speaks of hooks.

What exactly is meant by this and how could it be used?

  • 3
    If you search this site for \AddEverypageHook, you will find various code examples using this package and macro. In essence, the \AddEverypageHook will automatically do "something" every page of your document. What that "something" is, you have to tell it. In contrast, \AddThispageHook will do "something" on the current page only, but what it allows is for the "something" to be done in the same way, regardless of where you currently are located on the page when you invoke it. – Steven B. Segletes Sep 10 '14 at 18:13
  • 1
    Related: How to add a hook to a macro – Werner Sep 10 '14 at 18:19

Programmers call "hooks" pieces of code that are executed every time something happens, and that can be "added to" by other programmers. This is like a hook you may have on your bag: you can put your phone or your camera on it. What exactly you hook there can be decided later; the hook is there for anything.

For example, you may print on every page a draft mark. Or send yourself an e-mail "Page 2 is printed". You add the program that does this to a page hook, and it is done every time you ship out a page.

  • Do I understand right: a hook is not LaTeX specific? Really, it is possible to get an email "Page 2 is printed"? Just a short answer, how would this be implemented? – Rafael Wörner Sep 10 '14 at 18:45
  • 1. Yes, hook is a general programming concept, it is not LaTeX specific. 2. write18 stream can be used to call any program (if not disabled by security considerations); one can call, e.g. sendmail to send an e-mail to the given address. – Boris Sep 10 '14 at 18:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.