Awesome-Agent-Skills-for-Empirical-Research sync-tex
Transfers prose edits from latex/index.tex (Overleaf) back into index.qmd. Use after pulling LaTeX edits from a collaborator.
install
source · Clone the upstream repo
git clone https://github.com/brycewang-stanford/Awesome-Agent-Skills-for-Empirical-Research
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/brycewang-stanford/Awesome-Agent-Skills-for-Empirical-Research "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/29-quarcs-lab-project20XXy/dot-claude/skills/sync-tex" ~/.claude/skills/brycewang-stanford-awesome-agent-skills-for-empirical-research-sync-tex && rm -rf "$T"
manifest:
skills/29-quarcs-lab-project20XXy/dot-claude/skills/sync-tex/SKILL.mdsource content
Sync LaTeX Edits to QMD
Transfer prose changes made by collaborators in
latex/index.tex (e.g., via Overleaf) back into index.qmd.
Prerequisites
must exist (auto-created bylatex/.baseline.tex
)bash scripts/render.sh
must contain collaborator edits (pulled from Overleaf / GitHub)latex/index.tex
Steps
-
Read these three files:
— the LaTeX snapshot from the last render (before edits)latex/.baseline.tex
— the LaTeX after collaborator editslatex/index.tex
— the current QMD manuscript sourceindex.qmd
-
Compare
vslatex/.baseline.tex
to identify changes. Focus on the document body only (everything betweenlatex/index.tex
and\begin{document}
). Ignore the preamble (lines before\end{document}
) — these are auto-generated by Quarto.\begin{document} -
For each section (identified by
and\section{...}\label{...}
markers), check if the prose text changed between baseline and modified.\subsection{...}\label{...} -
For each changed section, apply the edits to the corresponding section in
:index.qmd- Convert LaTeX formatting to QMD equivalents:
→\textbf{...}**...**
or\textit{...}
→\emph{...}*...*
→\href{url}{text}[text](url)
→Section~\ref{sec-id}@sec-id
→Figure~\ref{fig-id}@fig-id
→Table~\ref{tbl-id}@tbl-id
or\cite{key}
→\citep{key}[@key]
→\citet{key}@key- Footnotes:
→\footnote{...}^[...]
- CRITICAL: Preserve all
shortcodes exactly as they are in the QMD. Do NOT replace them with{{< embed >}}
,\includegraphics
,\begin{figure}
, or any LaTeX equivalents. These shortcodes pull live outputs from notebooks and must remain intact.\begin{longtable} - If a collaborator edited a figure/table caption in LaTeX (
), note the change in the summary report but do NOT modify the embed shortcodes — captions are defined in the notebook source cells.\caption{...}
- Convert LaTeX formatting to QMD equivalents:
-
After applying all changes, show a summary:
- List each section that was modified
- For each, show a brief description of what changed (e.g., "Added two sentences to Introduction", "Rewrote paragraph 2 in Methods")
- Note any changes that could NOT be transferred (e.g., caption edits, preamble changes, new LaTeX packages)
-
Render the manuscript with
to verify the round-trip is clean (no warnings, no errors).bash scripts/render.sh
Error handling
- If
does not exist, tell the user to runlatex/.baseline.tex
first./project:render - If
andlatex/.baseline.tex
are identical, report "No changes detected" and stop.latex/index.tex - If a section label in the LaTeX does not match any section in
, flag it and skip.index.qmd