Skip to content
| Marketplace
Sign in
Visual Studio Code>Themes>TeXLeaf – Overleaf Sync for VS CodeNew to Visual Studio Code? Get it now.
TeXLeaf – Overleaf Sync for VS Code

TeXLeaf – Overleaf Sync for VS Code

Rajesh Shrestha

|
6 installs
| (0) | Free
Edit LaTeX beside its PDF, jump between source and preview, and sync your project with Overleaf and GitHub.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

TeXLeaf – Overleaf Sync for VS Code

Edit LaTeX beside its compiled PDF and use Project Sync to review and synchronize changes with Overleaf and GitHub.

Install and open your first PDF

  1. Use VS Code 1.114 or later. Install a TeX distribution that provides latexmk, synctex, and the engine your project uses. These programs must be available on the machine where the VS Code workspace runs. Git is required for Project Sync.
  2. In the Extensions view, search for @id:rajeshshrestha.tex-pdf-split and install TeXLeaf by Rajesh Shrestha. For a manual installation, download the .vsix from the latest GitHub release and use Extensions → … → Install from VSIX….
  3. Open your project's folder in a trusted workspace, then open its root .tex file (the one containing \documentclass). Run TeXLeaf: Open TeX and PDF Side by Side from the Command Palette.
  4. Press Ctrl+Enter to build. When the PDF appears, Ctrl+click a typeset sentence in either pane to jump to the corresponding position in the other. On macOS, use Cmd+click for the default editor link gesture.

For a quick first build, save this as main.tex in an empty folder and follow steps 3 and 4.

\documentclass{article}
\begin{document}
This sentence appears in both the editor and the PDF.
\end{document}

Moving from the earlier GitHub VSIX

Versions through 0.5.3 used the extension ID local-tools.tex-pdf-split. Disable that copy in Extensions before installing the Marketplace edition to avoid duplicate commands. The texPdfSplit.* settings, keybindings, and Git remotes still apply. If you enabled auto-commit on save, select your files again under TeXLeaf → Project Sync → Configure Auto-Commit on Save because VS Code stores that selection per extension.

Editing and shortcuts

  • Jump between panes. Ctrl+click a word in the TeX editor to highlight the corresponding passage in the PDF. Ctrl+click the PDF to return to its source. The editor follows VS Code’s link modifier (Cmd+click on macOS by default). The PDF accepts either Ctrl+click or Cmd+click. The source toolbar arrow and the PDF’s ← Source button also support navigation.
  • Recompile. Press Ctrl+Enter in either pane, or click Recompile, to save the project sources and run latexmk. SyncTeX navigation uses the latest compilation.
  • Add a passage to Codex. Select text in the TeX editor and press Ctrl+Shift+Enter, or right-click and choose Add Passage to Codex. With an empty selection, the shortcut selects the sentence at the cursor. In the PDF, select text and use the same shortcut or click Add to Codex. The extension maps the PDF selection to its TeX source and attaches the source lines to your current Codex chat draft. Add your question there and send it when ready. This action uses the OpenAI Codex VS Code extension.

Writing tools

Install ChkTeX, GNU Aspell with a dictionary (US English by default), and latexindent on the machine where the workspace runs. Each tool works independently. Run TeXLeaf: Check Writing Tools to test your installation and read the results in the TeXLeaf Output channel.

  • Linting. ChkTeX underlines issues as you edit and lists its rule numbers in Problems. It checks the unsaved contents of the open source file. Set texPdfSplit.lint.enabled to false if another extension already provides these diagnostics.
  • Spelling. Aspell checks prose, including headings and captions. TeXLeaf skips comments, common math and verbatim environments, and citation and reference keys. Use Quick Fix on a marked word to choose a correction or add a technical term to your word list. Set texPdfSplit.spelling.language to an installed dictionary such as en_GB. Set texPdfSplit.spelling.enabled to false to turn off spelling highlights.
  • Formatting. Run Format Document With… → TeXLeaf on a LaTeX or TeX document. TeXLeaf uses latexindent with the editor's tab or space setting. To format on save, add the following to your workspace settings.
{
  "[latex]": {
    "editor.defaultFormatter": "rajeshshrestha.tex-pdf-split",
    "editor.formatOnSave": true
  }
}
  • Editor colors. Open Preferences: Color Theme and choose TeXLeaf Paper, TeXLeaf Night, TeXLeaf High Contrast Light, or TeXLeaf High Contrast Dark. In the high-contrast themes, headings are bold, citations and references are underlined, and the current line and keyboard focus have visible outlines. These themes also style the PDF preview toolbar.

For automatic switching with your operating system, enable Window: Auto Detect High Contrast in VS Code Settings and choose the two TeXLeaf themes under Workbench: Preferred High Contrast Color Theme (dark) and Workbench: Preferred High Contrast Light Color Theme.

Document navigator

Click TeXLeaf in the Activity Bar, or run TeXLeaf: Open Document Navigator. The sidebar can stay open beside the source and PDF.

  • Document Outline follows chapters, sections, and subsections across included files. Click a heading to open its source. Reveal Current Section expands the outline to the heading above the cursor.
  • Document Index lists tables, figures, algorithms, labeled equations, theorem-like environments, command definitions, and labels. Expand a group to browse it. The navigator displays reference numbers and page information from the latest compilation when available.
  • Find Document Entry searches across both views by title, label, section, or filename. Hover over an entry for Show Entry in PDF. For a labeled item, copy its reference or right-click to insert it at the source cursor.
  • Insert Math Symbol searches common mathematical symbols. Use the insert action on a project command under Symbols to insert that command into the active TeX editor.

The outline updates as you edit. Built-in TeX sectioning commands and literal file includes are read from source. Numbering updates after compilation. Use Choose Navigator Root Document from the view menu to switch documents.

Overleaf and GitHub synchronization

Open TeXLeaf → Project Sync in your LaTeX project. Check Sync Status fetches the configured branches and shows how many commits your local branch is ahead or behind. Synchronize fast-forwards to the newest version when it contains all the others. Independent changes stop synchronization and open a choice to review the merge.

  • Auto-Commit Selected Files and Synchronize opens a checklist of changed files, including new files and deletions. Check the whole files to publish and press Enter. The extension saves selected open files, generates a commit message, and synchronizes the branch. Other staged changes keep their staging.

  • Configure Auto-Commit on Save remembers a file selection for this workspace and branch. After you enable it, saving a selected file in VS Code automatically commits its saved contents and synchronizes. Nearby saves are grouped into one commit. Use the same command to change files, pause, resume, or turn it off. A merge or push error pauses automatic publishing. Use Synchronize or Review and Merge Changes to finish, then resume when ready.

  • Both auto-commit pickers include Git-tracked files of any type, including extensionless files such as latexmkrc. New, untracked files qualify when their extension appears in texPdfSplit.sync.fileExtensions. The default list covers LaTeX sources, bibliography and style files, figures, and plot data. Auto-commit on save checks the same rule for each selected file.

  • Using an Overleaf-linked GitHub repository. The default connection uses origin and its default branch. In Overleaf, use Integrations → GitHub → Push Overleaf changes to GitHub to make browser edits visible to VS Code. After synchronizing in VS Code, pull the changes from GitHub in the same Overleaf dialog. Project Sync detects outstanding overleaf-* and overleaf/* conflict branches. Use Review an Overleaf Branch on GitHub for a branch with another name. Overleaf’s GitHub synchronization guide

  • Publishing directly to both destinations. Choose Configure Overleaf Connection and select a separate Git remote or paste the project’s Overleaf Git URL. The extension stores the remote selection in the checkout’s Git configuration and discovers the remote branch. Authentication uses VS Code’s Git environment and your Git credential helper. For Overleaf HTTPS, enter git as the username and your Overleaf Git token as the password when prompted. Overleaf’s Git authentication guide

  • Reviewing competing edits. Commit or stash pending tracked edits before starting. VS Code Source Control can stage individual local hunks for a commit. Review and Merge Changes starts a local merge and lists the differing files, including cleanly merged files. Select a file to compare versions, keep the current file, take the incoming file, or open the Merge Editor for a conflict. You can also edit the working file and choose Stage Edited Resolution. Inspect the staged result in Source Control, then choose Finish Review and Synchronize. If another branch also needs merging, the tool pauses for that review. Abort Merge Review cancels the active merge.

To publish part of your local work, stage files or use Stage Selected Ranges in Source Control, then choose Commit Staged Changes and Synchronize and enter a commit message. Unstaged edits can stay in the working copy when only a push is needed. If the checkout needs a fast-forward or merge, commit or stash remaining tracked edits first. Each push checks that its destination still points to the reviewed commit. If the second destination rejects a push, the tool identifies the completed push and retains the merge commit locally. Run Synchronize again after checking the reported error.

Multi-file projects and build directories

TeXLeaf follows a % !TeX root = ../main.tex directive relative to the chapter containing it. Otherwise it looks for a document with a \documentclass declaration in the source directory and its ancestors inside the workspace. When more than one qualifies, choose your root.

To use the same root for every chapter and place build output in a separate folder, add these settings to .vscode/settings.json. The root path is relative to the workspace. The PDF path is relative to the root document's directory.

{
  "texPdfSplit.rootFile": "main.tex",
  "texPdfSplit.pdfFile": "build/main.pdf"
}

TeXLeaf passes the output directory and SyncTeX option to latexmk. A root directive such as % !TeX program = xelatex selects the engine. If another tool builds the PDF, enable SyncTeX in that build and place the matching .synctex.gz beside the PDF.

Troubleshooting

  • The PDF is blank or the build fails. Open View → Output, select TeXLeaf, and read the first LaTeX error. If VS Code cannot start latexmk, run latexmk -v in the workspace terminal and check the TeX installation.
  • Ctrl+click jumps to the wrong place. Recompile the current source and click a word that appears in the rendered PDF. Check that the PDF and SyncTeX file came from the same build. In the editor, use your configured VS Code link modifier or run TeXLeaf: Show Cursor in PDF.
  • Only GitHub shows the new changes. If the project uses Overleaf's GitHub integration, open Overleaf's GitHub dialog and pull the changes there. With a direct Overleaf remote, run Check Sync Status and inspect the reported error before retrying Synchronize.
  • Overleaf reports an invalid Git repository or an unresolved reference. Run git ls-tree -r HEAD in the document checkout. Entries with mode 160000 are submodule references. If a separate tool repository was accidentally tracked, ignore that directory and remove only its index entry with git rm --cached -- folder-name. Review and commit the removal, then synchronize. If the submodule contains required manuscript files, first decide how to include those files in the project. Overleaf's Git operations guide

License and citation

You may use, modify, and redistribute TeXLeaf. When you share a paper, thesis, presentation, or software project prepared with TeXLeaf or a modified version, cite it in the work or its accompanying documentation. For private work, keep the citation or a copy of the license with your project. Full license terms

Rajesh Shrestha (2026). TeXLeaf – Overleaf Sync for VS Code [software]. https://github.com/rajeshshrestha/tex-pdf-split

Include the version you used when known. On GitHub, select Cite this repository to copy an APA or BibTeX citation. Citation metadata

Source, releases, and support

Browse the TeXLeaf source repository, download a versioned release, or report a reproducible issue. For build or navigation issues, include the extension version, VS Code version, operating system, and a minimal TeX example.

To build the extension from the repository, run npm ci --ignore-scripts --omit=optional, npm test, and npm run package.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft