Converting TeX Files
Pandoc can be used to convert file types and most commonly is used to convert .tex files to .docx or .html.
Note: this process varies slightly between PC and Mac. The Using Pandoc video gives a good overview of the steps for both. You can also learn more at Getting started with Pandoc.
Install Pandoc
The simplest way to get the latest pandoc release is to use the installer: Pandoc Installer
Pandoc must be installed on your computer in order to convert files.
File Setup
Before converting, make sure your LaTeX file is easy to reference from the command line.
Save the
.texfile somewhere you can easily navigate to (Desktop is fine).To avoid command-line issues, it’s easiest if the filename has no spaces (or wrap the filename in quotes when you run the command).
Example filenames:
module11.tex"Module 11.tex"(works if you use quotes)
Command Prompt or Mac Terminal
You’ll run the Pandoc command from a command-line window.
Windows (Command Prompt):
Open Command Prompt
-
Navigate to your Desktop:
cd %USERPROFILE%\Desktop
Windows (PowerShell):
Open PowerShell
-
Navigate to your Desktop:
cd $env:USERPROFILE\Desktop
Mac (Terminal):
Open Terminal
-
Navigate to your Desktop:
cd ~/Desktop
Tip: You can type dir (Windows) or ls (Mac) to confirm your .tex file is in the current folder.
Use the following format to convert your file:
pandoc filename.tex -s -o filename.extension
Beginning with “pandoc” will run the Pandoc program. Then, you will list the file name of the file to be converted. “-s” will produce a standalone document, and “-o" tells Pandoc to output to a file. Finally, end with the name of the file you want to create.
Conversion Command Examples
Word:
pandoc module11.tex -s -o module11.docx
HTML using MathML:
pandoc Assignment-6.tex -s --mathml -o Assignment6_mathml.html
(MathML is often helpful for HTML conversions, but see the Canvas notes below about browser differences.)
Common Command Errors
If Pandoc fails or the output looks wrong, try the following:
Check your file path and name: Confirm you are in the same folder as the
.texfile and that the filename matches exactly (usedir/ls).Special characters and formatting: Problems can come from stray characters, unescaped symbols, or formatting that LaTeX tolerates but conversion tools do not.
Isolate the problem area: If the file won’t convert, comment out sections of the document (remove half at a time) until it works, then narrow down to the specific block causing the issue. Common causes include unmatched braces
{}, unclosed environments, or broken commands.
If you see unexpected \hbox{\strut}
This often comes from a macro/package or generated LaTeX. Try simplifying/removing custom macros or converting from a cleaned/minimal source. Only remove \hbox{\strut} if you’ve confirmed it was introduced accidentally and the document still compiles correctly.
Format the Final Version of the Converted File
After converting .tex to your desired file type, there is some formatting required to apply EP templates and/or pull in any images that were in the original file.
Word files
Copy all the text in your new Module_11.docx and paste it into our Word template. Apply heading styles as needed.
Equations will be in Word’s built-in equation editor.
Ensure that equations are in Professional format (not LaTeX view).
Insert any images as needed and inline with text.
Canvas pages
Paste the HTML code into the HTML editor and apply appropriate headings. The first heading on a Canvas page should be an <h2>.
For any equations that did not convert correctly:
Use the original LaTeX or EquatIO’s screenshot tool to copy the correct equation code and insert it into Canvas.
LaTeX should be inserted using the Canvas equation editor.
Do not leave raw LaTeX typed directly into the Rich Content Editor.
MathML note: MathML can be inserted directly into the HTML editor, but display may vary by browser. For a consistent student experience, prefer the Canvas equation editor (LaTeX input) unless you have tested the page in multiple browsers.
Refer to a pre-existing PDF version of the .tex file or the compiled view in Overleaf to verify any equation numbering that may have been lost during the conversion.