Copy link to clipboard
Copied
How can I crate a GREP that will underline a part of an entry in a table of contents?
I know how to bold certain words using a GREP but cannot figure out how to underline certai words!!
Any ideas???
It looks as if you are attempting to apply HTML-like formatting markup instead of applying an InDesign Character Style. That might work, in certain circumstances, but it's not the right approach.
Don't try to do anything else in the process. It should not be necessary.
And, since this is unclear: us
...Copy link to clipboard
Copied
It should be an identical process except that the applied Character Style adds an underline, which can be defined in the style for optimum appearance.
Create and optimize the "underline" style first. Then use GREP to apply it according to your rules.
Copy link to clipboard
Copied
I have done that but do not know what character to use to determine the underline.
For the bold I have: Apply Style: Bold To Text: <b>.+?</b>
I tried to do the same for underlining... Apply Style: Underlined To Text: <ul>.+?</ul>
But it does not work... the <ul> and </ul> show up in the text of the table of contents.
Copy link to clipboard
Copied
Exactly the same as when you set bold - just a different setting in the CharStyle definition.
Copy link to clipboard
Copied
I have a character style setting for "underlined" but it does not work when using the GREP.
I need to know what character has to be in... <XXX>.+?</XXX> in place of the XXX to make it work.
I use character style constantly in my projects but getting the underline to work in a table of contents is not working.
As soon as I update the TOC the underline goes away if I manually underline the text!!
Copy link to clipboard
Copied
I don't see where you ESCape "/" - so your <b>...</b> shouldn't work either:
https://creativepro.com/using-grep-styles-to-format-html-code-in-indesign/
Copy link to clipboard
Copied
It looks as if you are attempting to apply HTML-like formatting markup instead of applying an InDesign Character Style. That might work, in certain circumstances, but it's not the right approach.
Don't try to do anything else in the process. It should not be necessary.
And, since this is unclear: use a Paragraph Style-based GREP Style, to apply the underline automatically, and not a manual GREP search and replace.
Copy link to clipboard
Copied
You don't seem to understand what I am asking...
If I use "2.^tSurvivors of Active Participants (ineligible for retirement) with <b>fewer than five years</b> of continuous participation
The... "fewer than five years" will be bold!
I need to know what character to use in place of the "b" to signify underlining with the underlined character style...
I have CHARACTER STYLES created that are used throughout the document... Hidden; Bold; Bold Italic; Bold Italic Underlined; Italic; Underlined; Bold Underlined; Italic Underlined. I use these on a daily basis!!!
My GREPs is a PARAGRAPH STYLE... with the bold that works, but the underlined does not.
Can someone tell me what letter/character I should be using to get an underline GREP to work??
Copy link to clipboard
Copied
This forum doesn't indicate to which post you are replying - so could you please, next time, include poster's name?
Or better yet - use "@" in front of the name - then this poster will receive notification.
Copy link to clipboard
Copied
From his examples, he is using GREP to insert HTML-like formatting codes into the text, a wholly off-track approach having nothing to do with proper use of GREP styles.
Copy link to clipboard
Copied
You need to reread my prior answer.
You don't apply direct formatting codes using GREP, as if it's HTML/CSS content.
You tell InDesign to apply a defined Character Style to text selected by the GREP string.
That is, you don't need, want or use any "code" for underlining in your applied string. You search using the string; you apply a defined Character Style using the GREP Style feature.
Put even more simply, your bolding method is doing it wrong; there is no "right" way to use it to apply underlining.
Copy link to clipboard
Copied
Nobody seems to understand how to crate a GREP that will underline text in a table of contents.
Thanks anyways.
Copy link to clipboard
Copied
Nobody seems to understand how to crate a GREP that will underline text in a table of contents.
Thanks anyways.
By @pcfiles
Can you post some screenshots - of your text, with hidden characters visible - and GREP settings.
And sample INDD also would be great - to eliminate "hidden" problems.
Copy link to clipboard
Copied
Nobody seems to understand how to crate a GREP that will underline text in a table of contents.
You mean like this, which took me about thirty seconds following the instructions given above? (Including the time to find and open a suitable test file?)
Copy link to clipboard
Copied
If it took 30 seconds then show me the GREP settings!
Copy link to clipboard
Copied
I've used a simple 'hard' GREP string here; substitute any that selects your desired text. A fancier one to select, say, any four-letter word in uppercase (such as several I am thinking of at the moment) would be \u\u\u\u .
"Unnaline" is my simple underline Character Style—
You could make this a manual operation by using the same elements in a GREP Find/Change, but that's pretty pointless given that ID will do it for you, automatically and on the fly, with this method. But if you insist:
This is not complex if you let go of the idea that you somehow have to apply inline formatting codes to the text using a GREP result. You don't. That's just not how it works.
Copy link to clipboard
Copied
Nobody seems to understand how to crate a GREP that will underline text in a table of contents.
Thanks anyways.
By @pcfiles
Actually, most of the answers given were clearly understandable.
But to bring the topic to a successful conclusion:
Just tell us which word or words you would like to have underlined.
Or, as requested by the others:
Show us a screenshot of your TOC, the words to be underlined should be recognisable. Or upload a simplified example file (without confidential data) to a hoster of your choice and link it here.
The more precise your details are, the more likely it is that we will find a suitable solution.
By the way: Everyone who has replied to you so far is very good at using GREP.
Copy link to clipboard
Copied
OP needs to underline text between <ul>...</ul>.
Same as with bold that is supposedly working for him - which shouldn't work either as there is no "\" before the "/".
Copy link to clipboard
Copied
I know.
And I suspect that he is trying to apply this technique https://creativepro.com/using-grep-styles-to-format-html-code-in-indesign/. But that won't get him anywhere. So without real examples, it's just poking around in the dark ...
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Haha.
I completely overlooked that.
😄
Copy link to clipboard
Copied
Haha.
I completely overlooked that.😄
By @pixxxelschubser
No problem.
If that link doesn't help OP - then there is something wrong with the text - and screenshots would really help.
Copy link to clipboard
Copied
If that link doesn't help OP - then there is something wrong with the text - …
By @Robert at ID-Tasker
I don't think so.
It is more likely that he is not using the correct paragraph style in his table of contents. But you can really only see that in a real example file with paragraph styles and TOC definitions.
Copy link to clipboard
Copied
There is clearly confusion between GREP practices and HTML markup, but I can't sort out the end goal here, especially with respect to a TOC.
Copy link to clipboard
Copied
I think we all have drifted too far from the obvious thing - TOC will retain CharStyles applied in the text...