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.

2
  • 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 tex.stackexchange.com/a/199979/21341
    – nealmcb
    Sep 30, 2014 at 4: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. Oct 25, 2017 at 19:04

6 Answers 6

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).

5
  • 1
    What about Pandoc?
    – Werner
    Jun 5, 2014 at 17:30
  • 4
    A nice practical method. However, google export equations as images :-(
    – Juh_
    Jul 31, 2014 at 16:12
  • 2
    "so I am writing an Add-on for Google docs that would do it directly" – any news on that front? Would love to have something like that :-)
    – Daniel
    Aug 7, 2016 at 6:55
  • @Daniel Sadly no, that never went far for lack of real need and inconvenience of working with the platform.
    – Evpok
    Aug 7, 2016 at 7:06
  • Export as docx and then Pandoc to latex works well for basic formatting, lists, etc.
    – Andrew
    Nov 19, 2020 at 22:28
13

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

3
  • 2
    Welcome. Does it work? Have you tested it?
    – Bobyandbob
    Nov 23, 2017 at 9:14
  • 2
    Yep, it works !
    – aaryan
    Nov 25, 2017 at 6:31
  • 1
    For me the best option was the markdown option from @Evpok answer (the simplest keeping structure) but this option may be better for those who want to keep formating styles.
    – arauzo
    Jun 19, 2020 at 8:08
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

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.

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.

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[--])

2
  • 1
    Aren't there already two answers recommending Docx2Latex?
    – DG'
    Jul 31, 2020 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, 2020 at 14:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .