Copies the text of the report from your Overleaf project into a folder in your working directory, so that you - or an AI assistant such as Claude Code - can read the latest version of the report alongside your analysis. The copy is read-only and is never sent back to Overleaf.

fetch_overleaf_report(
  dir = "report_cache",
  main = "Report.tex",
  chapters = "chapters"
)

Arguments

dir

Folder to put the copy in, relative to your working directory. Defaults to "report_cache". It is replaced each time fetch_overleaf_report() runs.

main

The report's main file. Defaults to "Report.tex". If there's no such file, the top-level .tex file containing \documentclass is used instead.

chapters

Folder holding the chapter files. Defaults to "chapters".

Value

The path of the folder holding the copy, invisibly.

Details

The copy holds:

  • the main file;

  • every .tex file in the chapters folder;

  • the bibliography (every .bib file in the project, such as those in the bib folder);

  • every .tex file in atlas, such as the statistics written by write_overleaf_tex.

Charts and other images aren't copied.

Each run fetches the latest version from Overleaf and replaces the whole folder, so a chapter deleted in Overleaf disappears from the copy too. The files are marked read-only, and the folder holds a .gitignore so it's never committed if your analysis is in a git repository.

Nothing in the copy is connected to Overleaf: fetch_overleaf_report() never commits or pushes anything, and edits to the copy are lost the next time it runs.

For a project that syncs over git, this keeps a second copy of the project in the package's cache, separate from the one used to send your charts (see overleaf_cache_dir). The first run downloads it, so is slower than later ones.

See also

set_overleaf_project to choose the project

Examples

if (FALSE) { # \dontrun{
set_overleaf_project("https://www.overleaf.com/project/0123456789abcdef01234567")
fetch_overleaf_report()
} # }