SandHouse

Blog

How to write a LaTeX paper with co-authors

To write a LaTeX paper with co-authors, keep one shared copy of the source, split it into one file per section so people don't edit the same lines, and share a single .bib file with agreed citation keys. Settle the preamble and macros before anyone writes much, compile often, and leave comments in the source instead of in email. Before you submit, compile from a clean folder and check references, figures and the journal template.

Where should the source live?

Pick one place for the source and treat it as the only real copy. Emailing paper_v4_final.tex back and forth is how changes get lost. There are three common choices.

An online LaTeX editor such as Overleaf

Overleaf runs in the browser, so nobody has to install TeX. Several people can edit the same project at once, and it has comments, a chat and track changes. It is the tool many co-authors already know. You need a connection to work, and some features depend on your plan, so check what yours includes.

A Git repository with local editors

Each author uses their own TeX install and editor, and the source lives in a Git repository on GitHub, GitLab or your university's server. You get full history, offline work and your own tools. The cost is setup, and two people editing the same paragraph means a merge conflict to sort out by hand. It suits groups who already use Git.

A board on SandHouse

SandHouse has LaTeX spaces where everyone types in the same files at once, with the compiled PDF beside them. The paper sits in the same board as the group's chat, voice calls, meetings and todo board. It is free, runs in the browser, and has no version history of its own yet.

What you needWorks offlineLive co-editingHistory
Online editor (Overleaf)A browser and an accountNoYesYes
Git + local editorsGit, a TeX install, an editorYesNo, you mergeYes, every commit
SandHouseA browser and an accountNoYesNot built in

You can also mix them. Overleaf can sync with Git, and you can download the files from an online editor to keep a copy in a repository.

How do you split a LaTeX document between authors?

Give each section its own file and pull them into a short main.tex. Two people can then write at the same time without touching the same lines, and in Git most changes merge on their own.

% main.tex
\documentclass{article}
\input{preamble}

\begin{document}
\title{Traffic Flow in Small Cities}
\author{Mia Chen \and Tom Okafor}
\maketitle

\input{sections/introduction}
\input{sections/methods}
\input{sections/results}
\input{sections/discussion}

\bibliographystyle{plain}
\bibliography{references}
\end{document}

Use \input for the sections of an article. For a thesis or a long report, use \include for chapters: it starts each one on a new page, and \includeonly{chapters/methods} in the preamble lets you compile one chapter at a time while keeping the page numbers and cross-references from the last full run.

How should co-authors share a bibliography?

Keep one references.bib for the whole paper, not one per author. Agree on a key format before anyone adds entries, such as first author, year and first title word: vaswani2017attention. Then two people citing the same paper end up with the same key.

A few rules keep the file clean:

  • Search the .bib before adding a paper. BibTeX complains about repeated keys, and two keys for one paper split your citations.
  • Don't rename a key someone else made without telling them. Every \cite that uses it breaks.
  • Agree on BibTeX or biblatex at the start, since the commands and styles differ.

Why agree on a preamble and macros early?

The preamble decides how the whole paper looks, and changes there touch everyone's sections. Put it in one preamble.tex, let one person own it, and load packages there only, never inside a section file.

% preamble.tex
\usepackage{amsmath, amssymb}
\usepackage{graphicx}
\usepackage{todonotes}

\newcommand{\R}{\mathbb{R}}
\newcommand{\vect}[1]{\mathbf{#1}}
\newcommand{\dataset}{\textsc{CityRoads}}

\usepackage{hyperref} % load last

Macros for notation are the big win. If everyone writes \vect{x} instead of \mathbf{x}, changing how vectors look later is one line. Agree on label prefixes too, such as fig:, sec: and eq:.

How often should you compile a shared LaTeX paper?

Compile after every few paragraphs, and always before you stop for the day. An error from the last five minutes is easy to find. A missing brace from three days ago, buried under four people's edits, is not.

Make it a group rule that the shared copy always compiles. If you break it and can't fix it quickly, undo your change and ask. Read the warnings too: an undefined reference is easiest to fix the day it appears.

How do co-authors leave comments and track changes in LaTeX?

If your editor has comments, use them. You can also put notes in the source itself, which works in any editor.

The todonotes package puts notes in the margin or in the text:

\todo{Add the 2024 counts here}
\todo[inline, author=Tom]{Is this claim too strong?}
\listoftodos % a list of every open note

Loading it with \usepackage[disable]{todonotes} hides every note at once when you want a clean PDF.

To propose edits to someone else's section, the changes package marks what was added, deleted or replaced, in a color per author:

\usepackage{changes}
\definechangesauthor[name={Tom Okafor}, color=orange]{TO}

We ran the model \replaced[id=TO]{for three days}{overnight}.
\added[id=TO]{This matches earlier work.}

The author of the section accepts or rejects each change. \usepackage[final]{changes} shows the text with every change applied. To compare two whole versions instead, latexdiff makes a marked-up file showing what changed between them.

How do you divide the work and set deadlines?

Give every section one owner. Others suggest changes, but the owner decides what goes in.

Then work back from the submission date:

  1. First drafts of every section.
  2. Internal review: each author reads one section they didn't write.
  3. Freeze: no new content, only fixes.
  4. Final pass: one person reads the whole paper for voice and consistency.
  5. Submission, by the corresponding author.

Write the owners and dates down where everyone can see them, and hold a short check-in each week.

What should you check before submitting a LaTeX paper?

Leave a day for this:

  • Compile from clean. Delete the generated files (.aux, .bbl, .toc and the rest), or run latexmk -C, then compile again. Old files can hide problems.
  • References resolve. No ?? in the PDF, and no "undefined" warnings in the log for citations or labels.
  • Figures. Each is cited in the text, readable at print size, and in a format the journal accepts. Check file name capitals: Fig1.pdf and fig1.pdf are different files on most servers.
  • Journal template. Use their class and bibliography style, and check the page limit, the abstract length and any rules on anonymous review.
  • Notes removed. Disable todonotes, use the final option of changes, and search the source for leftover \todo and % comments you don't want to send.
  • Authors. Order, affiliations, funding and acknowledgments, confirmed by everyone.
  • What to upload. Some submission systems want the generated .bbl file instead of the .bib. Read their instructions.

How do you write a LaTeX paper together on SandHouse?

On SandHouse, the paper and the group working on it live in one board. Make an account, click Start a board, and invite your co-authors. Then add a LaTeX space: click New project space, pick LaTeX under What's it for?, and click Create.

Start the document and split it

Choose New document. It opens with a short article in main.tex, ready to compile. In Files, use + and type a path like sections/methods.tex to put a file in a folder, then \input it from main.tex. The upload button adds figures (PNG, JPEG, PDF) and a journal's .cls or .sty file.

Share one library of references

Each LaTeX space has one library of references, shared by all its documents. Open References, type a DOI, an arXiv id or words from a title, choose Find, then Add, or choose Paste BibTeX. Every reference gets a key like vaswani2017attention, so the key format is decided for you, and typing \cite{ offers them. When you compile, the library becomes references.bib.

Write and compile together

Everyone with the document open sees each other's typing within a moment, and nobody's typing is lost or saved over. Choose Compile or press Ctrl+S (Cmd+S on a Mac), and everyone with the document open sees the new PDF. Errors show under the PDF; click one to jump to its file and line.

Documents compile with XeTeX (Tectonic) and BibTeX, with the usual journal classes such as revtex4-2, acmart, elsarticle, IEEEtran and llncs. A template that only works with pdfLaTeX may need small changes, so try your journal's template in the first week, not the last.

There are no built-in comments or tracked changes, so use todonotes and changes as above. Members with the viewer role can read the files and the PDF but not change them, which suits a supervisor who wants to follow along.

Plan the work around it

Put a work item for each section on a todo board, with an Assignee and a Due date. Talk in the board's text and voice channels, and schedule the weekly check-in under Meetings. To point at the paper from your notes, type /embed in a page. If you work with an AI assistant, connect it to the board and it can edit the files, compile, read the errors and add references.

Questions people ask

What's the difference between \input and \include in LaTeX?

\input pastes a file's text in place, as if you had typed it there, and works anywhere. \include always starts a new page and can't be nested, but it works with \includeonly, so you can compile one chapter at a time. Use \input for sections of an article and \include for chapters of a thesis or book.

Can two co-authors edit the same LaTeX file at the same time?

Yes, in an editor with live co-editing, such as Overleaf or a SandHouse LaTeX space, each person sees the other's typing. With Git, two people can edit the same file, but if they change the same lines, someone merges by hand. Splitting the paper into one file per section avoids most of that.

How do you avoid duplicate citation keys?

Agree on a key format before anyone adds entries, such as first author, year and first title word. Keep one shared .bib and search it before adding a paper. Importing entries from the DOI also helps, since everyone gets the same details for the same paper.

Is there a free way to write LaTeX with co-authors?

Yes. A Git repository with a free TeX distribution such as TeX Live costs nothing, Overleaf has a free plan, and SandHouse is free to use. Choose Git if your group already uses it, an online editor if you want nothing to install.