17 Local \(\LaTeX{}\)#
Goal#
Prerequisites#
Basic collaboration account
Installed environment
Steps#
1. Introduction#
\(\LaTeX{}\) is the most powerful tool for scientific writing, since it includes tons of packages and functions for math writing and diagrams/tables. It also is great for bibliography, and you can even write anywhere in \(\LaTeX{}\) within markdown files: typing
This is a markdown text with an inline equation: $E = mc^2$, and a block equation:
$$
E = \nu h
$$
will result in
This is a markdown text with an inline equation: \(E = mc^2\), and a block equation: $\( E = \nu h \)$
2. Setup#
2.1 macOS#
Download and install MacTeX:
(Large package ~4 GB, but includes everything you need.)
After installation, make sure the LaTeX binaries are in your PATH:
echo $PATH
You should see /Library/TeX/texbin.
2.2 Linux (Debian/Ubuntu)#
Update your package list:
sudo apt update
Install TeX Live (basic version):
sudo apt install texlive-latex-base
Or full installation (recommended, larger size):
sudo apt install texlive-full
2.3 Linux (Fedora/RHEL)#
sudo dnf install texlive-scheme-full
### 2.4 Choose an Editor
You can edit .tex files with any text editor, but these are popular:
TeXShop (macOS, included with MacTeX)
TeXworks (lightweight, cross-platform)
VS Code with LaTeX Workshop
3. Execution#
3.1 Create Your First \(\LaTeX{}\) Document#
Create a file named paper.tex:
\documentclass{article}
\usepackage[utf8]{inputenc}
\title{My First Paper}
\author{Your Name}
\date{\today}
\begin{document}
\maketitle
Hello, world! This is my first \LaTeX{} paper.
\end{document}
3.2 Compile the Document#
Using Terminal:
pdflatex paper.tex
After compilation, you’ll find paper.pdf in the same directory.
Note that if you are using bibtex citations in your paper you will need to run:
pdflatex paper.tex # creates structure
bibtex paper # compiles citations
pdflatex paper.tex # adds citations to pdf
pdflatex paper.tex # ensures numbering and indexing is correct
4. Collaborating via GitHub#
LaTeX works well with Git since .tex files are plain text.
Workflow#
Clone this repository
git clone git@github.com:capibara3/papers.git
cd repo
Create a branch
git checkout -b your-branch-name
Go to a directory and add your edits
cd paper-title/
Add and commit your changes
git add paper.tex
git commit -m "Added introduction section"
Push your branch to the remote
git push origin your-branch-name
Open a Pull Request (PR)
6.1 If the PR does not delete or overwrite text → merge directly to update the main document.
6.2 If the PR deletes or changes someone else’s text → request their review and resolve merge conflicts before merging.
Best Practices#
You may:
Create a new branch for each contribution or paper, OR
Reuse the same branch for ongoing edits.
Always write clear commit messages (e.g., Added results section).
Add a .gitignore file to keep the repo clean:
*.aux
*.log
*.out
*.pdf
Consider using GitHub Actions to auto-compile PDFs on each push.
Troubleshooting#
Visit the Overleaf website, they have some resources around \(\LaTeX{}\) troubleshooting and errors. Rice University happens to also have some resources and guides around working with \(\LaTeX{}\), like this summary of basic math commands.
Extra Tips#
Use
latexmkfor automatic builds:latexmk -pdf paper.tex
For bibliography management, install
biberorbibtex.
Next Steps#
Next steps…