All posts

Compile LaTeX Locally with TeX Live and Sync to ScienHub via Git

A step-by-step guide to installing TeX Live on Ubuntu, macOS, and Windows for local LaTeX compilation, then using git clone to pull a ScienHub project, editing with VS Code + LaTeX Workshop, and git push to sync back to the cloud.

LaTeXTeX LiveGitLocal Compilation

ScienHub compiles your LaTeX in the cloud out of the box, with nothing to install. But local compilation is still worth having in some cases: writing offline on a flaky connection, getting faster feedback on long documents with many figures, or simply preferring the VS Code editing experience.

The good news: every ScienHub project is a standard Git repository. You can clone it locally, compile with your own TeX Live, and push your changes back — the two stay in sync. This guide walks through it in two steps.

Step 1: Install TeX Live

TeX Live is the cross-platform, full LaTeX distribution. Pick the install method for your operating system.

Ubuntu / Debian

Install the full distribution with apt-get (it bundles every package and font, so you won't hit missing-package errors later):

sudo apt-get update
sudo apt-get install texlive-full

macOS

Install with Homebrew:

brew install texlive

Windows

On Windows, downloading the full ISO from a mirror for an offline install is more reliable than the online installer.

  1. Download the full ISO from a CTAN mirror (about 6 GB, so plan for the wait) texlive2026-20260301.iso.
  2. Once downloaded, extract (or just double-click to mount) the ISO, open the extracted folder, and run the installer install-tl-windows.bat, following the prompts to finish.

Verify the install

After installing, make sure TeX Live's executables are on your system PATH. Open any terminal (on Windows you can use PowerShell) and run:

pdflatex --version

If it prints version info (something like pdfTeX 3.141592653-2.6-1.40.xx (TeX Live 2026)), the install succeeded and PATH is set correctly. If you get "command not found," reopen the terminal, or add TeX Live's bin directory to PATH manually and try again.

Tip: Documents that use CJK characters or system fonts usually need XeLaTeX (rather than pdfLaTeX). You can also run xelatex --version to confirm it's available.

Step 2: Sync a project from ScienHub

1. Install Git

Syncing a project requires Git. If you don't have it yet, install it for your OS:

  • Ubuntu / Debian: sudo apt-get install git
  • macOS: brew install git
  • Windows: download and install Git for Windows

Run git --version afterward — a version number means it's installed.

2. Clone the project with git clone

Open your project on ScienHub, then replace [USERNAME] and [PROJECTNAME] in the command below with your own username and project name:

git clone https://scienhub.com/[USERNAME]/[PROJECTNAME]

Once cloned, you'll have a local directory containing all your .tex, .bib, and image files.

3. Edit and compile with VS Code + LaTeX Workshop

We recommend VS Code with the LaTeX Workshop extension:

  1. Search for and install LaTeX Workshop (James-Yu.latex-workshop) from the VS Code marketplace.

  2. Open the project folder you just cloned in VS Code.

  3. Open your main .tex file and save (Ctrl+S) — this triggers a compile automatically, with a live PDF preview on the right.

  4. For documents that need XeLaTeX, pick the XeLaTeX recipe: click the TeX sidebar on the left → Build LaTeX project → choose latexmk (xelatex), or add a magic comment on the first line of the .tex file to set the compiler:

    % !TeX program = xelatex
    

4. Push your changes back to ScienHub with git push

When you're done, commit the new or modified files and push them back to the cloud:

git add .
git commit -m "Update manuscript"
git push

After the push succeeds, refresh the project on ScienHub and you'll see all your local changes. Your local copy and the cloud are now fully in sync.

Summary

  • Local compilation: install TeX Live (Ubuntu with apt-get, macOS with brew, Windows from a mirror ISO) and verify PATH with pdflatex --version.
  • Cloud sync: git clone to pull → edit and compile with VS Code + LaTeX Workshop → git add / git commit / git push back to ScienHub.

You really can have both online collaboration and local compilation. Don't have an account yet? Head to scienhub.com and create your first project for free.


Get started with ScienHub →