Merging paragraphs

Merging is used where a single paragraph in the output takes its content from multiple elements in the XML input. For example:

<contents>
  <head>Introduction</head><page>3</page>
  <head>General Principles</head><page>12</page>
  ...

would require a merge after each <head> element so that the heading and page number appear in the same line.

The merge option is set by default for label mappings, which are incorporated into the following paragraph (typically the body of a list item or heading) thus:

<para><label>(iv)</label>Text goes here ...

In fact, the above markup seldom occurs in actual source XML, but the equivalent effect is often achieved when a paragraph is self labelling:

<para number="(iv)">Text goes here ...

in which case the label would be generated via a custom marker that takes the place of the <label> tag above.

The properties of the merged paragraph depend on the precise ordering of the tags involved, so you will need to try out your own markup to test the effects. However the following general rules apply where <A> has the merge option set and <B> contains the material being appended.

For sequential merges <A>some text</A><B>more text</B>:

  • Space above is controlled by <A>.

  • Space below is a combination (typically the larger) of <A> and <B>.

  • The merged paragraph takes its Left margins/indents from <A> and its Right margins/indents from <B>.

  • Alignment of lines depends on several factors (e.g. whether <A> is a label or a normal para). This can create odd effects, so normally the two alignments should be kept the same.

For embedded merges <B><A>label</A> body</B> where the label is a child of the main paragraph:

  • Space above and Space below are a combination (typically the larger) of <A> and <B>.

  • All other paragraph properties are controlled by <A>. However since <A> is a child element of <B>, it will inherit margin and alignment settings from <B> in the normal manner. This has the effect that the left and right margins are the sum of the margins set in <A> and <B>, but the indents (relative to these margins) are set by <A> alone.

If the following paragraph also has the Merge with following paragraph option set, then the merging will continue until the chain is broken.

[Note] Note

You may not merge paragraphs separated by page or page type changes, a leaf group barrier, table or box boundaries, or horizontal ruleoffs. Any attempt to merge with a following box will be treated instead as a bind.

This option is not compatible with any of the Page or Rules options except End margin rule.

[Warning] Warning

Merging is intended for simple paragraphs only. If material being merged has its own internal structure (e.g. an embedded list), then the merge is broken at that point and all styles revert to normal. This may affect the aesthetic quality of the resulting output.