TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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)

share|improve this question
What exactly are you trying to do? perhaps it is usuful for others? – daleif Apr 4 '11 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 '11 at 13:56
up vote 7 down vote accepted

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.

share|improve this answer
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. – Mike Renfro Apr 4 '11 at 0:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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