• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Calculation EDD and Paragraph Tag Assigner

Advisor ,
Oct 14, 2015 Oct 14, 2015

Copy link to clipboard

Copied

Tassos Anastasiou and I have worked on a structured FM project that is now in its 5th release to its users. It involves deeply nested, progressively indented sections with a numbering scheme that involves multi-part numbers at the higher levels (e.g., 14.25.101) and letters or single integers with varying punctuation (usually periods or parentheses) at lower levels. The number of supported levels, the numbering styles, and the space allotted for numbers has changed over the years. Because of the way the FM files are used, it is a requirement that the EDD applies formats from the paragraph catalog rather than setting individual properties. The paragraph catalog to support all the variations has hundreds of entries.

I started out calculating margin and tab settings in my head or on a piece of scratch paper. I progressed to the point of using a temporary spreadsheet when I needed to make several related changes. Consider a situation, for instance, in which we initially decided to leave room for three two-digit numbers in a three part number such as the one above; the left indent and a tab stop needed to be set at the width of 6 digits plus 2 periods plus some white space. Later on, if it was decided that the second or third part, but not both, might go to three digits, the indents and tabs needed to be recalculated based on the width of 7 digits plus 2 periods plus the white space. Such a change might affect dozens of formats and the spreadsheet helped me do the calculations consistently most of the time. Still, the manual labor was significant and I did make mistakes.

We found it cost-effective to develop two tools to help maintain the pgf fmts in a way that reduced both the effort of making such changes and the chance of human error while doing so. One of these tools is a Calculation EDD template and structure application. The template is a structured document whose structure is an augmented version of an EDD. All elements that can contain numerical property values can contain two new elements, Add and Multiply (didn't have a need for Subtract or Divide so I didn't bother defining them). Both of these elements contain any number of children, each of which contains either a number, an Add or a Multiply. Numbers, as in any EDD, can be entered directly or by referencing a variable. So I can define one variable to be the width of a digit, one to be the width of a period, and another to be the width of a space. I can then set a margin at something that winds up formatted as "(7 * 8 + 2 * 3 + 4)pt", if the value I want is the sum of 7 times the width of a digit (assumed here to be 8pt), twice the width of a period (assumed to be 3), and the width of a space (assumed to be 4). The variables, here shown in bold, are defined using a character format that distinguishes them from surrounding text so I can come back to the EDD and quickly locate where variables are used.

To use the calculation EDD, I save it as XML and open the result back in FM. The Calculation EDD application in one direction applies an XSLT transform that performs the specified calculations. The reopened file is thus  a "real" EDD from which I can then import element definitions.

The Calculation EDD spares my aging brain the effort of repeated arithmetic. However, it's not enough for this particular project since we need the calculation results in a paragraph catalog. That's done with the second tool, a plug-in called the Paragraph Tag Assigner. We create a structured document whose only purpose is defining paragraph formats. It contains one paragraph for each entry in the needed paragraph catalog. The contents of each paragraph is the desired paragraph tag for its format. Suppose, for instance, I need 10 pgf fmts called Bullet1, Bullet2, Bullet3, and so forth that will be eventually placed in the templates writers use; then this pgf definition contains 10 pgs whose contents are Bullet1, Bullet2, and so on. These pgfs are arranged in whatever hierarchy is convenient and their formatting is defined in a calculation EDD. The structures defined in the calculation EDD are much simpler than those maintained by writers; while the writer templates may assign a particular pgf fmt in numerous contexts, the definition EDD is used only to define the necessary properties. Once the defining document is finished, the Paragraph Tag Assigner rebuilds the paragraph catalog in the defining document, creating a catalog entry for each paragraph in the document. Then I import paragraph formats from the defining document into all files in a book that contains the numerous user templates the project needs.

I don't recommend that every project use such tools, but they can be extremely helpful in some circumstances.

--Lynne

TOPICS
Structured

Views

204

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation