I’ve taken advantage of the past week to update four scripts in the Id-Extras.com library: Auto Character Styles, Line Numbers, Sections Stuff, and Fit Text to Frame, this last one being the biggest update of the four, and in fact virtually a complete rewrite of the script.
Auto Character Styles
Auto Character Styles is the script that converts all local overrides into character styles.
It works by going through all the text in an InDesign document paragraph by paragraph. The script analyzes each paragraph to see what formatting in that paragraph is dominant. The way it calculates this is by find the longest continuous run of similarly-formatted text in each paragraph. The formatting properties of that text are then considered to be the “base” style of the paragraph, and anything that is different to this formatting is considered an override. All such overrides receive a character style.
This method of defining an override is meant to be as similar as possible to what we would call a text override in an InDesign paragraph.
The alternative would have been to simply check the underlying properties of the paragraph style of each paragraph, and to define any character-level formatting that is different to this as an override.
The problem with that method, though, can be demonstrated with an example. Imagine a paragraph where all the text has bold formatting applied. Since the entire paragraph is bold, I think most people would be inclined to agree that such a paragraph has no character-level overrides. So even if the underlying paragraph style does not include bold as part of its definition, there are no visible overrides in such a paragraph, even though from a purely technical point of view InDesign would consider the entire paragraph to have character-level override (InDesign will display the little + sign next to the paragraph style in the styles panel).
That’s why Auto Char Styles is more powerful than a find/change operation could ever be. With find/chance, we could search for bold (for example) and apply a character style to it, but in many cases this may be completely undesirable – as, for instance, in the case of a subheading that is all bold.
So what does this week’s update add to Auto Char Styles? A checkbox that forces the script to skip any text that may already have a non-overriden character style applied to it.
Until now, Auto Char Styles would reapply its own character styles to any text, even if this would mean changing any char style already applied to the text.
But clearly in certain circumstances such behvior would be undesirable. For instance, I can imagine a situation where, after the user has formatted text throughout his or her InDesign document, including applying custom-made character styles, it becomes necessary to copy/paste chunks of text from Word into the InDesign document. This text will not be formatted with styles properly. So until now, it would have been impossible to conveniently use Auto Char Styles again, since it would have modified any pre-existing, user-applied character styles in the text.
However, with this fairly simple addition, it is now possible to tell the script to skip any such text – so it becomes possible to run the script several times without fear of undoing previous work.
The second script to get the update treatment this week is Sections Stuff. Sections Stuff is a script that sets InDesign sections throughout a document according to the paragraphs applied to text on any given page.
The main use of this is to force the footnote numbering in each chapter to restart at 1. This is because InDesign provides an option, in the Footnote Formatting dialog, to restart footnote numbering with each new sections. But what InDesign does not provide is a way to easily apply new sections throughout a long document.
Imagine a book with 30 chapters, where the footnotes to each chapter must start afresh at 1. Such a document would necessitate the InDesign user to go through the entire book and manually apply a new InDesign section on each page a new chapter begins.
But what if an edit is made (to chapter 1?), and suddenly all the text has been shifted by a page or two! This means that the hard work of applying 30 sections in the pages palette has to be redone!
This is why Sections Stuff is such an essential script. It allows the user to define up to 7 paragraph styles that act as markers for a new section. For instance, if the chapter title in a document always has a paragraph style applied to it called “New Chapter”, Sections Stuff can be set to create a new InDesign section wherever in the document text with that paragraph style applied to it appears. Clearly this can save hours of work.
So what does this week’s update add to Sections Stuff? Well, until now, all sections created by the script were defined as having “continuous numbering” and were set to having page numbers in arabic numerals (1, 2, 3…) style.
This made it difficult to use for a book following the customary pattern of numbering the front matter (prelims, or preliminary section) of the book with roman numerals (i, ii, iii…), where the page number of the first page of the main part of the book is numbered 1. Every time the script was run, the first section of the book would revert to arabic numerals, and the second section would be given continuous numbering. For instance, the first chapter of the book, after the front matter, would be page 17. This is a little unusual.
The solution was to provide a new option allowing the user to define at which of the sections of the InDesign document the main book actually start. In most cases this would be the second InDesign section.
So, now (if the option is selected), all document pages until the user-selected section take the page numbering style of the very first section of the document (the first section always begin on page 1 of an InDesign document). And all pages from the user-selected section onwards are set to arabic-numeral-style page numbering. At the same time, the first page of that user-selected section is reset to be page 1.
In short, Sections Stuff is now able to work smoothly with the customary book structure of roman-numerals-numbered prelims followed by the main book starting at page 1, with arabic-numeral page numbers. And since this new feature is activated by a checkbox, it can be turned off, and so should not interfere with those who preferred the old style.
At the request of a user, the popular Line Numbers script has also been provided with a new option: “Start numbering at…”
This is self-explanatory. The user can now decide which number the first line number added by the script should be.
Such a simple request, I’m suprised it hasn’t been made more frequently. However, I supposed that there are relatively few situations where you would not want line numbering to begin at 1. In our user’s case, I understand that she had divided an book into two separate InDesign files which she wanted to add line numbers to.
Since these two files constituted a complete book, she wanted the line numbering of the second file to pick up where the numbering of the first file left off. That would have been impossible to do with the Line Numbers script until now.
(Customers who have been using Line Numbers regularly will also be pleased to know that the bug whereby some number text frames were overset has now been fixed as well.)
Fit Text to Frame
Last, but certainly not least, is the rewrite of Fit Text to Frame. Version 2 is far more powerful than previous versions.
Fit Text to Frame makes it possible to enlarge or reduce text inside an InDesign story by just the right amount to make all the text fit the available space. This script emulates the functionality of the similarly-named feature in Corel, so I understand (I do not have first-hand experience of this).
With Fit Text to Frame version 2, features have been added, and the main resizing engine has been completely rewritten.
The scripting technique Fit Text to Frame uses is beyond the scope of this blog entry (it works with transformation matrices). It is important to understand, though, that it does not use the overly-simplistic method of simply enlarging (or reducing) all the text in a text frame until there is no more overset text (or until it becomes overset – depending which way we’re going). This method, apart from being very slow, is primitive because it does not modify the leading (the distance between lines) of the text, nor does it modify the size of tables or of any anchored objects embedded in the text.
Fit Text to Frames uses a far more sophisticated method, resulting in a perfect reduction or enlargement of all elements of an InDesign story, proportionally, including anchored objects, tables, inline graphics, leading, and more.
So what does this week’s update add to Fit Text to Frame? A lot! It is now possible to select multiple text frames and run the script on all of them in one go. It is also possible to select an object style from the new dropdown menu, and the script will then fit the text of all stories containing at least one text frame with the selected object style to the available space for that story.
Finally, because of the transformation-matrix-based method of fitting the contents of the text frames to the available space, the script now works with text frames that have been rotated, flipped, or skewed. And it even works when a graphic frame impinges on the text in the InDesign story being copyfitted.
So this has been a summary of the improvements made to four of the InDesing scripts in the Id-Extras.com script library. All the scripts mentioned here have demo versions available, so feel free to download them and given them a test drive. And if you have any further ideas for improvements, I’d love to hear from you!