Home Forums DITA and XMetaL Discussion TOPLEAF: Chapter/Appendix Titles into Headers? Reply To: TOPLEAF: Chapter/Appendix Titles into Headers?

gjn2066

Reply to: TOPLEAF: Chapter/Appendix Titles into Headers?

There are a couple of issues with your headers that need to be cleared up. Consider the following content (of your righthead header):
   {DITA-mainbooktitle}
 
 

Firstly, the directive is a singleton (ie. empty tag). So while it is not exactly an error to use it to wrap content, the result will probably not be what you expect. It is normally used to invoke a font effect that doesn't coincide with the normal XML hierarchy (eg. when marking new/amended text, which may cross tag boundaries). This is not the case here and there are easier ways to achieve the desired effect.

Secondly, you can rely on the Font tab of your header to set the default font for the header. so you only need mark areas where a different font effect is needed (eg. the page number).

Thirdly, while an explicit directive is not wrong, it is usually better to use a named space which is proportional to the current font size. So if you change the header size, the gap will scale appropriately. The “named spaces” I refer to are:

  • — wide character (M) space
  • — half character (N) space
  • — number width space space (useful for left padding numbers to preserve alignment)
  • — thin space (about the width of a capital I)
  • — hair space (used for minute gaps, such as between text and surrounding quotation marks)

Note that while TopLeaf supports the named forms, you can also use the Unicode equivalents. For example = .

Combining all the above techniques, we can simplify the header content to:
  {DITA-mainbooktitle} 
where is just a custom marker to trigger bold font.

Of course none of this actually answers your original question! To create a variable for use in a header, [u]scan[/u] the content of a mapping and then in the Pre-content use something like:
 

If you use the same variable to hold (a copy of) the content of all the relevant elements, then you can set up a single header that will deal with all section types.

Note however that if the value used in the header can change within a page (eg. a subsection title) then you need to be a bit more cunning, but that's another story.

Reply

Products
Downloads
Support