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

GREP excluding comma in reformatting paragraph style

Return to Forums

  • Author
    Posts
    • #14333097
      Hologram –
      Participant

      I am currently trying to reformat my in-text cross-references to be 1,2,3 or just 1, I am really close to the solution, but there’s one thing I cannot find out.

      What I have sofar is a numbered paragraph style with my sources.
      A paragraph style for the text itself, including a some GREP overrides.

      My sources are in this format:
      [1] Author, A. (2000). Title.
      [2] Author, A. (2000). Title.

      I am using full paragraph cross-references, to have the references show up in the panel. By using grep, I have reformatted the in-text cross-reference from:
      [1] Author, A. (2000). Title., [2] Author, A. (2000). Title.
      To:
      1 2

      By removing the brackets themselves (each line is a single GREP style set to a 0,1pt 1% scale no colour character style):
      (?<=\d)\]
      \[(?=\d)
      And by replacing text between brackets:
      (?<=\]).*?(?=\[)
      Now, to have a comma in between the references, can I exclude the comma somehow in the previous GREP expression?
      That way I’d get 1, 2, 3 style formatting, while maintaining links to the references and a clear cross-reference panel. :)

      Optionally, it would be possible to add brackets at the start/ end to get [1, 2, 3] formatting in-text.

    • #14333108
      David Blatner
      Keymaster

      It’s a little confusing… you’re trying to get rid of the brackets and the author, year, and title? So you just have the number left?
      And you also want commas between the numbers? Can you provide a more clear example of what you’re starting with and what you want to end with.

    • #14333112
      Hologram –
      Participant

      Sure thing, I understand the confusion. What I want is to use Crossreferencing, by just referencing the paragraph number.
      Now, seeing only numbers in the cross-reference panel is very confusing to me, so I stumbled upon a “hack” where you can use the entire paragraph’s text, but reduce the visibility of anything but the numbers with a really small character style and GREP.

      My goal is to have a sources list with fully formatted text in APA style. My referencing in-text should look like a superscript number at the end of a piece of text. These could be multiple numbers in case it was made by combining multiple sources. Basically, all the formatting has been taken care of, except for that I want to be able to see the comma I place between the cross references.

      My entire cross-reference would be the full size reference, which I denote between the quotation marks. In this case, I have two sources for one piece of text, so two separate cross-references between quotation:
      “[1] Author, A. (2000). Title.”, “[2] Author, A. (2000). Title.”

      I put a comma in between the two to seperate the cross-references. Now if my really small character style wouldn’t affect the commas I would have my desired result (just the numbers and comma):
      “1, 2”

      What I did to achieve this, is remove any text in between the closing and opening bracked ]….this text….[
      With this: (?<=\]).*?(?=\[) and the character style set to the really small text.
      So my question is can I exclude my comma from being overridden with the really small characters?

      The logic could be as follows: override all text between ] AND [ except for the seperating comma. I am thinking about using a lookahead that searches for “,\[” which is “, [” so any comma prior to the start of a new reference. Can that be incorporated into the previous GREP piece to exclude that specific string of characters from receiving the really small character style override?

    • #14333156
      Hologram –
      Participant

      Allright, I found the solution after a night of sleep. Here’s what I did:
      I stopped the character style conversion at the comma prior to the new opening bracket:
      (?<=\]).*?(?=(,\[))

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