Skip to main content
grudgemom
Known Participant
July 18, 2018
Answered

apply 2 different character styles?

  • July 18, 2018
  • 5 replies
  • 7026 views

I realize I cannot apply 2 different character styles, so I'm wondering the best way to do this.

We have text with paragraph styles applied. Some text needs to be bold (basically random text, can't use a grep style to control it) so we have a bold character style we apply to this text. Now I want to go through and apply No Break to specifically defined text and the only way I can see to automate this is with find/change or another character style. But the problem is, if the text I don't want to break already has the bold character style applied to it, applying a No Break character style removes the bold.

How should I handle this? I don't really want a character style for Bold, a character style for No Break and a character style for Bold No Break...

This topic has been closed for replies.
Correct answer rob day

The purpose of doing this is to prevent ad hoc layout adjustments. I'm working on a 1000 page book that has sections of text frames flowing through 5-10 pages. Previously people used soft returns to deal with the text strings we don't want to break. Then I come along with new text, everything reflows, and that soft return is no longer at the end of a line. By using the NoBreak attribute, I'm removing all the soft returns to improve the workflow. What a waste of time to send for proofreading, only to have it come back that text reflowed and I didn't notice.

Abambo​ I agree about proper prep saving time! Proper prep was only partially done on these documents and I'm trying to get them the rest of the way when I have time


but I won't be able to automate this very well.

I see, Sorry I missed the mixed no break part.

You might consider a scripting solution for applying the no break. With scripting you could string together multiple grep or text f&c to apply no breaks or remove them.

This Applescript so OSX only.

You would repeat the my GrepSearch("grep code here") line and replace the "grep code here" string with your find code.

Line 13 can be set to either true or false—false if you want to remove the no break

tell application "Adobe InDesign CC 2018"

  

    my GrepSearch("grep code 1 here")

    my GrepSearch("grep code 2 here")

  

end tell

on GrepSearch(f)

    tell application "Adobe InDesign CC 2018"

        set find grep preferences to nothing

        set change grep preferences to nothing

        set find what of find grep preferences to f

        set no break of change grep preferences to true

        change grep

    end tell

end GrepSearch

When you applescript grep searches you have to escape some characters, so the grep for tabs would be "\\t+" not "\t+"

You could also script regular text searches:

tell application "Adobe InDesign CC 2018"

   

    my TextSearch("find text 1")

    my TextSearch("find text 2")

   

end tell

on TextSearch(f)

    tell application "Adobe InDesign CC 2018"

        set find text preferences to nothing

        set change text preferences to nothing

        set find what of find text preferences to f

        set no break of change text preferences to true

        change text

    end tell

end TextSearch

5 replies

Jongware
Community Expert
Community Expert
July 19, 2018

Is it important for you to have proper character styles applied to everything?

My view on this is:

1. Use the correct character style to apply "required" formatting. That is, text that is bold should have a style applied.

2. Use a Non-breaking space only when it is "required": inside "Table 1", but not if you only happen to come across a couple of words that may look better when kept together in that particular single instance.

3. Use a local override for anything else that is "transient". For me, this is No Break, Tracking adjustments (to fit a paragraph better), and font overrides if the character code itself is correct but it just not happens to be available in a certain font.

Therefore, I would only consider a character style containing both Bold and No Break if there is a guideline that states "no text in Bold should ever break".

The idea of discerning between "transient" and "required" formatting is that one must always stay present in the document, and the other one can safely be ignored, removed, or overridden, when making changes to a document. If I'm exporting my document to an EPub, the transient formatting can – nay, should – be safely removed, and the rest should stay.

Compare it to using a shift-return to insert a "nicer break": of course it works, once, and if the text never re-runs then it is no problem. But as soon as you change something in the text, InDesign will have struggle to make everything fit again.

Another one is using Ctrl+Shft+K to capitalize a phrase. It is important to distinct between the capitalization as a design decision (for instance, if a heading should be all caps) and applying it to a lowercase character at the start of a sentence "because it must be caps". In that case, I always type in the actual uppercase text.

(I would not mind being able to apply multiple styles to text at all. But to me, that is a separate issue. You can vote for that here and hope it rises to the top: Allow multiple character styles to be applied to characters – Adobe InDesign Feedback. (Or at least above some of these "Feature requests" that already are possible with external plugins .))

Community Expert
July 19, 2018

Hi Jongware,

I added my vote to "Allow multiple character styles to be applied to characters".

Thanks for the link.

Regards,
Uwe

Willi Adelberger
Community Expert
Community Expert
July 18, 2018

You can avoid a break if you use a non breaking space to keep together words and a hyphen (not visible) before a specific word oder in the entry of the dictionary if you never want to hyphen the word. So no need to use a character style for no break.

grudgemom
grudgemomAuthor
Known Participant
July 18, 2018

That is how I am dealing with certain aspects like company ABC 123 or ABC 45, but there are others like website or email addresses and a company called A&B/CDE that have no spaces.

rob day
Community Expert
Community Expert
July 18, 2018

But the problem is, if the text I don't want to break already has the bold character style applied to it, applying a No Break character style removes the bold.

Sorry if I've misunderstood, but you can have a no break style that doesn't strip the bold if the no break style is based on the bold style.

Scott Falkner
Community Expert
Community Expert
July 18, 2018

https://forums.adobe.com/people/rob+day  wrote

But the problem is, if the text I don't want to break already has the bold character style applied to it, applying a No Break character style removes the bold.

Sorry if I've misunderstood, but you can have a no break style that doesn't strip the bold if the no break style is based on the bold style.

OP already stated they don’t want three character styles: Bold, No Break, and Bold + No Break. I agree that stacking character styles that don’t conflict should be possible. I remember a program that could do this 30 years ago.

Abambo
Community Expert
Community Expert
July 18, 2018

https://forums.adobe.com/people/Scott+Falkner  wrote

https://forums.adobe.com/people/rob+day   wrote

But the problem is, if the text I don't want to break already has the bold character style applied to it, applying a No Break character style removes the bold.

Sorry if I've misunderstood, but you can have a no break style that doesn't strip the bold if the no break style is based on the bold style.

OP already stated they don’t want three character styles: Bold, No Break, and Bold + No Break. I agree that stacking character styles that don’t conflict should be possible. I remember a program that could do this 30 years ago.

It’s simply not possible to attribute 2 or more character styles together to a character, except for the grep styles. You can do a feature request for this. (I personaly would also like having stacked styles).

ABAMBO | Hard- and Software Engineer | Photographer
rob day
Community Expert
Community Expert
July 18, 2018
But the problem is, if the text I don't want to break already has the bold character style applied to it, applying a No Break character style removes the bold.

You can base one character style on another, so make the bold character style and then make a new style based on bold that includes the no break

winterm
Legend
July 18, 2018

grudgemom  wrote

I don't really want a character style for Bold, a character style for No Break and a character style for Bold No Break...


winterm
Legend
July 18, 2018

grudgemom  wrote

I want to go through and apply No Break to specifically defined text

Can you do this with a GREP style as a Paragraph style option? If yes, then you could manually (or again, using GREP) apply bold char style 'on top’, and still keep alive NoBreak, applied with GREP.

grudgemom
grudgemomAuthor
Known Participant
July 18, 2018

I was originally trying to set it up as a Grep style within my paragraph style but grep styles can only apply styles so I have to set up No Break as a character style in order to do this, and then it overwrites the bolding already used. Trust me, many pages of proofreading changes because I didn't catch that this would happen

Scott Falkner
Community Expert
Community Expert
July 19, 2018

grudgemom  wrote

I was originally trying to set it up as a Grep style within my paragraph style but grep styles can only apply styles so I have to set up No Break as a character style in order to do this, and then it overwrites the bolding already used. Trust me, many pages of proofreading changes because I didn't catch that this would happen

That has not been my experience. When a GREP style or a Nested style applies a character style it stacks with character styles already applied, unless there is a conflict.

Below I have a paragraph style that applies three different character styles. Each character style effects a unique attribute, so they don’t conflict. Bold and Non-breaking will not conflict.