GREP style with variables

Learn / Forums / InDesign User Groups / GREP style with variables

Viewing 3 reply threads
  • Author
    Posts
    • #1223988
      Cheri Good
      Participant

      I have two variables in a running footer with the left and right pages having each in a different place. I was able to use a GREP style in the footer right paragraph style to apply formatting to only one of the variables and it works fine. I cannot seem to get it to work for the footer left and have tried various options of look behind expressions.

      This grep expression works:
      ^.+?|

      The “|” character is part of the variable, yet the style is applied as expected.

      I need to find the second variable which follows two “|” characters–also part of the variable.
      These options don’t work:
      *\applies the style to both variables
      (?<=~Y)
      *\does nothing
      (?<=\|.*?\|).+
      *\does nothing presumably because the “|” is part of the variable
      (?<=\|~Y\|).+
      *\does nothing presumably because it’s not looking for the text between the “|”
      (?<=\|\|).+

    • #14323211
      David Popham
      Participant

      Hi Cheri,

      Text Variables are considered to be single entities by InDesign, so you won’t be able to parse individual characters within the variable string unless you use Convert Variable to Text. However, you then lose the ability to have it update if changes are made. Can you construct the footer so that the vertical bars are regular text, with the Text Variables on either side?

      A sample of the intended output would be helpful for more guidance.

    • #14323176
      Cheri Good
      Participant

      Hi David,
      Thanks for the reply! I had originally constructed my footer with the vertical bars as text, but I had some sections that didn’t have the two variables (only one) and the bar looked out of place.

      I had taken a screen shot, but couldn’t figure out how to upload it. :) Here’s an image in dropbox: https://www.dropbox.com/s/j32gb1m4xg9ge2f/RunningFooter-2variables.png?dl=0

      I did a workaround instead of using a GREP style for the footer that didn’t work, I manually applied the character style to the master page.

      I was confused because the GREP style worked on the right-hand footer.

    • #14346632
      flypig
      Member

      This explains my text variable failure as well. I use a running header text variable to pick up chapter titles, but I lose all the italics in them. This means the features cannot be used in many of my projects which are academic books and journals with references that have to be in italics. So my running headers end up all Roman and have to be done by hand. I tried GREP to find specific words in the RHs but the italic character style refused to be applied. I tried doing the italics by hand and by nested style and by internal GREP paragraph style and all were overridden.

      Commenting here so that others stop pulling their hair out and give up.

      keywords: GREP text variables character styles paragraph styles running heads

      • #14346640
        David Blatner
        Keymaster

        Yeah… the running header feature is somewhat limited. There was a plug-in from in-tools.com called PowerHeaders that provided a lot more control like this, but it hasn’t been updated in years. I keep hoping someone will update it!

Viewing 3 reply threads
  • You must be logged in to reply to this topic.
>