Skip to main content
v2026.11,986 entries · CC-BY 4.0

TeXworks: Free LaTeX Editor, Setup and Magic Comments

TeXworks is a free LaTeX editor with a built-in PDF viewer. Install it, set root, engine and .bib magic comments, and automate BibTeX with latexmk.

Written and maintained by CASRAI Editorial Board

Published

On this page

TeXworks is a free, open-source editor for writing LaTeX documents, with a built-in PDF viewer. This guide covers what it does, where to get it, and the three magic comments (root file, engine, bibliography file) that make thesis and multi-file paper projects work, plus the latexmk setup that automates BibTeX runs. Facts were read from the project’s own pages on 2026-11-12.

What TeXworks is used for in research

TeXworks is “an environment for authoring TeX (LaTeX, ConTeXt, etc) documents, with a Unicode-based, TeX-aware editor, integrated PDF viewer”, inspired by Dick Koch’s TeXShop. It is free and open-source under the GNU GPL v2 or later. Researchers use it to write papers, theses and reports in LaTeX and see the typeset PDF beside the source. It runs on Windows, GNU/Linux and other X11 systems, and macOS, and is built on Qt.

The normal workflow is PDF-centric, using pdfTeX and XeTeX as the typesetting engines. The latest release listed on the project homepage is TeXworks 0.6.11 (February 2026); earlier releases were 0.6.10 (February 2025) and 0.6.9 (February 2024).

Install or access

TeXworks is an editor, not a TeX system: you also need a TeX distribution to typeset. On Windows, TeX Live (since 2009) and MiKTeX (since version 2.8) both include TeXworks, so installing either gives you both. See our MiKTeX guide for that distribution.

To install it separately, use the downloads on the official project page, tug.org/texworks. Binaries are listed for a Windows installer, macOS disk images, and Linux as an AppImage, Flatpak, and packages for Arch, Debian, Fedora, Gentoo, openSUSE and Ubuntu. The source and bug tracker are on GitHub (TeXworks/texworks).

Step-by-step: set up a multi-file project with a root file, engine and bibliography

These settings are written as “magic comments”, lines at the top of a file that begin with % !TEX. They are documented on the TeXworks wiki page “Magic Comments”.

  1. Point chapter files at the root file. In each chapter or section file, put % !TEX root = path/to/root_file.tex at the start. Typesetting from a chapter then builds the whole document from the root.
  2. Choose the engine per file. Add % !TEX program = your_program. The value is the tool name as configured in TeXworks settings, not the executable name.
  3. Declare the bibliography file for citation lookup. Add % !TEX bibfile = file.bib; several files can be comma-separated (for example file1.bib, file2.bib). Then use the Edit menu command Insert Citations… to pick entries. TeXworks does not read the bibliography file from your bibliography command, so this comment is required for that dialog.
  4. Optional: set encoding and spellcheck language. % !TEX encoding = your_encoding and % !TEX spellcheck = language_tag; the available languages are listed under Edit, Spelling.
  5. Optional: add outline bookmarks. A comment such as %: My bookmark label creates a bookmark, shown via Windows, Show, Tags.

Automate BibTeX and reruns with latexmk

The preconfigured typesetting tools include pdfLaTeX, ConTeXt (MKII), XeLaTeX, BibTeX and MakeIndex. To use latexmk instead, open Edit, Preferences…, then the Typesetting tab, and add a tool with the “+” button. The TeXworks wiki (“Advanced Typesetting Tools”) gives this setup:

  • Program: latexmk
  • Arguments, one per line: -e, $pdflatex=q/pdflatex $synctexoption %O %S/, -pdf, $fullname
  • Tick “View PDF after running”.

Confirm latexmk is installed by running latexmk -v in a terminal. The variable $synctexoption expands to -synctex=1; other variables include $fullname, $basename, $suffix and $directory. For choosing a citation style once this works, see the LaTeX thesis template guide.

Output and how to read it

The result is a PDF in the integrated viewer, which is based on the Poppler library. TeXworks uses SyncTeX (by Jerome Laurens, supported by pdfTeX and XeTeX) to link source and preview: control-click in the source to find the matching position in the PDF, and vice versa. The 0.6 series adds continuous scrolling, a two-page spread mode, text selection and copying from the PDF, Alt+left arrow to go back after following a link, and character-level source/output synchronisation. A short manual is available from the Help menu.

Troubleshooting

Symptom Cause and fix (per project documentation)
Nothing typesets after a fresh install TeXworks needs a separate TeX distribution unless you installed TeX Live or MiKTeX on Windows, which include it.
Typesetting a chapter file fails or builds only that chapter Add % !TEX root = path/to/root_file.tex to the chapter file.
Insert Citations lists no entries Add % !TEX bibfile = file.bib; it is not read from bibliography.
Wrong engine is used Add % !TEX program = ... using the name defined in the Typesetting preferences.
latexmk tool does not run Check it is installed with latexmk -v, and recheck the arguments entered in Preferences, Typesetting.

Bugs can be reported on the project’s GitHub issues, and there is a mailing list at tug.org/mailman/listinfo/texworks.

Free alternatives

Option Type CASRAI page
TeXstudio Desktop LaTeX editor TeXstudio guide
Overleaf and similar Online collaborative LaTeX Overleaf alternatives
Other viewers and editors Various LaTeX viewer options

FAQ

Is TeXworks free?

Yes. It is free and open-source software under the GNU GPL v2 or later.

Does TeXworks include LaTeX?

No. It is an editor and viewer; typesetting uses a TeX distribution. TeX Live and MiKTeX for Windows bundle TeXworks.

Which engines does TeXworks use?

The normal workflow uses pdfTeX and XeTeX; pdfLaTeX, XeLaTeX, ConTeXt (MKII), BibTeX and MakeIndex are preconfigured.

Which platforms does it support?

Windows (7 to 11), GNU/Linux and other X11 systems, and macOS.

Sources

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · full access

Ask about TeXworks: Free LaTeX Editor, Setup and Magic Comments

Full access: large monthly usage, up to 10 source passages behind each answer, and MCP and API access for Claude Code, Codex and other CLIs. Cancel any time.

An AI assistant for research: funder rules, compliance, methods and publishing. It links the sources behind its answers and labels answers that come from a web search.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays open to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →