• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Paragraph style adding a full stop at the end of paragraph (or content)

Contributor ,
Aug 04, 2024 Aug 04, 2024

Copy link to clipboard

Copied

I have picture captions which I want to format with a full stop in a paragraph style (I would prefer it to just be in the style, not actually typing it, as it is not to be used in e.g. the ToC).

Can this be done? In the GREP maybe (in that case how)?

TOPICS
How to

Views

330

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Expert , Aug 04, 2024 Aug 04, 2024

By 'full stop,' I am assuming you mean 'period'? (Just clarifying; the former term isn't common in American English or outside of a typesetting shop. 🙂

 

But I read your query as that you want a stop/period at the end of every figure caption.... but you don't want that dot to appear in any secondary use like a TOC, list of figures, etc.?

 

GREP styles can't replace content, only apply format to it. This is sorta-kinda conditional text, but on the fly within the document, which can't really be d

...

Votes

Translate

Translate
Community Expert , Aug 04, 2024 Aug 04, 2024

Hi Chris:

 

As per @James Gifford—NitroPress, we can't add a period/full stop to a paragraph style—just formatting

 

You could add it with a GREP find/change (not a GREP style) but then you'd have to remove it via second GREP find/change each time you updated the List of Figures, which can only pick up full paragraphs, punctuation included. Or again, as per @James Gifford—NitroPress, you could add a GREP style to the LOF entry to just hide the period. 

 

2024-08-04_19-55-36 (2).gif

 

To add the full stop to the captions

F

...

Votes

Translate

Translate
Community Expert ,
Aug 04, 2024 Aug 04, 2024

Copy link to clipboard

Copied

By 'full stop,' I am assuming you mean 'period'? (Just clarifying; the former term isn't common in American English or outside of a typesetting shop. 🙂

 

But I read your query as that you want a stop/period at the end of every figure caption.... but you don't want that dot to appear in any secondary use like a TOC, list of figures, etc.?

 

GREP styles can't replace content, only apply format to it. This is sorta-kinda conditional text, but on the fly within the document, which can't really be done in any simple way. The only way I can think of to make this work is apply GREP styles to each secondary use (a TOC line entry style, for example) that applies a color of "None" to the terminal period/stop.


┋┊ InDesign to Kindle (& EPUB): A Professional Guide, v3.1 ┊ (Amazon) ┊┋

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 10, 2024 Aug 10, 2024

Copy link to clipboard

Copied

Many thanks! I will do what you suggest, add the period (is it the same expression used both in UK and US English?) and then hide it in my TOC.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 04, 2024 Aug 04, 2024

Copy link to clipboard

Copied

Hi Chris:

 

As per @James Gifford—NitroPress, we can't add a period/full stop to a paragraph style—just formatting

 

You could add it with a GREP find/change (not a GREP style) but then you'd have to remove it via second GREP find/change each time you updated the List of Figures, which can only pick up full paragraphs, punctuation included. Or again, as per @James Gifford—NitroPress, you could add a GREP style to the LOF entry to just hide the period. 

 

2024-08-04_19-55-36 (2).gif

 

To add the full stop to the captions

Find: (.+)

Change: $1.

Paragraph style: Caption (call it anything)

 

Assuming all captions are one sentence, to hide it in the LOF:

Create a character style with the color set to none.

Assign the character style as a GREP style to the LOF entry

Apply style: Hide (call it anything)

To text: \.

 

~Barb

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 10, 2024 Aug 10, 2024

Copy link to clipboard

Copied

Many thanks! You read my mind - I am new to GREP so almost always need help in formulating it correctly - with your template I can fix my captions easily :).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 10, 2024 Aug 10, 2024

Copy link to clipboard

Copied

Besides having your "hide" style change the color to 'None,' you might want to pile on making the period vanish by assigning it a size of 1 pt and a width of 1%. This will keep it from distorting any following spacing, such as for a tab leader.


┋┊ InDesign to Kindle (& EPUB): A Professional Guide, v3.1 ┊ (Amazon) ┊┋

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 11, 2024 Aug 11, 2024

Copy link to clipboard

Copied

Great tip, many thanks!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 11, 2024 Aug 11, 2024

Copy link to clipboard

Copied

I now saw that one of the captions include periods I want to keep (e.g. when the caption is "W. Williamson".  Is there a way to only select periods which occur at the end of a paragraph (no caption is longer than a single paragraph)?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 11, 2024 Aug 11, 2024

Copy link to clipboard

Copied

Yes, that's what GREP is all about. It's trivial to just replace all [x] characters, but being selective is where it gets tricky.

 

Your GREP style for each affected TOC level/style should be something like:

  • GREP string: \.$
  • Apply: 'Invisible' style.

 

That will find periods only if they are at the end of a paragraph. This can be expanded if there are any variant cases.


┋┊ InDesign to Kindle (& EPUB): A Professional Guide, v3.1 ┊ (Amazon) ┊┋

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 11, 2024 Aug 11, 2024

Copy link to clipboard

Copied

This is almost magical 🙂

I now realized that there is sometimes one or two empty spaces after the final period in the caption. I thought that something like this would address this, but doesn't seem to work: (\.$)|(\.\ $)|(\.\ \ $)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 11, 2024 Aug 11, 2024

Copy link to clipboard

Copied

quote

This is almost magical 🙂

I now realized that there is sometimes one or two empty spaces after the final period in the caption. I thought that something like this would address this, but doesn't seem to work: (\.$)|(\.\ $)|(\.\ \ $)


By @Chris201Chris

 

You don't have to "escape" spaces - but you should rather run this globally:

 

Find:

\.\s+$

 

Change: 

\.

 

Of course, always test on a copy of your document. 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 11, 2024 Aug 11, 2024

Copy link to clipboard

Copied

LATEST

GREP is a hell of a lot of fun, and even more useful, once you master the basics. You can do insanely weird things with it.

 

Note that most general GREP information is a bit cryptic, intended for the code crowd and running from a command line on file sets; ID's implementation is a bit specific and different. You can't do better than Peter Kahrel's GREP for InDesign as a learning resource, but here's a composite cheat sheet I recently updated. (You typically want to use a specific 'space' wildcard in searches, although a space as you've used will often work fine.)


┋┊ InDesign to Kindle (& EPUB): A Professional Guide, v3.1 ┊ (Amazon) ┊┋

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines