Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

first-child / last-child ? how to make consecutive styles behave differently

Return to Member Forum

  • Author
    Posts
    • #53755
      jools
      Member

      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?

    • #53756
      David Blatner
      Keymaster

      I believe much of this can be handled by the Formatting Tools plug-ins from In-Tools.

      There is a simpler (less powerful, but free) script listed here, too.

    • #53765
      Adam Jury
      Member

      I've used Thomas' Fix Paragraph Style Pairs script with great success, and did a videocast to demonstrate usage and some “gotchas” with it: https://dirtywords.tv/2009/episode_004/

      I'm pretty sure that it can handle all three situations you described — it will require making extra styles, still, but automatically applying them will make things faster and more accurate.

    • #53770
      jools
      Member

      Thanks both of you for your hints and tips and Adam your screencast explained that very well. I'll give the Formatting Tools a whirl too (it has “preceded by” too) as I bought the In-Book suite (with the IndesignScripts discount a while back) but there's so much in there I've not tried everything yet. Obviously, there's no equivalent to the :first-child / :last-child pseudo-selectors in ID so it looks like we have to work with some 'redundant' styles.

Viewing 3 reply threads
  • The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
Forum Ads