How to Install TeXworks on Ubuntu Linux

TeXworks is a lightweight LaTeX editor that connects directly to your TeX distribution to compile documents into PDFs. Additionally, the editor provides an integrated PDF viewer with SyncTeX navigation, syntax highlighting, and auto-completion for LaTeX commands, making it practical for academic papers, technical documentation, and professional typesetting without the complexity of full-featured IDEs.

Ubuntu offers three installation paths: the official TeXworks PPA delivers the latest stable releases with straightforward APT management, the default repository provides tested versions without additional configuration, and Flatpak offers sandboxed installations at the cost of filesystem permission setup.

Prerequisites

Before installing TeXworks, you need a working TeX distribution since TeXworks is an editor, not a compiler. Without TeX Live installed, TeXworks can open and edit files but cannot compile them into PDFs. First, install the base TeX Live distribution:

sudo apt update
sudo apt install texlive

Alternatively, install the complete package with all fonts (recommended for most users):

sudo apt install texlive-full

The texlive-full package is approximately 5 GB and includes every available LaTeX package. However, if disk space is limited, install texlive for a minimal setup or texlive-latex-recommended for common packages without the full collection.

Choose Your TeXworks Installation Method

Ubuntu provides multiple installation paths with different trade-offs. Before proceeding, review the options below to select the method that matches your workflow:

MethodChannelStabilityBest For
Ubuntu RepositoryDistribution defaultTested with Ubuntu releaseSimplest setup, stability over features
TeXworks PPA (Stable)Latest stableProduction-readyNewest features with official support
TeXworks PPA (Development)Nightly buildsDevelopment buildsTesting new features, contributing feedback
FlatpakFlathub stableSandboxedIsolation from system, consistent across distros

The stable PPA delivers the latest release for most users. In contrast, the default repository provides tested stability without PPA configuration, while Flatpak isolates TeXworks from system packages but requires filesystem permission setup.

Method 1: Install TeXworks from Default Ubuntu Repository

The default repository offers the simplest installation path without external dependencies. While this version may lag behind the latest release, it receives testing from Ubuntu’s package maintainers and integrates cleanly with system updates. To install from the default repository:

sudo apt update
sudo apt install texworks

Once the installation completes, TeXworks becomes available system-wide. This method works well for production environments where stability matters more than accessing cutting-edge features. However, if you need bug fixes or recently added functionality, continue to Method 2 for the official PPA.

Method 2: Install TeXworks via TeXworks PPA

The official TeXworks PPA delivers newer releases directly from the development team. Unlike the default repository, which may ship older versions due to Ubuntu’s release cycle, the PPA tracks upstream development more closely. Consequently, you receive bug fixes, performance improvements, and new features soon after the team releases them. To use the PPA:

Add TeXworks Launchpad PPA

The TeXworks project maintains two separate PPAs for different use cases. Before adding either repository, consider your needs: the stable PPA suits most users who want reliable releases, while the development PPA targets contributors and testers. For production work, select the stable PPA.

Option A: Stable PPA (Recommended)

Import the stable PPA for production-ready releases:

sudo add-apt-repository ppa:texworks/stable -y

Option B: Development PPA (Nightly Builds)

Alternatively, import the development PPA for the latest features and testing:

sudo add-apt-repository ppa:texworks/ppa -y

Install TeXworks

Next, refresh package lists:

sudo apt update

Then install TeXworks:

sudo apt install texworks

Method 3: Install TeXworks via Flatpak

Flatpak packages TeXworks with all dependencies in an isolated container. This approach prevents conflicts with system libraries and ensures consistent behavior across different Ubuntu versions. However, the sandbox restricts file access by default, requiring explicit permission grants to read your LaTeX projects. For users who prioritize isolation over convenience:

If Flatpak is not yet installed on your system, refer to How to Install Flatpak on Ubuntu for setup instructions. The Flatpak version of TeXworks requires filesystem permissions to access your documents; you may need to configure these through Flatseal or command-line options.

Enable Flathub Repository

First, add the Flathub repository if it is not already configured:

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

Install TeXworks via Flatpak

Then install TeXworks from Flathub:

flatpak install flathub org.tug.texworks

Launch TeXworks

Once installed, launch TeXworks from the terminal or application menu:

Terminal Launch Commands

For APT installations, open the terminal and run:

texworks

Alternatively, for Flatpak installations, run:

flatpak run org.tug.texworks

Graphical Launch

Alternatively, click the Activities button in the top-left corner (or press the Super key), then type “TeXworks” in the search bar and click the application icon to launch.

Basic TeXworks Workflow

Understanding TeXworks’ layout helps you work efficiently from the start. Once you launch the application, the interface splits into two main sections: the source editor occupies the left side where you write LaTeX code, while the PDF preview fills the right side to display compiled output. This side-by-side arrangement lets you see changes immediately after compilation without switching windows.

Create Your First Document

To begin, click File → New or press Ctrl+N to create a new document. Then start with a minimal LaTeX template:

\documentclass{article}
\begin{document}
Hello, LaTeX world!
\end{document}

Compile and Preview

After entering content, compile your document to generate the PDF output. To do this, click the green play button in the toolbar or press Ctrl+T to trigger compilation. By default, TeXworks runs pdfLaTeX, which handles most standard documents efficiently. The compiled PDF appears in the preview pane within seconds for simple documents. Meanwhile, the compilation log displays in the bottom panel, listing any errors, warnings, or informational messages that help diagnose formatting issues or missing packages.

Navigate with SyncTeX

Beyond basic editing, TeXworks leverages SyncTeX to connect source code with PDF output. This bidirectional navigation becomes invaluable when editing large documents or debugging formatting issues. To jump from source to PDF, click any line in the editor while holding Ctrl, and TeXworks scrolls the preview to the corresponding rendered content. Similarly, Ctrl+Click anywhere in the PDF instantly highlights the source line that produced that output. This two-way sync eliminates manual searching through long documents when you need to locate specific paragraphs or troubleshoot layout problems.

Manage TeXworks

Update TeXworks

By default, APT installations update automatically with your system packages. However, to check for updates manually:

sudo apt update && sudo apt upgrade

Alternatively, for Flatpak installations:

flatpak update org.tug.texworks

Remove TeXworks

When needed, uninstall TeXworks and remove unused dependencies that were installed alongside it:

sudo apt remove --autoremove texworks

Additionally, if you used the PPA method and do not plan to reinstall, remove the PPA. For detailed guidance on managing PPAs, see How to Remove a PPA from Ubuntu.

To complete the cleanup, remove the stable PPA:

sudo add-apt-repository --remove ppa:texworks/stable -y

Alternatively, remove the development PPA:

sudo add-apt-repository --remove ppa:texworks/ppa -y

Meanwhile, for Flatpak installations:

flatpak uninstall org.tug.texworks

Troubleshooting TeXworks Issues

Compilation Fails or No Output

When TeXworks launches successfully but cannot compile documents, the issue typically stems from a missing or incomplete TeX distribution. The editor depends on external LaTeX compilers to convert source files into PDFs. Without these tools, TeXworks functions as a text editor only. To diagnose this issue, first verify that TeX Live installed correctly:

which pdflatex

In such cases, if the command returns no path, then install TeX Live:

sudo apt install texlive-latex-recommended

PDF Viewer Shows Blank or Does Not Update

The integrated PDF viewer normally refreshes automatically after each successful compilation. However, when the preview stays blank or displays outdated content, the compilation likely failed silently or encountered errors that prevented PDF generation. To diagnose the problem, first check the compilation log panel at the bottom of the window. Look for error messages indicating missing packages, incorrect commands, or syntax problems in your LaTeX source. If the log shows package-related errors, install the missing components:

sudo apt install texlive-fonts-recommended texlive-latex-extra

Flatpak Version Cannot Access Documents

Flatpak’s security model restricts applications from accessing arbitrary filesystem locations by default. Consequently, the Flatpak version of TeXworks may fail to open LaTeX files stored outside its permitted directories, typically limited to your Downloads folder and specific XDG directories. When you encounter permission errors or cannot browse to your project folders, you need to grant explicit filesystem access. For a graphical approach, install Flatseal and enable home directory access through its interface. Alternatively, run TeXworks with expanded permissions directly:

flatpak run --filesystem=home org.tug.texworks

Slow Compilation Performance

When working with large documents that contain many packages or complex graphics, compilation may become noticeably slower. First, verify your TeX Live installation includes required packages to avoid repeated package loading. Additionally, consider switching compilation engines in the dropdown menu next to the compile button. While XeLaTeX and LuaLaTeX offer Unicode support and advanced font handling, they may compile slower than pdfLaTeX for simple documents.

SyncTeX Navigation Not Working

If Ctrl+Click navigation between source and PDF does not work, first ensure your document preamble does not disable SyncTeX. Most modern LaTeX distributions enable SyncTeX automatically; however, older custom configurations may override this behavior. Therefore, check the compilation log for SyncTeX-related messages and verify the .synctex.gz file appears alongside your compiled PDF.

Conclusion

In summary, TeXworks provides a lightweight LaTeX editor with integrated PDF preview, syntax highlighting, and SyncTeX navigation. The installation covers PPA setup for latest releases, default repository options for stability, and Flatpak for sandboxed installations. Your system now runs an editor that compiles LaTeX documents into professional PDFs for academic papers, technical documentation, and typesetting work.

Leave a Comment