Help AI Find the Right Place to Edit in a Long Paper
Use Labels Instead of “the Third Paragraph”
Page and paragraph positions move as a paper changes. Existing labels provide more stable coordinates; \ref and \eqref refer to those same names. This complete example shows the relationship:
\documentclass[11pt]{article}
\usepackage{amsmath}
\begin{document}
\section{Method}\label{sec:method}
We use the update in Equation~\eqref{eq:update}.
\begin{equation}\label{eq:update}
x_{t+1}=x_t-\eta\nabla f(x_t).
\end{equation}
Section~\ref{sec:method} defines the notation.
\end{document}
Place labels after the relevant heading or inside the numbered environment. Include the label name in the request so AI has a specific anchor.
Include the Surrounding Structure
A paragraph alone does not reveal its section or whether it sits inside an equation or another environment. An isolated edit can add or omit an \end. Provide the heading and adjacent text, and identify the target label:
File: chapters/method.tex
Location: the explanatory paragraph under sec:method, before eq:update.
Change only: [paste the target paragraph and one neighboring sentence on each side].
Preserve labels, equations, commands, citation keys, and other subsections.
Return only the replacement paragraph and a change explanation.
Disambiguate Repeated Phrases
If several subsections say “the loss decreases,” that phrase cannot identify one location. Use a sentence that appears exactly once, or provide the label and filename. Search the project first to confirm uniqueness. Once a sentence is rewritten, it is no longer a dependable anchor; a retained label remains useful.
Name the File in a Multi-File Project
Specify both the file and the location within it. A label without a filename can be ambiguous, especially if the project already contains duplicate names.
In a root-based project, give the path from the project root containing main.tex, regardless of the file open in the editor. Each label should be defined once. A duplicate can produce Label 'sec:x' multiply defined and make references unreliable.
Compile and Check the Scope
First compare the result against the requested file and label. Then inspect undefined-reference and undefined-command messages. A renamed or removed label can leave ??; a new project command without a definition can stop compilation. Visual differences still require comparison with adjacent sections in the PDF.
| Message or symptom | Cause | Action |
|---|---|---|
Label 'sec:x' multiply defined | The label occurs in two places | Keep one name and rename the other |
Reference 'eq:y' undefined | Target renamed, removed, or missing | Find the original label and repair the reference or definition |
Undefined control sequence. \method | Missing project command | Include the preamble definition in the context |
| Changes outside the requested subsection | Ambiguous location or missing file | Give the path and label; inspect the returned scope |
Takeaways
- Use labels rather than shifting paragraph numbers.
- Include the enclosing structure and neighboring text.
- Disambiguate with a unique quotation, filename, and label.
- Check both the diff and compilation messages after applying the edit.
In EasyLaTeX, select the intended source around the label, request the change, then verify its scope.