> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Layout alternatives

> Create, copy, import, reorder, and delete layout alternatives so one FlexiLayout can match documents whose element positions vary between subsets.

Sometimes you may encounter documents with identical sets of parameters (blocks), identical rules, and the same language, but with element positions varying greatly from one document to another. In this case, you may create a FlexiLayout that includes several alternative layouts, each layout corresponding to a particular subset of documents with identically positioned elements.

Apart from the layouts, the other processing parameters (pre-recognition/languages, rules, number of pages, and so on) will remain the same for all such documents described by the FlexiLayout.

## How layout alternatives work

Layout alternatives are specified as separate branches in the tree of elements. Thus, instead of one **Group** element (named `SearchElements` by default), you can create several elements, each having its own layout alternative represented by a branch of elements that describes one particular subset of documents. The layout alternatives are independent, and elements in one branch should not refer to elements in another.

The names of layout alternatives (that is, root elements) should be unique. Select descriptive names that reflect the nature of the corresponding document subset.

When matching the FlexiLayout, the program will apply the layout alternatives one by one, top to bottom. If more than one layout alternative matches a document, the first match will be used.

Image areas are specified for the blocks in each layout alternative. For more information, see [Blocks](/flexi-capture/fls/template/blocks).

## Choose a layout alternative for debugging

When debugging the FlexiLayout, you can choose just one layout alternative. To choose a layout alternative, select either the **Select Layout** item from the shortcut menu of the element, or the **Select Alternative Layout** item from the shortcut menu of the FlexiLayout.

## Create a layout alternative

<Steps>
  <Step title="Select the root element of the layout" />

  <Step title="Add the alternative">
    Select **Add FlexiLayout Alternative** from the shortcut menu. The layout alternative will be added to the list.
  </Step>

  <Step title="Open the layout properties dialog box">
    Double-click the layout alternative or select **Properties...** from the alternative shortcut menu.
  </Step>

  <Step title="Specify a name and properties for the layout">
    <Note>
      The name of a layout alternative must start with a letter or an underscore, which may be followed by letters or digits. You may not use spaces or any of the following special symbols: `.`, `,`, `:`, `-`, `\`, `/`. The name may not coincide with any of the [reserved keywords](/flexi-capture/fls/language/r-keywords).
    </Note>
  </Step>
</Steps>

## Copy a layout alternative

Select the layout alternative you want to copy. Holding down the **Ctrl** key and the left mouse button, drag a copy of the layout alternative to the location you want. Alternatively, you can copy a layout by selecting the **Copy** / **Paste** commands from its shortcut menu or by pressing the **Ctrl+C** / **Ctrl+V** combinations.

<Tip>
  Generally, it is easier to copy an existing layout alternative and make some adjustments to it than create a new layout alternative from scratch.
</Tip>

## Import layout alternatives from another FlexiLayout

<Steps>
  <Step title="Select the root element of the layout" />

  <Step title="Select Import FlexiLayout Alternatives">
    Select **Import FlexiLayout Alternatives...** from the shortcut menu.
  </Step>

  <Step title="Select the source FlexiLayout">
    Select the FlexiLayout from which you want to import layout alternatives and click **Open**.
  </Step>
</Steps>

<Note>
  When you try to import a layout alternative from a project with multiple layout alternatives, the program will prompt you to select the layout alternatives you want to import.
</Note>

For the blocks that have identical names in the two FlexiLayouts, the image areas will be added. If the FlexiLayout from which you import layout alternatives has additional blocks, they will also be copied to the current FlexiLayout.

## Import elements and blocks from another FlexiLayout

<Steps>
  <Step title="Select the target layout alternative">
    Select the layout alternative to which you want to add elements from another FlexiLayout.
  </Step>

  <Step title="Select Import Alternative Elements">
    Select **Import Alternative Elements...** from the shortcut menu.
  </Step>

  <Step title="Select the source project">
    In the dialog box that opens, select the project from which you want to import blocks and FlexiLayout elements and then click the **Open** button.
  </Step>
</Steps>

<Note>
  When you try to import blocks and FlexiLayout elements from a project with multiple layout alternatives, the program will prompt you to select the layout alternatives from which you want to import blocks and elements. If the name of an element or block being imported is identical to that in the current FlexiLayout, a number will be added to the name of the imported element or block.
</Note>

## Delete a layout alternative

<Steps>
  <Step title="Right-click the layout alternative">
    Right-click the layout alternative (that is, the branch in the tree of elements) you want to delete.
  </Step>

  <Step title="Select Delete">
    Select **Delete** from the shortcut menu or press **Del**.
  </Step>
</Steps>

You can temporarily disable a layout alternative by selecting **Disable** from its shortcut menu.

## Change the order of layout alternatives

Click the layout alternative you want to move and, holding down the left mouse button, drag it to the location you want.
