Advertisements

Please fix Text Variables so they behave like regular text

Within the type menu of Adobe InDesign is the Text Variables feature. This allows users to insert a special character that will display one of the following items:

  • A chapter number
  • A file-related date such as the creation date, modification date or output date
  • Filename
  • Image Name (aka captions setup)
  • Last Page Number
  • Running Header based on either a used paragraph or character style
  • Custom static text

Unfortunately, there is an unwanted behaviour of the text variables – InDesign treats them as a single character rather than the actual content within the variable. This has a few unwanted consequences:

  • Long variables that would normally break over several lines are squished into one line;
  • They cannot be formatted using GREP or Nested styles, nor can specific words be manually selected for formatting.

It’s an issue that is “in backlog” by the Adobe InDesign team to address, but that was first stated in 2017.

If the issue was resolved, it would have enabled my GREPGraph solution to be applied in the following InDesignSecrets article.

As it turns out, it is also affecting another solution that would make lives easier for anyone who has to create diaries and planners on a regular basis.

The brief:

A planner is created by making a base template and then creating threaded text for the dates that are represented only by numbers. This makes populating a diary from week to week relatively easy…

…until the other material has to be populated, such as what month it is, what term it is, and what week it is. This is best illustrated in the first two minutes of a Youtube video by Rob Cubbon.

Incidentally in Rob’s video, he uses frame breaks between each record, but that isn’t required. Instead, adjust the paragraph style of the numbers by going to the Keep Options and from the Start Paragraph dropdown, select In Next Frame.

The technique:

Instead of populating the text frames simply with numbers, what if the frames were populated with more information that can be called upon by running header text variables, such as the month?

I can make a list in excel that contains the day of the week and the month in one column. This is also done without a space intentionally for reasons that will become evident soon.

I can then copy this text to my InDesign file. However, note that the text overflows and isn’t correct – that is because the flowing numbers need to have a character style that will hide the text that we want to be visible elsewhere. To do this, I’ve created a character style called hidden, and its properties are:

  • .1 point high;
  • 1% wide;
  • No fill or stroke.

That’s fine, but applying that manually to everything but the numbers will be a nuisance, so the paragraph style for the numbers has to be modified using Nested Styles.

The nested style will apply a style of [None] to the digits as they need to be visible, but will intentionally hide the month.

So why I am I intentionally hiding the month? Because I’m only interested in the information it represents, and this can be called upon by a text variable. I will go to the master page and insert a text variable for a running header showing me the first result of hidden on the page.

The issue with the technique

That’s fine until I get to a spread that contains two months. I’d rather both months be present rather than the earlier month. For example, I’d like the headline to read April/May instead of April. I can do this by returning to my master page, apply my blinking text cursor to the text variable that is already there, type a slash and then create a new text variable that is a running header looking for hidden character style in the last instance.

Once I’ve inserted the variable and returned to that spread, that now looks fine, but all others are now affected.

I should be able to make a GREP style that will look for a word, then a backslash, and the same word it initially found. I’ll create a new text frame with some sample text to see if it works. The GREP code I’ll use is this:

Apply style: Hidden

GREP: (.+?)\K\/\1

Looks like its working in my demo, but as I check the document it isn’t… I’ll find a spread where I know the months split.

But that should work. I saw it work on plain text, why isn’t it working on text variables? That’s because GREP styles and Nested Styles don’t work on text variables. If I want this technique to work, I’ll have to use a workaround.

The workarounds:

  • Use a script to convert the text variables to plain text. Marijan Tompa used to have such a product via the Adobe Exchange, but it has since been removed, and it is not mine to give away. Other scripts do exist on the Adobe InDesign forums, but they are not as flexible as Marijan’s original script. It also works only one way, and can’t convert the text back to variables.
  • Don’t attempt to use the GREP style to hide the duplicate month, but instead only add a Running Header for the first instance on a page and add the others manually by overriding the affected master pages;
  • Create the desired date in Excel using a formula.

The issue with the first two solutions is that it prevents the solution from remaining live. The last solution will work but requires in-depth knowledge of Excel and – for many diaries – requires having an Excel file on stand-by for this purpose.

Ultimately, I’d love to see a fix for this issue as it would open up many possibilities. If you feel that this needs attention now rather than later, please cast your vote here.

Advertisements

Using character styles for dot leaders

The topic of tabs and leaders has been covered on InDesignSecrets before in a 6-part series but it’s worth sharing this particular tip as it saves me plenty of heartache in my day-to-day role.

Usual technique

The usual practice of creating a dotted line (usually for either leading up to a page number in a table of contents OR preparing a space for users to add information to a handwritten form) is often accomplished by the tabs feature. For example:

This is achieved by making a paragraph style that has a tab stop that has been right-aligned to the end of the text frame, and in the leader text field of the tab dialog box, a period has been entered, and it is this period that repeats to generate the dotted line.

Issues with this technique

However, I find this is quite restrictive in terms of:

My preferred technique

Instead, I prefer to make a character style called “dotted line” giving it the dotted line appearance that I’m after in the underline panel of the character style dialog box.

If more control is required, I can also prepare a stroke style specifying the dot style and frequency that the dots appear.

I can then either apply the character style manually to the areas requiring the dotted lines, or I can make a paragraph style that calls the dotted line character style using a GREP style that looks for tab spaces.

Bonus tip

Note that my GREP style is looking for \t|~y rather than just \t – the ~y represents a right indent tab. For dot leaders that need to go to text at the end of a text-frame, I prefer to use a right indent tab instead of setting a right align tab, because if the text frame changes width and I want the right aligned item to remain right aligned to the text frame, I don’t have to adjust the tab stop of the right align tab.

To insert a right indent tab, press SHIFT+TAB. This will work anywhere in a text frame except within a table where it will highlight the previous cell. To apply a right indent tab inside a table, either insert one via right-clicking to call upon the contextual menu, then navigate to Insert Special Characters, Other, then Right Indent Tab.

Otherwise, it can be called upon by opening the quick-apply menu via COMMAND+RETURN on Mac (or CONTROL+RETURN on Windows) and type either Right Indent Tab (or, if you’re really lazy – nt tab as highlighted in pink in the figure below).

Wrangle up InDesign index entries… without InDesign.

A recent project involved creating an enormous index… in fact there were over 100,000 index entries to create.

Creating index entries is normally a chore. To create just one index entry, the normal procedure is to:

  • Highlight the text to be indexed
  • Select “New Page Reference” from the index palette (or command + 7)
  • Enter the details and click Add (or Add All) then OK

indexref1

indexref2

In a normal book, indexing is something that is done carefully by the author or staff dedicated to the task – entries in the index often refer to certain instances of a word rather than every instance of its use. This project however used the index as a lookup table instead, so the more advanced features of the index palette (e.g. see also references, index levels) were not necessary.

For this project, the items to be indexed were restaurant names. The name appeared in the same line as the description, so using a Paragraph Style to identify the item for an index entry could not be used. However, the restaurant names DID have a Character Style associated with them.

Because there were 100,000 index entries in this book and each entry had its own character style, there were easier methods to perform this task. There are several scripts online that can create index entries from character styles:

For this project, because there were two character styles used to identify the restaurant names, I used Peter Kahrel’s script. While testing the script on a sample chapter, everything appeared to work correctly… it took time but all the names in character styles were added to the index.

However, when the time came to apply this script to a document 1,628 pages long, the script would run, and then the spinning beach-ball of death would appear. Assuming I was not allowing the script enough time to finish its tasks, an attempt was made to let the script run over a weekend on the fastest machine in the office. Sadly, this did not work. Put simply, there were just too many entries for the machine to handle.

Enter Textwrangler…

Luckily, all the text for this project, while many pages long, was all in one text frame. This provided the option to enter the index entries while the document was in a raw text format. To do this, the text was exported as an Adobe InDesign tagged text file by placing the cursor anywhere in the text and selecting File/Export (command + E).

indexref3

The newly saved text file was then opened in Textwrangler. The a find/change using Textwrangler’s GREP was then made for the following:

indexref4If the code is hard to see in the picture, here is the type:

Find:

(<cstyle:placename>)(.+?)(<cstyle:>)

*placename above refers to the style to index.

Replace:

<Idx:=<IdxEnType:IdxPgEn><IdxEnRngType:kCurrentPage><IdxEnDispStr:\2>>\1\2\3

(make sure the Grep checkbox is ticked)

Once the changes in the text files were saved, the type was imported in place of the old text in the InDesign file, and within moments the document was completely indexed as required.

The only other part that took time was to run the “Generate Index” function from InDesign itself, and considering the amount of index entries in the document, took an hour to generate.

%d bloggers like this: