Set or reset the Overleaf project location

set_overleaf_project(project = NULL)

Arguments

project

One of: an Overleaf project URL (like "https://www.overleaf.com/project/0123456789abcdef01234567"), a project name fragment (like "Orange Book"), a full project name (like "Orange-Book-2025"), or a full file path to an Overleaf project folder. If NULL (the default), you will be prompted to select from available Dropbox projects.

Value

The full path to the selected Overleaf project folder, invisibly. For git projects this is the local clone, which the package manages for you; see overleaf_cache_dir.

Details

This function lets you choose which Overleaf project to save charts to when using grattan_save_overleaf(). The setting is stored as an environment variable for the current R session only.

Charts can reach Overleaf two ways, and which one you get depends on what you pass to this function:

Git

Give it the URL of your project, copied from your browser's address bar while the project is open in Overleaf. Charts are committed and pushed to Overleaf directly, and nothing needs to be synced to your computer. This needs a one-off token: see set_overleaf_token.

Dropbox

Give it a project name, a fragment of one, or a path, or nothing at all to pick from a menu. Charts are written to the project folder in your Dropbox, and Dropbox syncs them to Overleaf.

Since this setting only persists for the current R session, we recommend calling set_overleaf_project() at the beginning of your script, or in a project setup script or .Renv file, to improve reproducibility. This is especially worthwhile with a project URL, since the URL then travels with your code: colleagues who run your script save to the same Overleaf project without having to set anything up.

See also

set_overleaf_token to store your Overleaf git token, overleaf_push to send saved charts to Overleaf

Examples

if (FALSE) { # \dontrun{
# Sync via git, using the URL from your browser
set_overleaf_project("https://www.overleaf.com/project/0123456789abcdef01234567")

# Prompt to select from available Dropbox projects
set_overleaf_project()

# Search for a project by name fragment
set_overleaf_project("Orange")  # Finds "Orange-Book-2025"

# Use exact project name
set_overleaf_project("Orange-Book-2025")

# Manually set a specific project path
set_overleaf_project("/Users/you/Dropbox/yourname/Apps/Overleaf/My Report")

# Call at the start of your script for reproducibility
set_overleaf_project("transport-report")
# ... rest of your script
} # }