I want to prepare a style based on memoir that executes code immediately before and after frontmatter, mainmatter, and backmatter (§6.1, pg.71). Without hooks, I have to insert the code in the Latex document, rather than the style file where it belongs. Should I use renewcommand?

For reference, the discussion on heading hooks is on page 353 of the memoir manual (§18.25)

  • What exactly are you trying to do? perhaps it is usuful for others?
    – daleif
    Apr 4, 2011 at 9:03
  • @daleif: I set the page background color and PDF bookmark style in these three divisions differently to make them stand out.
    – Emre
    Apr 4, 2011 at 13:56

1 Answer 1


Depending on what you want to add, there are some methods for appending and prepending to commands built into memoir. It provides a \addtodef command which (as its name implies) adds material to an existing macro. It can also prepend things. The syntax is (from p. 338 of the manual):


Depending on what it is you need to do, this may be the easiest route. If it doesn't work, you can take the code from memoir.cls and redefine it within your package.

  • 1
    I've done exactly this to force a pagestyle change when the main matter starts, to force an \appendixpage right after a regular \appendix command, and check the page counts of the various "Lists of X" after each list has been typeset. Apr 4, 2011 at 0:35

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.