How to Convert Google Docs to LaTeX (Overleaf-Ready)

Updated Tested on Pandoc 3.10 and TeX Live 2025, Oct 2026 5 min read

Quick answer

Google Docs has no LaTeX export, so convert in two steps. Choose File > Download > Microsoft Word (.docx) or Markdown (.md), then run Pandoc: pandoc mydoc.docx -s -o mydoc.tex --extract-media=. The .docx route keeps headings, lists, tables, images and equations. Finally, open the .tex file in Overleaf and tidy the formatting.

Google Docs is a good place to draft and collect comments; LaTeX is better for the final typesetting. One download and one Pandoc command bridge the two.

What you’ll learn

Note: Going the other way? See how to render LaTeX in Google Docs.

Convert Google Docs to LaTeX via Word (.docx)

Use this when your Doc has equations, images or tables. It keeps the most structure.

  1. In Google Docs, select File > Download > Microsoft Word (.docx). For tips on this step, see how to download Google Docs as Word without losing formatting.

    Google Docs File > Download menu listing Microsoft Word (.docx), Markdown (.md) and other formats, with Web Page (.html, zipped) highlighted

  2. Install Pandoc if you don’t have it.

  3. Open a terminal in the folder that holds the .docx and run:

    Terminal window
    pandoc mydoc.docx -s -o mydoc.tex --extract-media=.
  4. Open mydoc.tex and check it, or upload it to Overleaf with the media folder.

Result: a complete .tex file with sections, lists, tables, \includegraphics lines for every image and equations as LaTeX maths.

What the options do:

  • -s writes a standalone document with a preamble, so it compiles on its own.
  • -o mydoc.tex sets the output file and tells Pandoc to write LaTeX.
  • --extract-media=. saves the images into a media folder next to the .tex and points \includegraphics at them. Without it, the image paths point to files that don’t exist.

Pandoc converts Word equations in the .docx into LaTeX maths. Check that equations from the Google Docs equation editor came through, and compare complex ones with the original.

Convert Google Docs to LaTeX via Markdown

Use this when the Doc is mostly headings, paragraphs, lists and links.

Google Docs has had a native Markdown export since July 2024, as announced on the Google Workspace Updates blog.

  1. Select File > Download > Markdown (.md). If your content is spread over several files, merge the Markdown files into one first.

  2. Run:

    Terminal window
    pandoc mydoc.md -s -o mydoc.tex
  3. Check that images, tables and any equations came through. If they didn’t, use the .docx route instead.

Result: a clean, lightweight .tex file, ideal for text-heavy chapters.

You can also select text, right-click and choose Copy as Markdown to convert just one section.

If you start from a .md file instead, Google Docs can now open and edit Markdown files directly. Google’s help page on using Markdown in Google Docs covers both options.

Convert Google Docs to LaTeX via HTML

Use this only as a fallback, for example on an older workflow that already uses HTML.

  1. Select File > Download > Web Page (.html, zipped).

  2. Unzip the file. The HTML file is named after your document, and images sit in an images folder.

  3. In that folder, run:

    Terminal window
    pandoc MyDocument.html -s -o mydoc.tex

Result: a .tex file, but often with extra spacing and styling noise, because Google’s HTML carries many inline styles. Equations usually come through as plain text or images, not LaTeX maths.

Tip: If you regularly need clean HTML or Markdown, the Docs to Markdown Pro add-on exports tidier files and converts several Docs at once.

Which route should you use?

RouteBest forEquationsImagesEffort
.docx + PandocPapers with maths, figures and tablesConverted to LaTeX maths (check complex ones)Extracted to media/Low
Markdown + PandocText-heavy chaptersCheck after convertingCheck after convertingLowest
HTML + PandocFallback onlyUsually lostFrom the zip’s images/Medium

All three need Pandoc, which runs on Windows, macOS and Linux. The downloads work the same in any desktop browser.

Clean up the LaTeX in Overleaf

Pandoc’s output compiles, but you’ll want it to match your template.

  1. In Overleaf, create a project and upload mydoc.tex and the media folder, keeping the folder name.
  2. Compile. If you get Unicode errors (curly quotes, emoji, non-Latin text), switch the compiler to XeLaTeX or LuaLaTeX through the gear icon or the File menu, then Compiler.
  3. Move the body (between \begin{document} and \end{document}) into your journal or university template.
  4. Replace Pandoc’s tables with tabularx or booktabs versions if they need fixed widths.
  5. Replace any hard-coded figure numbers with \label and \ref.

For image sizing and placement, see how to insert images in LaTeX.

Converting a multi-chapter thesis

Use this when each chapter is a separate Google Doc.

Batch-convert a folder of .docx files

Download each Doc as .docx into one folder. On macOS or Linux (or Git Bash and WSL on Windows), run:

Terminal window
for f in *.docx; do pandoc "$f" -s -o "${f%.docx}.tex" --extract-media="${f%.docx}"; done

Each file gets its own .tex and its own image folder, so images with the same name don’t overwrite each other.

Troubleshooting

  • Images missing in Overleaf: you didn’t use --extract-media, or the media folder wasn’t uploaded next to the .tex.
  • ! LaTeX Error: Unicode character … not set up for use with LaTeX: compile with XeLaTeX or LuaLaTeX.
  • Equations appear as plain text: you used the HTML route, or the “equation” was typed as normal text. Use .docx and the Docs equation editor; see how to insert equations in Google Docs.
  • Headings became bold paragraphs: the Doc used bold text instead of Heading 1–3 styles. Apply heading styles in Docs and download again.

Ready to go the other way later? You can convert LaTeX to Word with the same tool. More guides are in the LaTeX guides.

Frequently asked questions

Can Google Docs export LaTeX directly?

No. Google Docs can download .docx, Markdown, HTML, PDF and other formats, but not .tex. Download .docx or .md and convert it with Pandoc.

Do equations survive the Google Docs to LaTeX conversion?

Usually, if you go through .docx. Pandoc turns Word equations into LaTeX maths, but check complex or multi-line equations against the original Doc.

How do I convert many Google Docs to LaTeX at once?

Download each Doc as .docx into one folder, then run Pandoc in a loop over the folder. A shell one-liner is shown in the batch section below.

Will Overleaf compile the converted file?

Yes. Pandoc writes a complete document with its own preamble. Upload the .tex file and the media folder to the same Overleaf project, then compile.