XeTeX on Windows

I switched from Ubuntu to Windows 10 a few days ago. After eight years of macOS and then a year of Linux, I wanted to circle back to Windows.1 Since my latest writing project relies on XeTeX, a lesser-known typesetting engine within the already obscure TeX world, I expected some trouble recreating my workflow in Windows; I was not disappointed.2 This post explains the steps I went through to create a functional TeX writing environment in Windows 10.

Step #0: (Optional) Install Chocolatey #

Chocolatey is a package manager for Windows. Like apt or yum on Linux, Chocolatey provides a simple command line interface through which to install, update, and manage applications. Its rich catalog contains every program I use on a regular basis, from open source software like git to paid software like Sublime Text. Instead of manually finding and installing tens of applications, with Chocolatey I simply build a list of applications and let it handle the rest. Even better, when it comes time to update them, a single command gets the job done. No more homegrown update mechanisms or, worse, manual updates. Chocolatey takes away the pain of application management on Windows.

Although not necessary, Chocolatey does make the process of setting up a TeX writing environment easier. The next step relies on Chocolatey to install a TeX distribution and a TeX editor, although you can complete it manually if you so desire.

Step #1: Install TeX Live and TeXstudio #

Start by installing a TeX distribution and a TeX editor. The former will give you access to the back-end necessary to transform TeX documents into PDFs, and the latter will give you a front-end through which to create those TeX documents and manage the build pipeline. Although several TeX distributions exist for Windows, I chose TeX Live. Fewer TeX editors seem to exist for Windows, so I went with what appeared to be the most popular: TeXstudio.

Many modern text editors like Visual Studio Code and Sublime Text offer plugins for writing, building, and previewing TeX documents. I have had mixed experiences with these in the past, so I opted for standalone TeX tools this time around. I may reevaluate that decision later.

The commands below use Chocolatey to install TeX Live and TeXstudio.

choco install texlive choco install texstudio

Step #2: Install XeTeX #

Once TeX Live and TeXstudio install, open the TeX Live Manager. The resultant window, misleadingly named “TeX Live Shell”, is the graphical user interface through which you will manage all packages and typesetting engines on your local machine. For now, we will use it to install the XeTeX typesetting engine.

In TeX Live Manager, click the “Not installed” radio button in the “Status” section to list packages not present on your local machine. Next, type “xetex” in the “Search” text box to its right. Find the package “xetex”, right-click it, then click “Install”. XeTeX will install in a few seconds. Once the “Logs” window status changes from “Running” to “Idle”, click the “Close” button.

Step #3: Configure the Build Pipeline #

Next, open TeXstudio. TeXstudio defaults to building TeX files with the LaTeX typesetting engine, but it also makes changing that preference easy. Since my project requires XeTeX, I changed the default to XeLaTeX.

In TeXstudio, click “Options” in the top menu bar, then click “Configure TeXstudio...” Once the settings window opens, click the “Build” item on the left, then change the “Default Compiler” setting to “XeLaTeX”. Click “OK” to save this setting.

Step #4: Build the Document in TeX Studio #

Finally, build your TeX document by opening it in TeX Studio and then clicking the green “Compile & View” button, or by hitting the F5 key. If the build fails, you can use the “Messages” and “Log” panes near the bottom of the screen to find out why.

For any missing packages, go back to TeX Live Manager, click the “Not installed” radio button, search for the missing package, right-click it, and then click “Install”. Try to rebuild the document and repeat this process until it succeeds. Once it does, you should see the PDF output on the right side of your screen.

Step #5: (Optional) Build the Document in PowerShell #

With XeTeX installed, you can now also invoke it throgh PowerShell. The command below uses XeTeX to build the file “main.tex” in the current working directory.

xetex.exe main.tex

I had a lot of problems with Ubuntu, but my TeX wormflow was not one of them. Fortunately, after a bit of trial and error, I was able to replicate that level of functionality on Windows — and now you can, too.

 Briefly, because Windows versus Linux (versus macOS) is not the point of this post: 2022 is not the year of Linux on the desktop. It’s good, but not great, and until that operating system becomes an appliance rather than a tool, it will remain so. As for Windows versus macOS, I continue to default to Apple products across all verticals; those who actually need Windows (or a non-Apple device) understand their needs well enough to ignore my recommendation or not ask for it in the first place.

 In Ubuntu, sudo apt-get install texlive-full did the job.

Permalink.