Skip to content

Handling multiple files (inputs & outputs) ​

When a paper is split across several files (chapter1.tex, chapter2.tex, appendixA.tex), a single program run can read them together and write one revised file per input.

UI for multiple files ​

Name the files in your request ("polish chapter1.tex and chapter2.tex together"), and the agent lists them on the program run it proposes. To change the list, select Edit on the proposal card.

  • Input Files: The Input group is an ordered list. Use Add input files (), Add opened files as input (), or drag-and-drop to append sources. They are provided together to the program. For programs that edit, the expected output filenames are the selected input filenames in the same order.
  • Fixed Outputs: transcribe, slides and poster write one new document with a fixed name (transcript.tex, slides.tex, poster.tex), whatever the inputs are called.
Input
1chapter1.tex
2chapter2.tex
3appendixA.tex
Row order is the output order: programs that edit reuse each input filename as its output filename.

The Input group is an ordered list; drag to reorder. For programs that edit, the row order is the output order, and each input filename is reused as its output filename.

Multi-file runs are not webview-only. In the terminal, repeated --input flags are the same ordered Input list, and --output-dir collects the per-file artifacts:

texra run
$texra run edit --input chapter1.tex --input chapter2.tex --instruction 'Polish the prose' --output-dir polished
  • Revision 1: draft
  • Revision 2: review and correct
…/polished/chapter1.tex
…/polished/chapter2.tex
One full copied path per output: relative document paths are preserved under the directory.

(Read the file management guide for general UI controls.)

How it works: input ​

When you provide multiple input files, TeXRA combines their content, each under its filename, and includes it in the prompt of every revision. The model sees all the documents together.

How it works: output & extraction ​

This is the part that matters for generating multiple distinct files:

  1. TeXRA determines outputs: Programs that edit use the selected input filenames as the output filenames. Programs that create a document use their fixed filename.

  2. The model replies with structured XML: TeXRA ends every request with the reply format, so the model produces a single XML response containing a separate block for each expected output file:

    xml
    <documents>  <!-- fixed protocol container, not agent-configurable -->
      <document name="chapter2.tex">
        % ... content for the first output file ...
      </document>
      <document name="appendixA.tex">
        % ... content for the second output file ...
      </document>
      ...
    </documents>
  3. TeXRA extracts: TeXRA reads each <document> block of the reply and saves its content in the revision folder under the block's name.

  4. Missing files are reported: If the reply has no <document> block named for an expected output filename, that file is not written for the revision and the run reports it as missing. With --output-dir, the command copies the files it has and then fails, naming the missing ones. A block with a name nobody expected is saved under that name as well.

agent responseone XML message
<documents>
<documentname="chapter2.tex">
% … content for chapter2.tex …
</document>
<documentname="appendixA.tex">
% … content for appendixA.tex …
</document>
<documentname="notes.tex">
% … content for notes.tex …
</document>
</documents>
expected outputsselected input filenames
chapter2.texmatched → saved
appendixA.texmatched → saved
notes.texnot expected → saved as extra

Each <document name="…"> block is saved under its name and checked against the expected output filenames. An expected file with no block is reported as missing; a block with an unexpected name is saved as an extra file.

Next steps ​