TeX Live and TeXstudio
Full TeX Live installation with texlive-full, TeXstudio setup, and fixing the PDF viewer integration on an Ubuntu-based distro.
What This Guide Achieves
| Goal | Status |
|---|---|
| Install a complete LaTeX distribution (TeX Live) | Done |
| Install a professional GUI editor (TeXstudio) | Done |
| Clean up unwanted extras that come with texlive-full | Done |
| Fix apt package management issues after cleanup | Done |
Prerequisites
- Any Ubuntu 24.04-based distro
- ~6 GB free disk space for texlive-full
- Internet connection
- Before removing TeX packages, review the clean installation and removal best practices, especially
--no-autoremoveandapt-mark manual
The Problem (Windows User Perspective)
On Windows, you’d install MiKTeX and get a GUI package manager that downloads LaTeX packages on-the-fly. On Linux, the standard LaTeX distribution is TeX Live. A common low-friction approach is to install texlive-full, which gives you almost everything at once (~6 GB) and greatly reduces missing-package surprises. Then you add TeXstudio as the GUI editor (the Linux equivalent of TeXworks or WinEdt).
Solution
Step 1 — Install TeX Live (Full)
sudo apt update
sudo apt install texlive-full
This takes a while to download (~6 GB) but installs every LaTeX package you’ll ever need: natbib, graphicx, booktabs, longtable, amsmath, hyperref, geometry, and thousands more.
Alternative: Minimal install (~400 MB) if disk space is tight:
sudo apt update
sudo apt install \
texlive-latex-base \
texlive-latex-recommended \
texlive-latex-extra \
texlive-fonts-recommended
Step 2 — Install TeXstudio (GUI Editor)
sudo apt install texstudio
For a newer version via PPA:
sudo add-apt-repository ppa:sunderme/texstudio
sudo apt update
sudo apt install texstudio
Step 3 — Configure TeXstudio
- Open TeXstudio from your app menu
- Go to Options → Configure TeXstudio → Commands — verify paths show
/usr/bin/pdflatex - Set Options → Configure TeXstudio → Build → Default Compiler → select
pdflatex
Key shortcuts in TeXstudio:
| Shortcut | Action |
|---|---|
| F5 | Build and view PDF |
| F6 | Compile only |
| F7 | View PDF |
The full build sequence (pdflatex → bibtex → pdflatex × 2) can be triggered with a single F5.
Cleaning Up Unwanted Extras
texlive-full installs some extra apps you probably don’t need:
| App | What It Is | Needed? |
|---|---|---|
| prerex | CLI tool for drawing course prerequisite charts | No |
| vprerex | GUI editor for prerex charts | No |
| xterm | Classic X terminal emulator | No |
| uxterm | Unicode xterm wrapper (bundled with xterm) | No |
To remove them safely (without breaking your TeX Live installation):
sudo apt remove --no-autoremove prerex vprerex xterm
The --no-autoremove flag is critical — without it, apt will try to remove ~194 packages including essential TeX Live components like biber, texlive-fonts-extra, and texlive-publishers.
Note:
uxtermis not a separate package — it’s bundled insidextermand gets removed with it.
Prevent apt from suggesting TeX Live removal
After removing extras, apt may incorrectly mark TeX Live packages as “no longer required.” Fix this:
sudo apt-mark manual texlive-full
If apt still suggests removing packages, mark the key ones:
sudo apt-mark manual \
texlive-full \
texlive-bibtex-extra \
texlive-fonts-extra \
texlive-formats-extra \
texlive-publishers \
texlive-xetex \
biber \
cm-super
Verify with:
sudo apt autoremove --dry-run
This should show few or no TeX Live packages in the removal list.
What Didn’t Work (and Why)
| Approach Tried | Why It Failed |
|---|---|
sudo apt remove prerex vprerex xterm uxterm (without —no-autoremove) | Cascades into removing 194 packages including critical TeX Live components — 4.5 GB would be lost |
sudo apt remove uxterm separately | uxterm is not a standalone package — it’s part of the xterm package |
Running sudo apt autoremove after removing extras | Incorrectly removes TeX Live packages it considers orphaned |
Verification
# Verify TeX Live is installed
pdflatex --version
bibtex --version
# Verify TeXstudio is installed
texstudio --version
# Verify extras are gone
which prerex vprerex xterm
# Should return nothing
# Compile a test document
echo '\documentclass{article}\begin{document}Hello, LaTeX!\end{document}' > /tmp/test.tex
pdflatex -output-directory=/tmp /tmp/test.tex
# Should produce /tmp/test.pdf
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| TeXstudio can’t find pdflatex | Paths not auto-detected | Options → Configure → Commands → set path to /usr/bin/pdflatex |
| Missing .sty file error during compilation | Minimal install missing a package | sudo apt install texlive-latex-extra or search with apt-cache search <package> |
| apt suggests removing TeX Live packages | Packages marked as auto-installed | sudo apt-mark manual texlive-full |
| Extra apps still showing in menu after removal | Desktop cache not refreshed | Log out and log back in |
Complete Removal
# Remove TeXstudio
sudo apt remove texstudio
# Remove TeX Live (WARNING: removes ~6 GB of packages)
sudo apt remove texlive-full
sudo apt autoremove --purge
Related Guides
- Package Management Basics — Clean install/uninstall practices,
--no-autoremove, andapt-mark manual - APT Repository Issues — Fixing PPA and repository problems
- Software Recommendations — MiKTeX to TeX Live mapping
Discussion