This is a pet 'problem' of mine that I keep on coming up against and wonder again and again “if it's just me”: Is it possible to make consecutive styles behave differently if they follow one another?
Examples of situations:
1) Imagine two kinds of headings in a document, heading_2 and heading_3. heading_3 occurs mostly in body text and has a top margin of about two lines to give a sufficent break in the text flow in the middle of body text. Once in each section heading_3 will follow directly after heading_2 and here the top margin is inordinately large. So here I would like to give heading_3 a smaller top margin if it immediately follows heading_2. Current strategy: override top margin manually.
2) All body_text paragraphs have a first line indent of say 6 mm. Only the first paragraph after a heading, or a paragraph after a set of bullet points should start on the left (= first line indent of 0). Current strategy: use separate text_body and text_first styles and apply manually.
3) Say we have body text aligned to a baseline grid. Whenever there are bullet points, the block should skip half a line so that the block of bullet points is exactly half a line out of sync. After the bullet points, the body text that follows falls back into sync with the baseline grid. = If the paragraph style “bullet_list” follows “text_body” then add half a line top margin/offset. Likewise if “text_body” follows “bullet_list” add half a line to fall back into sync (this latter can be forced by making text_body stick to the baseline. Again, my current strategy is to use extra “bullet_first” and “bullet_last” styles (or in place of bullet_last make the following style stick to baseline again).
This is one of the manual mark-up things that begins to get tedious when you have to do it chapter after chapter. I suppose one could at least alleviate the tedium of manual markup with the help of In-Tools Formatting Tools but I've not yet tried it.
I had originally hoped to do this with nesting styles but one can only nest character styles and they don't have margin settings. Essentially this is what one can do with the :first-child and :last-child pseudo selectors in CSS when designing webpages.
Any ideas? How do you deal with such situations?