Thursday, April 1, 2010

Cleaning out document styles

In Atlantis, each document contains a specific style list. Each of the styles in that list can in turn be associated with specific paragraphs of the same document. The styles of a document can be adjusted through the "Format | Style..." dialog, or through the Styles panel of the Atlantis Control Board. You can change the formatting borne by the document styles, remove styles from the document, or add new styles.

Note that Atlantis might add new styles to a document when you paste fragments copied from other documents. This normally happens when you paste fragments associated in the source document with a style missing from the target document. This is done fully automatically and does not require intervention on your part.

Now at times you might make changes to a document and remove all the paragraphs associated with a given style, or simply reassociate them with a different style. This invariably leads to items becoming "orphaned" in the document style list, i.e. styles no longer associated with any paragraph in the document.

This does not mean at all that a document with "orphaned" styles is invalid in some way. You can have as many styles as you wish in your documents, even when most of them are not actually used within the document body. However, having a big amount of unused styles in a document style list might cause real inconveniences. Locating a style in such oversized lists is usually rather awkward.

Atlantis does not have a command to remove unused styles from documents. But there is still a way to locate and remove unused styles if keeping the document style lists as clean as possible is important to you. This method takes time but in some cases you'd be truly a lot better off removing the clutter of unused styles from a document.

Here is how to proceed:

1) First, make sure that the Atlantis Control Board is displaying (if necessary, press F6 or toggle "View | Control Board" on). Click the "Styles" button at the top of the Control Board to open up the Control Board Styles panel:


2) Click the "tree" button at the top of the Styles panel to display the document style list in a hierarchical way:


3) Now you need to revise all the styles reported by the Styles panel, starting from the bottommost style and working up to the topmost style (we'll explain further down why styles have to be revised in that order). So first click the bottommost style name in the Style panel (in the above screen capture, the "TOC Title" style).

4) At the bottom of the Styles panel, click "Select paragraphs associated with highlighted style" (rightmost button):


— If the highlighted style does have associated paragraphs in the document, these will immediately be selected in the document window. Take this as a signal that the style is in use and should not be removed. In this case, select the next style up in the Styles list, and click "Select paragraphs associated with highlighted style" again.

— If the highlighted style does not have associated paragraphs in the document, you will get the following message:


This time, you can click the "Delete style" button at the bottom of the Styles panel:


Note that the "Header" and "Footer" styles are a special case. If you want to check if a "Header" or "Footer" style is actually associated with paragraphs of the current document, you need to first activate the corresponding areas in the document window. This is done by clicking "View | Header & Footer" or double-clicking the grayed-out header or footer area. If you do not activate these header and footer areas before clicking "Select paragraphs associated with highlighted style" to check a "Header" or "Footer" style, you will get the same message from Atlantis, actually telling you that "such paragraphs are part of currently unavailable portions of the document". And you won't know if the document "Header" or "Footer" styles are or are not associated with paragraphs in the document. So always make sure that the header and footer areas are "active" before you check the "Header" or "Footer" styles. Of course, the "Header" or "Footer" styles should not be removed if you have headers or footers in your document.

When you have finished checking the "Header" or "Footer" styles, and want to check other styles, do not forget to display the document main body by clicking "View | Header & Footer" again or double-clicking the document main body area.

Now let's explain why document styles have to be revised in reverse order (from bottom to top).

Some styles might have no associated paragraphs in the document but still play an important role as a base for other styles. For example, you could have a style named "Comment" bearing the basic formatting of all comments in a document. This "Comment" style might have several child styles like the "Positive comment", "Critical comment", and "Neutral comment" styles. These would all be based on the "Comment" style, and would naturally inherit all the formatting defined for their parent style. But these child styles would of course have specific characteristics. The "Positive comment" style could bear a green font color in addition to the base formatting inherited from the "Comment" parent style. The "Critical comment" style could add red font color. Etc. You would use the "Positive comment", "Critical comment", and "Neutral comment" child styles to format comments in the document. The "Comment" style would not be used to format document paragraphs directly, but it would still play an important role as the defining base for the other "comment styles".

If you tried to remove such a parent "Comment" style through the Styles panel, you would get the following message:


If you have not looked into the child styles associations yet, and don't know if paragraphs are associated with them, you won't be able to answer the "Yes/No" question in the above dialog safely. Removing the "Comment" style might affect any paragraphs associated with its child styles.

So you need to look into the child styles associations first before checking a parent style for its own associations with paragraphs. And since child styles are always displayed below the base style in the Styles panel,


you need to revise styles from bottom to top. In this way, you make sure that you always revise child styles before the corresponding base styles, and know if these base styles are associated with paragraphs in the document.

Accordingly, you should never remove a base style if you have previously found out that its child (or derived) styles do have associated paragraphs in the document. It would be like sawing off the branch these child styles are hanging on to! :)

No comments: