chapter-specific headers on right pages but not with chapter name

I have a master document with several subdocuments as chapters. The first subdocument is the introduction, without any chapter number (let’s call it chapter 0). The second subdocument is chapter 1, the third chapter 2, and so on.

In the master document, I have the following requirements for the headers:

  1. the first page of each chapter (which corresponds to a right page): no header
  2. the second and all other left pages of each chapter: header with the book title
  3. the third and all other right pages of each chapter: header with a subset of the chapter name (as it can be too long)

For the moment, I have 3 page styles, ChapterFirstPage, ChapterLeftPage and ChapterRightPage. With this, I manage to fulfill almost all requirements, except the last. Right now, the header of the third and all other right pages contains the name of each chapter. But I need sometimes to shorten it. Therefore, I tried to replace what is currently a field containing the chapter name, by a shorten version of the chapter name that I manually enter, but then all remaining pages with the same style have the same header, even if they correspond to different chapters.

Do you have any idea how to do fix this?

ps: I tried to create as many ChapterPageRight styles as there are chapters, but as they are right page, they need to be followed by the same ChapterPageLeft, which itself needs to be followed by a right-page style…

I suppose that you either need to use a macro, or a trick like this:

Insert a 1-cell table (or 1-row 3-column, or whatever would fit your header layout) to the header. Remove borders and spacing, and make the row to not resize to fit contents. Make its height to only fit one line of text, and put the field there. Then you will be able to control visible area of the string.

Thanks for your advice. Unfortunately, I can’t succeed in writing a macro to do that, that’s way over my skills. (Your 2nd advice doesn’t work for what I exactly want to do.)

One possibility is to not use a chapter field, but a custom one that it is updated on every chapter. See a similar problem here:

Manual page numbering in footer [closed]

Just a quick note on the use of page styles: there is no need to use three of them, two are enough! Just use one for the first page (as you already do) and one for both, the left and right following pages: you only need to check the “show different content for left/right pages” check mark on the Header tab of that page style.

Actually, just one style is enough: there is “Same content on first page” checkbox on the same tab :slight_smile:

Thanks a lot. Following your advice, I created a variable, set its value to the 1st chapter name, and inserted it in the header of the 1st chapter. Then, I edited its value in the header of the 2nd chapter, and changed it to the 2nd chapter name. But this also changed its value in the 1st chapter… Basically, I don’t succeed in having a chapter-specific variable as you suggest. From what I understand, this is due to the fact that all chapters have the same page style, no?

@tflutre, I started to create a sample file and everything worked as I described… until it stopped working. It seems there is a problem here because it should work and I remember using this on a couple of documents a long time ago. I do not have the time right now for further research, but as soon as I can I’ll try to see where the problem is to do a proper bug report.

@mikekaganski, the “first page thing” only works for the absolute first page: if you need the first page of every chapter to be without header you need to use a different page style :wink: