Set font color for specific keywords

Explorer ,
Jan 27, 2021

Copy link to clipboard

Copied

Hello,

 

I am new to Framemaker so please forgive my lack of knowledge about fm.

 

I'd like to have an automatic font color assignment for specific words. For example, every time "foo" appears in my text, I'd like it to be automatically colored in red.

 

I am currently working on a structured Framemaker document inside a book, but I'd like to have the answer for both .fm documents and .xml document, as I'll have to work with those on upcoming projects.

 

Thanx in advance !

 

Best regards

 

Eric

Views

108

Likes

Translate

Translate

Report

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

2 Correct Answers

Adobe Community Professional , Jan 28, 2021
Lynne A. Price Adobe Community Professional , Jan 28, 2021
Eric,    Stefan's suggestion to use a variable for each product name is a convenient way to obtain the required formatting. It also provides the other advantages of variables (such as preventing typos and making it easy to change all occurrences of a product name if the product is renamed).    However, Stefan did not mention your requirement of saving documents as XML. By default, variables export to XML as entity references; FrameMaker declares the entities if necessary, using the variable name...

Likes

Translate

Translate
Jump to answer Jump to answer
Adobe Employee , Jan 27, 2021
Stefan-Gentz Adobe Employee , Jan 27, 2021
What is the use case behind formatting certain words in a particular style? Is it like, let's say a product names? If so, you might want to look at variables. Just define a character style and a variable with the settings and content you need.   That's not so much helpful for post-formatting words, but more useful while authoring:   Like this: 1. Create a character style. Call it any way you want, I picked "product-name" here:   2. Create a Variable, for example like this:   From now on, when ...

Likes

Translate

Translate
Jump to answer Jump to answer
Adobe Community Professional ,
Jan 27, 2021

Copy link to clipboard

Copied

Hi Eric,

 

Out of the box FrameMaker cannot apply a certain format as soon as you type.

However, you can copy the desired character formatting into the clipboard (Edit | Copy Special). Then search for the word and in the Change part of the Find/Change pod select By Pasting.

However, be careful. Test this first, before you apply something like this globally! If you really want to apply this globally, make a backup copy first.

And: When you copy character formatting, you copy not only a specific character format (e.g. blue background), but also font, size, etc. When you paste in a heading, the font or the size might be different.

 

Best regards

 

Winfried

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Eric5F88 AUTHOR
Explorer ,
Jan 27, 2021

Copy link to clipboard

Copied

Thanx Winfried !

 

This may indeed do the trick, however we have quite a lot of keywords that need specific coloring, and this would take a lot of time to do a search for each. Would this be feasible with a script ? I know scripts do exist on fm but I didn't have time to look into it yet.

 

Best regards

 

Eric

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Jan 27, 2021

Copy link to clipboard

Copied

Hi Eric, You can certainly use Winfried's technique, but keep in mind with structured FrameMaker, you need to do more than apply formatting to the word; you also need to wrap the word in an element so that it is stored at the XML level. If you just apply formatting in FrameMaker, it will be "lost" when you save to XML or when you update your structured template.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Eric5F88 AUTHOR
Explorer ,
Jan 27, 2021

Copy link to clipboard

Copied

Thanx frameexpert !

 

With non-xml structured documents would I also have a risk to lose the formating ? For the moment I am working on a document of that kind and it seems to keep it after I close it.

 

For pure-xml document I might do a python script to add some tags to a list of words, but didn't have the oportunity to give it a try yet.

 

Best regards

 

Eric

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Jan 27, 2021

Copy link to clipboard

Copied

You could lose non-element or attribute based formatting. Try this on a copy of a document: choose File > Import > Element Definitions and click the Format Rule Overrides checkbox and click Import. Poof! Your non-structured formatting is gone!

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Employee ,
Jan 27, 2021

Copy link to clipboard

Copied

What is the use case behind formatting certain words in a particular style? Is it like, let's say a product names? If so, you might want to look at variables. Just define a character style and a variable with the settings and content you need.

 

That's not so much helpful for post-formatting words, but more useful while authoring:

 

Like this:

1. Create a character style. Call it any way you want, I picked "product-name" here:

Stefan-Gentz_0-1611768966005.png

 

2. Create a Variable, for example like this:

Stefan-Gentz_1-1611769016216.png

 

From now on, when writing content, you can simply hit Ctrl-0 (zero) and select the variable from the list (you can start typing-in the variable name and get the list filtered):

Stefan-Gentz_2-1611769210866.png

 

Hit Return, et voilà:

 

Stefan-Gentz_4-1611769246776.png

 

 

 

 

 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Eric5F88 AUTHOR
Explorer ,
Jan 27, 2021

Copy link to clipboard

Copied

Thanx a lot Stefan !

 

That actuallly is what I was looking for ! I thought about variables but didn't know how to link it with a character format.

 

You guys have really been helpful, this is great.

 

Best regards

 

Eric

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Jan 28, 2021

Copy link to clipboard

Copied

Eric,

   Stefan's suggestion to use a variable for each product name is a convenient way to obtain the required formatting. It also provides the other advantages of variables (such as preventing typos and making it easy to change all occurrences of a product name if the product is renamed).

   However, Stefan did not mention your requirement of saving documents as XML. By default, variables export to XML as entity references; FrameMaker declares the entities if necessary, using the variable name as the entity name if that name is valid in XML. If you ever need to open XML versions of your documents in FrameMaker, you may need to define the variables in your template first.

   Another approach in both FrameMaker and XML is to put the product names in an element called something like Product. Formatting for this element in FrameMaker can apply the desired color. You can combine the two approaches, using the element for the formatting, and a variable inside the element to spare you the need of typing the product name multiple times.

       --Lynne

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Eric5F88 AUTHOR LATEST
Explorer ,
Jan 28, 2021

Copy link to clipboard

Copied

Thanx a lot Lynn ! I'll give it a try 🙂

Likes

Translate

Translate

Report

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