User Guide Cancel

Text variables

  1. InDesign User Guide
  2. Get to know InDesign
    1. Introduction to InDesign
      1. What's New in InDesign
      2. System requirements
      3. Common questions
      4. Use Creative Cloud libraries
    2. Workspace
      1. Workspace basics
      2. Customize your workspace in InDesign
      3. Toolbox
      4. Set preferences
      5. Properties panel
      6. Touch workspace
      7. Default keyboard shortcuts
      8. Undo edits and manage History panel
      9. Document recovery and undo
    3. Generative AI
      1. Text to Image
      2. Generative Expand
      3. Generative AI FAQ
  3. Create and layout documents
    1. Documents and pages
      1. Create documents
      2. Work with parent pages
      3. Work with document pages
      4. Set page size, margins, and bleed
      5. Work with files and templates
      6. Convert PDFs to InDesign files in InDesign (Beta)
      7. Create book files
      8. Add basic page numbering
      9. Number pages, chapters, and sections
      10. Convert QuarkXPress and PageMaker documents
      11. Share content
      12. Understand a basic managed-file workflow
      13. Save documents
    2. Grids
      1. Grids
      2. Format grids
    3. Layout aids
      1. Rulers
      2. Align and distribute objects using rulers
      3. Measure objects using the Measure tool
  4. Add content
    1. Text
      1. Add text to frames
      2. Threading text
      3. South-East Asian Scripts
      4. Arabic and Hebrew features in InDesign
      5. Create type on a path
      6. Bullets and numbering
      7. Glyphs and special characters
      8. Text composition
      9. Text variables
      10. Generate QR codes
      11. Edit text
      12. Align text
      13. Wrap text around objects
      14. Anchored objects
      15. Linked content
      16. Format paragraphs
      17. Format characters
    2. Typography
      1. Using fonts in InDesign
      2. Kerning and tracking
      3. Scale and skew type
      4. Apply color effects to type
    3. Format text
      1. Format text
      2. Auto Style text
      3. Work with Style Packs
      4. Tabs and indents
    4. Review text
      1. Track and review changes
      2. Add editorial notes in InDesign
      3. Import PDF comments
    5. Spell check and language dictionaries
      1. Check spelling, autocorrect, and dynamic spelling
      2. Create, add, and manage dictionaries and words
      3. Change dictionary preferences
      4. Duden dictionary
    6. Add references
      1. Create a table of contents
      2. Footnotes
      3. Create an index
      4. Endnotes
      5. Captions
    7. Styles
      1. Paragraph and character styles
      2. Map, export, and manage styles
      3. Object styles
      4. Drop caps and nested styles
      5. Work with styles
      6. Leading
    8. Tables
      1. Format tables
      2. Create tables
      3. Table and Cell styles
      4. Select and edit tables
      5. Table strokes and fills
    9. Interactivity
      1. Hyperlinks
      2. Dynamic PDF documents
      3. Bookmarks
      4. Buttons
      5. Forms
      6. Animation
      7. Cross-references
      8. Structure PDFs
      9. Page transitions
      10. Movies and sounds
    10. Graphics
      1. Understand paths and shapes
      2. Draw with the Pencil tool
      3. Draw with the Pen tool
      4. Apply line (stroke) settings 
      5. Compound paths and shapes
      6. Edit paths
      7. Clipping paths
      8. Change corner appearance
      9. Frames and objects
      10. Align and distribute objects
      11. Linked and embedded graphics
      12. Integrate AEM assets
    11. Color and transparency
      1. Apply color
      2. Use colors from imported graphics
      3. Work with swatches
      4. Mix inks
      5. Tints
      6. Understand spot and process colors
      7. Blend colors
      8. Gradients
      9. Flatten transparent artwork
      10. Add transparency effects
  5. Find and replace
    1. Find and replace text
    2. Find and replace fonts
    3. Find and replace glyphs
    4. Find and replace using GREP expressions and queries
    5. Find and replace objects
    6. Find and replace colors
    7. Search options to find and replace
  6. Share
    1. Save and access cloud documents
    2. Organize, manage, and share cloud documents
    3. View and manage versions in cloud documents
    4. Common questions about InDesign cloud documents
    5. Share and collaborate        
    6. Share for Review
    7. Review a shared InDesign document
    8. Manage feedback 
  7. Publish
    1. Place, export, and publish
      1. Publish online
      2. Publish online dashboard
      3. Copy, insert graphics
      4. Export content for EPUB
      5. Adobe PDF options
      6. Export content to HTML
      7. Export to Adobe PDF
      8. Export to JPEG format
      9. Export HTML
      10. DPS and AEM Mobile overview
      11. Supported File Formats
      12. Export and import User Settings
    2. Printing
      1. Print booklets
      2. Printer's marks and bleeds
      3. Print documents
      4. Inks, separation, and screen frequency
      5. Overprinting
      6. Create PostScript and EPS files
      7. Preflight files before handoff
      8. Print thumbnails and oversized documents
      9. Prepare PDFs for service providers
      10. Prepare to print separations
  8. Extend InDesign
    1. Automation
      1. Data merge
      2. Plug-ins
      3. Capture extension in InDesign
      4. Scripting
  9. Troubleshooting
    1. Fixed issues
    2. Known issues
    3. Crash on launch
    4. Preference folder read-only issue
    5. Troubleshoot file issues
    6. Unable to export InDesign file to PDF
    7. InDesign document recovery

Create and edit text variables

A text variable is an item you insert in your document that varies according to the context. For example, the Last Page Number variable displays the page number of the last page of the document. If you add or remove pages, the variable is updated accordingly.

InDesign includes several preset text variables that you can insert in your document. You can edit the format of these variables, or you can create your own. Some variables, such as Running Header and Chapter Number, are especially useful for adding to master pages to ensure consistent formatting and numbering. Other variables, such as Creation Date and File Name, are useful for adding to the slug area for printing.

Note:

Adding too much text to a variable may cause overset or compressed text. Variable text does not break across lines.

Create or edit text variables

The options available for creating the variable depend on the type of variable you specify. For example, if you choose the Chapter Number type, you can specify text to appear both before and after the number, and you can specify the numbering style. You can create several different variables based on the same variable type. For example, you can create one variable that displays “Chapter 1” and another that displays “Ch. 1.”

Similarly, if you choose the Running Header type, you can specify which style is used as the basis for the header, and you can select options for deleting end punctuation and changing the case.

  1. If you want to create text variables for use in all new documents you create, close all documents. Otherwise, the text variables you create appear only in the current document.

  2. Choose Type > Text Variables > Define.

  3. Click New, or select an existing variable and click Edit.

  4. Type a name for the variable, such as “Full Chapter” or “Running Title.”

  5. From the Type menu, choose a variable type, specify the options for that type, and then click OK.

    Different options are available depending on the variable type you select.

    Text Before / Text After

    For all variable types (except Custom Text), you can specify text that will be added before or after the variable. For example, you can add the word “of” before the Last Page Number variable and the phrase “total pages” after the variable to create an “of 12 total pages” effect. You can also paste text into the boxes, but special characters such as tabs and auto page numbers are stripped out. To insert special characters, click the triangle to the right of the text box.

    Style

    For all numbered variable types, you can specify the numbering style. If [Current Numbering Style] is selected, the variable uses the same numbering style selected in the document’s Numbering & Section Options dialog box.

Variable types

Chapter Number

A variable created with the Chapter Number type inserts the chapter number. You can insert text before or after the chapter number, and you can specify a numbering style.

If the document’s chapter number is set to continue from the previous document in the book, you may need to update the book’s numbering in order for the appropriate chapter number to appear.

Creation Date, Modification Date, and Output Date

Creation Date inserts the date or time the document is first saved; Modification Date inserts the date or time the document was last saved to disk; Output Date inserts the date or time the document starts a print job, exports to PDF, or packages the document. You can insert text before and after the date, and you can modify the date format for all date variables.

Date Format

You can type date formats directly into the Date Format box, or you can choose format options by clicking the triangle to the right of the box. For example, the date format “MM/dd/yy” displays as 12/22/07. By changing the format to “MMM. d, yyyy” the date will display as Dec. 22, 2007.

Date variables use the language applied to text. For example, the creation date may appear in Spanish text as “01 diciembre 2007” and in German as “01 Dezember 2007.”

Abbreviation

Description

Example

M

Month number, no leading zero

8

MM

Month number, leading zero

08

MMM

Abbreviated month name

Aug

MMMM

Full month name

August

d

Day number, no leading zero

5

dd

Day number, leading zero

05

E

Weekday name, abbreviated

Fri

EEEE

Full weekday name

Friday

yy or YY

Year number, last two digits

07

y (Y) or yyyy (YYYY)

Full year number

2007

G or GGGG

Era, abbreviated or expanded

AD or Anno Domini

h

Hour, no leading zero

4

hh

Hour, leading zero

04

H

Hour, no leading zero, 24‑hour format

16

HH

Hour, leading zero, 24‑hour format

16

m

Minute, no leading zero

7

mm

Minute leading zero

07

s

Second, no leading zero

7

ss

Second, leading zero

07

a

AM or PM, two characters

PM

z or zzzz

Time zone, abbreviated or expanded

PST or Pacific Standard Time

File Name

This variable inserts the name of the current file into the document. It’s commonly added to the slug area of the document for printing or used in headers and footers. In addition to Text Before and Text After, you can choose the following options.

Include Entire Folder Path

Select to include the full folder path with the file name. The standard path conventions for either Windows or Mac OS are used.

Include File Extension

Select to include the file name extension.

The File Name variable is updated whenever you save the file with a new name or to a new location. The path or extension does not appear in the document until it’s saved.

Image Name

The Image Name variable is useful for generating automatic captions from metadata. The Image Name variable includes a Metadata Caption variable type. If a text frame containing this variable is adjacent to or grouped with an image, the variable displays the metadata of that image. You can edit the Image Name variable to determine which metadata field is used.

Last Page Number

The Last Page Number type is useful for adding the total number of pages in a document to headers and footers using the common “Page 3 of 12” format. In this case, the number 12 is generated by the Last Page Number, and it’s updated whenever pages are added or removed. You can insert text before or after the last page number, and you can specify a numbering style. From the Scope menu, choose an option to determine whether the last page number in the section or document is used.

Note that the Last Page Number variable does not count the pages in the document.

Running Header (Paragraph or Character Style)

The Running Header variables insert the first or last occurrence on the page of the text to which the specified style is applied. If no text on the page is formatted with the specified style, the text from a previous page is used.

Custom Text

This variable is commonly used for inserting placeholder text, or a text string that may need to be changed quickly. For example, if you’re working on a project that uses a code name for a company, you can create a custom text variable for the code name. When you are able to use the real company name, you can simply change the variable to update all the occurrences.

To insert special characters in a text variable, click the triangle to the right of the text box.

Insert text variables

  1. Place the insertion point where you want the variable to appear.

  2. Choose Type > Text Variables > Insert Variable, and then choose the variable you want to insert.

The variable appears on the page as if you’d typed it in the document. For example, the Creation Date variable might appear as December 22, 2007. If you choose Type > Show Hidden Characters, the variable instance is surrounded by a box using the current layer color.

Note:

Text variables do not break across lines.

Delete, convert, and import text variables

Use the Text Variables dialog box to delete, convert, and import text variables.

Delete text variables

If you want to delete an instance of a text variable inserted in a document, simply select the variable and press Backspace or Delete. You can also delete the variable itself. When you do so, you can decide how to replace the variables inserted in the document.

  1. Choose Type > Text Variables > Define.

  2. Select the variable, and then click Delete.

  3. Specify how the variable will be replaced by specifying a different variable, converting the variable instances to text, or deleting the variable instances altogether.

Convert text variables to text

  • To convert a single instance, select the text variable in the document window, and then choose Type > Text Variables > Convert Variable To Text.

  • To convert all instances of the text variable in the document, choose Type > Text Variables > Define, select the variable, and then click Convert To Text.

Import text variables from another document

  1. Choose Type > Text Variables > Define.

  2. Click Load, and then double-click the document that has the variables you want to import.

  3. In the Load Text Variables dialog box, make sure that a check mark appears next to the variables you want to import. If any existing variable has the same name as one of the imported variables, choose one of the following options under Conflict With Existing Text Variable, and then click OK:

    Use Incoming Definition

    Overwrites the existing variable with the loaded variable and applies its new attributes to all text in the current document that used the old variable. The definitions of the incoming and existing variables are displayed at the bottom of the Load Text Variables dialog box so that you can view a comparison.

    Auto-Rename

    Renames the loaded variable.

  4. Choose OK, and then click Done.

Note:

You can also copy variables to other documents when you synchronize a book file.

 Adobe

Get help faster and easier

New user?

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online