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 !
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.
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.
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.
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.
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!
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:
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 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):
Hit Return, et voilà:
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.
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.
Thanx a lot Lynn ! I'll give it a try 🙂