Copy link to clipboard
Copied
I have an InDesign CS6 document with a lot of numbered paragraphs. They begin with a number and end with a paragraph mark. However, there are some paragraphs which have unwanted paragraph marks in the middle.
Question: how do I find these unwanted paragraph marks and remove them?
In other words, I want to remove the extra paragraph mark (highlighted) in this image...
So, in human language I want to say...
1) If a paragraph has "Paragraph style 1" applied
2) ...and the paragraph begins with one or more digits
3) ......and those digits have "Bold character style" applied
4) .........and then there is a string of characters which could include footnote markers with "Footnote reference character style" applied but should not include any digits with "Bold character style" applied
5) ............and then a paragraph mark
6) ...............and then another string of characters which could include footnote references with "Footnote reference character style" applied but should not include any digits with "Bold character style" applied
7) ..................and then a paragraph mark
8) Then delete the first paragraph mark!
Now, in this particular document I am working on I could get away with not specifying the paragraph and character styles so my first thought was the following GREP expression:
(\d+ .+)(\r)(.+\r)
…which reads: find any digit(s) followed by a space and then a string of characters, then a return, then another string of characters and a return.
Then I could easily replace the three bracketed expressions with just the first and the third.
However, when I conduct a search, for some reason paragraphs with footnote markers are skipped. Also, it does not specify that the text string should not include any digits with "Bold character style" applied.
Any help will be appreciated.
> when I conduct a search, for some reason paragraphs with footnote markers are skipped.
That's caused by an age-old bug in InDesign: the . doesn't match the footnote marker.
If Bill's suggestion doesn't work for you, you could search for a paragraph mark that's not followed by a digit:
\r(?!\d)
Note that if you specify a character or a paragraph style in the search, those styles apply to the whole expression. So it's not possible to search for "abc in character style 1 followed by xyz in character
...Copy link to clipboard
Copied
I notice that there is a space before the unwanted paragraph symbol while there is no extra space before the correct ones. If this is consistent throughout then a global Find/Change could do this task simply. Set up in the Find field space^p and in the Change field just a space. All of the unwanted paragraph symbols will then just become spaces within the rejoined paragraphs.
Copy link to clipboard
Copied
Good idea, thank you! But sorry, it will not work throughout the document because not all the unwanted paragraph marks have spaces in front of them.
Copy link to clipboard
Copied
> when I conduct a search, for some reason paragraphs with footnote markers are skipped.
That's caused by an age-old bug in InDesign: the . doesn't match the footnote marker.
If Bill's suggestion doesn't work for you, you could search for a paragraph mark that's not followed by a digit:
\r(?!\d)
Note that if you specify a character or a paragraph style in the search, those styles apply to the whole expression. So it's not possible to search for "abc in character style 1 followed by xyz in character style 2".
Peter
Copy link to clipboard
Copied
Thank you Peter! This worked for me! I clearly couldn't see the wood for the trees myself in order to realise this search query. However, in the footnotes it was finding some unintended things but I do not really need the search for the footnotes so I just conducted a body search.
It would be nice if a search query could be written as set out in the original question. The query seems trivial when looking at the picture but when writing it out it is not so trivial.
Copy link to clipboard
Copied
> It would be nice if a search query could be written as set out in the original question.
Again, it's not possible because any style you set in the 'Find format' panel applies to the whole expression. The first three lines of your recipe can be captured by
Find what: ^\d+
Find format: paragraph style 'Paragraph style 1', character style 'Bold'
This query matches just the bold numbers (in 'Paragraph style 1' paragraphs). Nothing else. To inspect different styles in a single text range, you need a script.
> The query seems trivial
Famous last words. . .