46

I am working in a team with people who didn't know LaTeX, and while I would have loved to get them into it through shareLaTeX or a similar service, we don't have the time for this. As a result, we are working on Google Docs. But while the WYSIWYG is really helpful for them, I am very frustrated with the limitations of the interface and the tediousness of making it look good¹ and I would like to get it as a LaTeX document, essentially keeping the structure (Keeping paragraphs, turning headings into \sections and so on, maybe even page breaks!) and the basic style (bold, italics…)

So: is there a way to convert a Google docs document to a LaTeX file while retaining as much of its structure as possible?


1. And don't get me started on the bibliography. Ugh.

lockstep
  • 250,273
Evpok
  • 2,832
  • If you like preserving nice clean source code and equations, with a gui to help edit it, and sharing via google docs, check out LaTeXLab and see other answers at http://tex.stackexchange.com/a/199979/21341 – nealmcb Sep 30 '14 at 04:10
  • I did this recently, by downloading from Google Docs as a Word document, opening it in LibreOffice Writer, and using Writer2LaTeX. It worked better than going via HTML, in my case. – ShreevatsaR Oct 25 '17 at 19:04

6 Answers6

31

I have found a way through html export

  1. Download the document as html
  2. Use Pandoc to convert the html to LaTeX

It is not perfect but better than my old Markdown solution (see below) and preserves most of the original document. It even keeps images!


An inferior solution that I'll leave here because the export from/to Markdown could still be useful for future readers:

  1. Use Renato Mangini's gdoc2md script to get a Markdown export of your doc. The install instructions are a bit outdated, but it's nothing to be afraid of.
  2. Use Lunamark or Pandoc to get a LaTeX document from the resulting Markdown. You can even make it standalone (or even export to something else than LaTeX)

Now obviously it is not a very polished process and the resulting LaTeX will need some tweaking to get things right, but at least it keeps the \section structure, most of the basic formatting (not fancy things like colours, though), the lists and all the Markdown I did originally use in the Google doc to mark the places where I wanted to put fancy formatting later (e.g. > for quotes).

arauzo
  • 208
Evpok
  • 2,832
13

Try Docx2Latex. They have support for importing Google Docs directly from Google Drive.

aaryan
  • 423
9

Disclaimer: This is official account of Docx2Latex

Although @aaryan has already mentioned our website in previous answer we would like to add few things.

We have just launched Google Docs-add on which combines power of Latex and ease of word processors and cross Referencing too.

Here are features provided by Docx2Latex add-On

  1. Write LaTeX code snippets inside Google Docs with syntax highlighting.
  2. Add captions to figures and tables.
  3. Cross-refer figures and tables.
  4. Auto update captions and references too, when a new figure or a table is inserted.
  5. View LaTeX compiled PDF in real-time.
  6. Automatic LaTeX source code generation and downloading.

Add-On Link: Docx2Latex Google Docs Add-on

Watch Demo: Short Demo

1

Auto-Latex Equations add-on for Google Docs

Perfect for beginners on your team, Auto-Latex Equations add-on for Google Docs is also free. It simply replaces all your equations with high-quality images of the equation. It won't take all the LaTeX section commands, but it'll still look professional.

All you have to do is type an equation within delimiters, like $$55 + \sqrt{5}$$ and it can be rendered in super high quality at whatever time you like by rendering all the equations in your document. If you mess up, you can always undo one or all the equations.

You can get it for free at the Google Docs add-ons store.

1

I wrote the Google Docs add-on Articul8. It allows you to use either Docs' built-in equations, add full-fledged TeX equations, and export everything to TeX or Markdown.

Insert TeX equation Export TeX and import to Overleaf

The Zip file that was export can be import into an online tool such as Overleaf or rendered on your PC.

It also has some other features essential for writing manuscripts, such as numbered equations, tables and figures, cross-reference links for all of those, as well as header numbering. Hope it helps, and I would love to hear how it's working out for readers of this answer.

Yuval
  • 181
0

I find the best and most agile pipeline in my case is to upload first your G docs or Word document to DocXtoLatex, download the resulted zip file and upload it to Overleaf. There you can easily make big or small changes like replacing bullets with dashes (eg. item[--])

Arie
  • 1
  • 1
    Aren't there already two answers recommending Docx2Latex? – DG' Jul 31 '20 at 14:24
  • My recommendation is to complete the process in Overleaf. The two together can give you good results in a short amount of time. – Arie Jul 31 '20 at 14:57