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

Do forced line breaks always interrupt a Paragraph Style?

Return to Member Forum

  • Author
    Posts
    • #64057
      dleather
      Participant

      I'm under hte impression that a “Soft return” or forced line break is different than ending a paragraph. Because of that, it would seem to me that inserting a forced line break in a block of copy should hold it's formatting. Is this an incorrect assumption?

      I have a paragraph style that uses a “bold” character style until there are two spaces. After two spaces, it defaults to the “medium” type I specified in the basic character formats. There are times where I want the copy to break, but continue on to the next line. Currently, after I insert that soft return, the copy after it all goes to “bold” as if it were a new paragraph, looking for those two spaces in the style. Is there a setting somewhere that would indicate to my style/GREP code that a forced line break does not mean 'new paragraph'?

      Example:

      example

      Thanks for any advice you can lend.

    • #64058
      dleather
      Participant

      Sorry, my example image didn't load – I guess I can't figure out how to post an image in this forum.

    • #64059
      dleather
      Participant

      This is my example…

    • #64060
      dleather
      Participant

      Here's a better example:

      #64061

      Are you using Nested Styles or GREP styles? I couldn't get your original to work with Nested Styles, so for sake of argument let's assume you didn't use those :)

      I get your original result with this GREP style:

      ^.+?x{20}x{20}

      (I actually used two simple spaces, but this way they show up in the post.) It says, “from the start of the current paragraph, grab as little as you can up to two spaces” — only less verbose.

      The problem lies in the caret ^ — according to your average GREP manual, it stands for “Beginning of Paragraph”. (Wait, let me check. … Yup, ID's Online Help on “Metacharacters for searching” says exactly that.) Now what is the 'beginning of a paragraph'? Why, surely that's (1) at the start of a story (or table cell or footnote), or (2) immediately after a Hard Return! .. Unfortunately, no. It's true for Nested Styles, but not for GREP (both when searching or in a style)!

      I guess it's one of those things that came with GREP. Adobe's programmers didn't write it from the ground up, but opted to use a well-tried-and-tested open source library (“boost”, https://www.boost.org). They added a few bits here and there around the edges (most notably, shortcuts for a lot of InDesign's special characters), but the main bulk was left unchanged. Looking at the source code, one can forgive them for overlooking the fact that “n” — the soft return — gets treated very much the same way as “r” — the hard return. Historically, there always has been some overlap between these two codes; it's totally “normal” to find text files containing either “n” or “r” at the end of each paragraph (and only Microsoft could come up with a scheme that proscribes “rn” — or was it the other way around? –, and woe on you if you feed an edit box the wrong order!). So boost takes the safe route and treats them exactly the same: both 'r' and 'n' signify “the Beginning of a Paragraph”.

    • Unfortunately, GREP styles rely entirely on what the boost code says; and the boost code says, “hey, here is the start of a paragraph”. Fortunately, ID does recognize the difference if you explicitly test for either an 'r' or an 'n' code. The 'r' code is a bit of a trouble maker inside a GREP style (because “GREP styles do not span multiple paragraphs”, and I guess they get filtered out of the expression at an early stage), but if you are “at the beginning of a paragraph” you can test if you are 'next to a soft return'!

      So this GREP Style code will work for you:

      ^(?<!n).+?x{20}x{20}

      — at the “Beginning of Paragraph” position, there may be 'nothing' to the left (at the start of a story), or there may be a hard return. So if you only match if there is “not a soft return”, you are safe!

      [*] One could make a case to Adobe that this is faulty behavior, and submit it as a Bug Report, since it's contrary to expectations and different from what Nested Styles do.

  • #64066
    dleather
    Participant

    Hm. I will try that today and see if it helps. Thanks for identifying the Nested vs. GREP discrepancy.

  • #64077
    dleather
    Participant

    That did work in the end to solve the soft return problem. Thanks!

    One other question: regarding “x{20}x{20}”, I get that {20} is a space through what I've seen in web coding, but what is the x for? I don't see that or {20} in the adobe cheat sheet I use (found here: https://tinyurl.com/b7pqzkw)

  • #64078

    It inserts the character's Unicode directly as a character. U+0020 is the Unicode for a regular space, so x{20} inserts it (you may drop the leading zeros). Knowing this is quite handy if you want to insert characters for which your OS doesn't provide a default key and which do not have a predefined shortcut, such as ~= for the en-dash. Also, you don't have to hunt the character down in the Glyphs panel, insert it in your document, then use copy-and-paste. The Glyphs panel shows a character's Unicode when you hover the mouse over it.

    I use this to insert stuff like x{2212} — a real minus — and the odd Greek character code — x{3b1} is the alpha — into GREP searches and styles.

    Since a typed space does not appear visibly in this forum, I used the Unicode form here. It's all the same for InDesign.

    (By the way, the forum software eats backslashes. To get one in your post, type two \'s.)

  • #64079

    Ah — and it's an 'x' because Unicode codes are best expressed in hexadecimal numbers.

    Perhaps this is a bit of GREP's history shining through, as the prefix “x” serves to insert a random hex character into a C string — and “C” was the language of choice in the era when GREP was originally conceived.

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