paged.IDML Reference
Conditional text

Visibility

When conditional text prints — a run under a hidden condition, a run under several conditions (shown while any is visible), sets and indicators.

Tier: ProProIIIexplanation

Hidden conditional text stays in the story but is left out of the page, and the visible text closes up around it.

In short Whether a run prints depends on the Visible flags of the conditions it names in AppliedConditions. A run with no conditions always prints. A run with one condition prints when that condition is visible. Hidden text is not composed at all: it takes no space, and the lines are set as though it were not there. A run that names several conditions, some visible and some hidden, is the open case: the rule InDesign applies to it is being verified. Condition sets and indicators do not decide visibility by themselves.

One condition

For a run that names a single condition, the condition's Visible attribute is the whole answer:

  • Visible="true": the run prints.
  • Visible="false": the run is left out.

The hidden run is not painted over or blanked. It is removed before the text is composed, so it takes no width, the following text moves up to fill its place, and line breaks are found as though its characters did not exist. The characters are still in the story part; anything that reads the story's text gets them.

Several conditions on one run

AppliedConditions can list several conditions. InDesign shows the run while any one of its conditions is visible; only when all of them are hidden is the run left out. In the example below, BOTH carries the visible Print condition and the hidden Draft condition, and InDesign prints it.

Four runs: ALWAYS, PRINTONLY (visible condition), DRAFTONLY (hidden condition) and BOTH (one visible, one hidden). InDesign prints ALWAYS, PRINTONLY and BOTH.

Stories/Story_ustory.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<idPkg:Story xmlns:idPkg="http://ns.adobe.com/AdobeInDesign/idml/1.0/packaging" DOMVersion="20.0">
  <Story Self="ustory">
    <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/$ID/[No paragraph style]">
      <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/$ID/[No character style]">
        <Content>ALWAYS </Content>
      </CharacterStyleRange>
      <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/$ID/[No character style]" AppliedConditions="Condition/Print">
        <Content>PRINTONLY </Content>
      </CharacterStyleRange>
      <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/$ID/[No character style]" AppliedConditions="Condition/Draft">
        <Content>DRAFTONLY </Content>
      </CharacterStyleRange>
      <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/$ID/[No character style]" AppliedConditions="Condition/Print Condition/Draft">
        <Content>BOTH</Content>
      </CharacterStyleRange>
    </ParagraphStyleRange>
  </Story>
</idPkg:Story>

This was measured in InDesign 20.0.1 by toggling the hidden condition in the opened file and exporting a PDF: the output read "ALWAYS PRINTONLY BOTH". One more observation from the same test: straight after opening this minimal file, InDesign composed it with the hidden condition still showing, and applied the visibility only once a condition's visibility changed. Its own files may behave differently; the cause is not known.

In Paged: a run is hidden when any condition it names is hidden, so BOTH does not print in the live view. That differs from InDesign and is a known engine issue. Hidden runs are removed before layout, so a story can report more runs than the page shows.

Supported · verified

Sets and indicators

A ConditionSet stores a combination of visibilities; it does not hide anything by itself. Applying a set in InDesign changes the conditions' Visible flags, and those flags, saved on each Condition, are what a reader sees. ActiveConditionSet in ConditionalTextPreference only records which set was applied last.

A condition's indicator (IndicatorMethod and the IndicatorColor property) marks conditional text on screen while editing and has no effect on which text prints.

In Paged: visibility comes from each condition's own Visible flag; the active-set preference is not read. Scripts can change a condition's visibility, or activate a set, which shows its members and hides every other condition. Indicators are not drawn.

Tracked

Frequently asked questions

Does hidden conditional text take up space? No. It is left out before the text is composed, so the visible text closes up around it. The characters stay in the story part.

What happens to a run with two conditions when one is hidden? It prints. InDesign shows a run while any one of its conditions is visible, and leaves it out only when all of them are hidden.

Does a condition set decide what is visible? Not directly. Applying a set changes each condition's Visible flag, and the flags are what decide. ActiveConditionSet only records the set applied last.

Do condition indicators print? They are an editing aid controlled by ConditionalTextPreference; with the ShowIndicators value found in every census document, they appear on screen only.

On this page