# KeepTogether

The `<keepTogether>`tag tries to keep two elements together. This means when there is a page break both elements would move to the next page. This is approximate, so it sometimes will not work.

It can only be used within a [`<body>`](/document-xml-adx/adx-elements/body.md).

## Example

```xml
...
<keepTogether>
  <text>Headline of the following table
  </text>
  <table>
    <tr>
      <td>SOME LONG TEXT</td>
    </tr>
  </table>
</keepTogether>
...
```

## Attributes

#### `spaceBefore` (optional)

Space before the group in pt, mm or cm.

#### `spaceAfter` (optional)

Space after the group in pt, mm or cm.

## Allowed Children

A `<keepTogether>` can contain: `<checkbox>`, `<columns>`, `<field>`, `<image>`, `<line>`, `<rect>`, `<space>`, `<table>`, and `<text>`.

<details>

<summary></summary>

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.atfinity.io/document-xml-adx/adx-elements/keeptogether.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
