APPLICATION VS DOCUMENT STYLES

Any style created without a document open becomes a default (Application) style. Application styles are added to any new document created thereafter. A style created with a document open is only available for the document. If you have not created any styles at the application level, your document will have two styles by default [Basic Paragraph] and [No Paragraph Style]. You can edit the [Basic Paragraph] style at both the Application and the Document level. It is suggested that the Application level style remains as set by InDesign. By default [Basic Paragraph] is the applied paragraph style for text defaults.

tell application "Adobe InDesign CC 2018"
   tell text defaults
      set theTest to name of applied paragraph style
    end tell
end tell

To see the gargantuan list of properties established as part of text defaults you can use the following:

tell application "Adobe InDesign CC 2018"
   tell text defaults to get properties
end tell

The settings for [Basic Paragraph] is normally set in a font and size appropriate for “Body” or “Normal” Style and is intended for body text and all text that otherwise is not assigned a style or an override.

OVERRIDES

When you set properties for text using the Control panel, you are creating an override for the currently active paragraph style. This will be [Basic Paragraph] unless you have selected another style.

…Setting paragraph styling in Control panel

For instance: Start a new default document. With no paragraph styles selected, add text to the primary text frame (or create a text frame and add text to it). Select the text. From within the Control panel choose Baskerville Regular 24 pt on 24 pt leading. The selected text becomes styled as set. Continue to add text. The styling remains the same. With some text selected, click on Paragraph Styles in the Panel List far right. (If the Paragraph Style panel is not in your panel list, open it from InDesign’s Window menu: Window > Styles > Paragraph Style.)

…[basic paragraph] style overridden>

You will see that the current paragraph style is [Basic Paragraph] but it has an override.
If you click on the listing for [Basic Paragraph] your text will revert back to its default styling.

TAKE ADVANTAGE OF [BASIC PARAGRAPH]

To add text styles to your document you have the following options:

  • Create styles from scratch
  • Import text styles from another document

Most designers will base much of a document’s styling on a particular font family using Size, Alignment, Font Style (italic, bold, etc.) to provide styling variance. For this reason these text styles are often based on a common style or [Basic Paragraph]. 

If the settings for the body text in your new document is to be different than that for the Application’s [Basic Paragraph], you will want to set the Font Family, Point Size, Font Style, and Alignment for this style. Assign Font Family and basic styling properties to the [Basic Paragraph] paragraph style as needed for the document’s body text (Regular 10 pt on 12 leading, left justified or otherwise).

This could be done using the following script which allows the user to choose from a list of commonly used fonts (add more to the list as needed.)

(*List of commonly used fonts for body or default text
Assumes an open document exists*)
set fontList to {"Baskerville", "Adobe Caslon Pro", "Garamond", "Palatino", "Tahoma", "Times New Roman", "Warnock Pro"}
set userChoice to choose from list fontList with prompt "Select font family"
if userChoice is not false then
   set selectedFont to item 1 of userChoice
else
   display alert ("User cancelled")
   return
end if

tell application "Adobe InDesign CC 2018"
   set docRef to document 1
   set fontRef to font (selectedFont & tab & "Regular")
   tell applied paragraph style of text defaults of docRef
	set applied font to fontRef
	set x to applied font
	set point size to 10
	set leading to auto
	set auto leading to 1.2
	set justification to left align
   end tell
end tell 

CREATING PARAGRAPH STYLES

In Setting up paragraph styles you may want to name your styles based on Microsoft Word’s and/or Google Doc’s naming convention. Google Doc’s export to Microsoft Word includes the following styles by default:

  • Title
  • Subtitle
  • Normal (body copy)
  • Heading 1, Heading 2, etc. up through Heading 6

This is a fair number of styles to set up, so let’s look at some ways we can automate the process.

Using Based On

When you base a paragraph style on another, it inherits all of its styling with the exception of any properties set in the new style. Basing a paragraph style on another style eliminates a lot of having to define settings otherwise. Styles such as Normal, Body, Caption, and even most of the Heading styles can be based on [Basic Paragraph].

For this you could create your own text styling script for setting basic styling attributes for stying a standard list of styles similar to that shown below. This script is pretty self-explanatory. Notice that the list for the variable paraList is a list of lists. Each list within the list includes the name, point size, leading, style, and alignment for a style. Alignment, which is a numerical value, represents: “Left” (1), “Left Justified” (2), “Center” (3). “Right” (4), “Away Binding Side” (5). The script also sets character styles for “Bold”, “Italic”, and “Bold Italic”.

Text Styles

(*Assumes a current document exists*) 
set paraList to {{"Title", 30, 30, "Normal", 1}, {"Normal", 12, 14, "Regular", 2}, {"Heading 1", 30, 30, "Regular", 3}, {"Heading 2", 24, 24, "Regular", 3}, {"Heading 3", 18, 18, "Regular", 3}, {"Heading 4", 14, 14, "Bold", 1}, {"Heading 5", 14, 14, "Italic", 3}, {"Heading 6", 10, 10, "Italic", 3}}
set charList to {"[None]", "Bold", "Italic", "Bold Italic"}
tell application "Adobe InDesign CC 2018"
   set measurement unit of script preferences to points
   set stylingList to {left align, left justified, center align, right justified, away from binding side}
   tell document 1
	set baseStyle to paragraph style 2
	repeat with eachItem in paraList
	   set theName to item 1 of eachItem
	   set alignIndex to item 5 of eachItem
	   set myAlignment to item alignIndex of stylingList
	   if not (exists paragraph style theName) then
		set theStyle to make paragraph style with properties {name:theName, based on:baseStyle, point size:item 2 of eachItem, leading:item 3 of eachItem, font style:item 4 of eachItem, justification:myAlignment}
		if name of theStyle is "Normal" then set first line indent of theStyle to item 3 of eachItem
	   end if
       end repeat
       repeat with i from 2 to length of charList
	   set theName to item i of charList
	   if not (exists (character style theName)) then
	      make character style with properties {name:item i of charList, font style:item i of charList}
	   end if
       end repeat
   end tell
end tell 

Notice that [Basic Paragraph] style in AppleScript is paragraph style 2 of the document; [No Paragraph Style] is paragraph style 1.

Sample page showing styles created with Text Styles script

It is clear from the above that using Based On can simplify the process of creating a paragraph style. Another advantage for using Based On is for the occasion that the Font Family for most paragraph styles in a document needs to be updated. When the designation for Font Family changes in the Based On style, all text “based on” also changes. Needing to update a font family often happens for any one of the following reasons:

  • The client changes their mind
  • Template being used has a different Font Family for the majority of its styles than is needed by a new document
  • Text styles imported from a stylesheet meet all the requirements for the new document with the exception of the Font Family

TAKING ADVANTAGE OF YOUR STYLES

The styles created by the above script are basics and will need a fair amount of tweaking for them to work for styling a document. But much of the work has been done for you. Of course you can create your own super Create Text Styles script. (The sample script just opens the door for you.)

When presented with a document from Microsoft Word or Google Docs, the styling created by a script such as the one above can be used to set the styles for the document. When you import the user’s document, map the styles as needed using Microsoft Import options. Most of the work has already be done.

…Word import options

Even for text entered directly in InDesign, having a set of paragraph and character styles ready to use and perhaps modify can make the chore of styling the document’s text so much easier.

  1. Enter the body text
  2. Select it
  3. Use Quick Apply (Mac: command+return; Windows: control+return)

Notice also that the sample script creates a paragraph style named Sidehead which has Normaal set as its next style. This is handy for creating sideheads (side headline inside of a text flow).

  1. Use Normal to add body text ending with a paragraph return (return or enter key)
  2. Quick Apply to select the Sidehead style
  3. Enter text for the sidehead using Shift+return to end lines of text if more than one
  4. Use paragraph return to end the sidehead
  5. The paragraph styling returns to Normal

SAVE A STYLESHEET AND OR A TEMPLATE

If a document you created required a number of other styles and perhaaps a lot of tweeking for the styles generatrd with your Text Styles script, save the document as a stylesheet. (Save a document with only one representative page in InDesign’s Presets > Styles folder.)

If you anticipate having other projects that will require similar styles and the same document framework (page size, margins, master pages, etc.), save the document as a template.

ONWARD AND UPWARD

Using some of the ideas from the Text Styles script above, create your own with a custom dialog for setting point sizes and leading. Add an option for creating a style for bullets. Save your script in the User’s script folder and give it a keyboard shortcut (see previous blog post). Use the script to jump start creating your paragraph styles in your next document (one created using a preset or from scratch).

Disclaimer:

Scripts provided are for demonstration and educational purposes. No representation is made as to their accuracy or completeness.areaders are advised to use the code at their own risk.