Downloads Google Docs as text files, which enables workflows such as simultaneous LaTeX editing
gdoc2latex.py
is a Python script that downloads Google Docs as plain text files
(with LaTeX markup), which enables collaborative workflows. For example, co-authors
can simultaneously edit the same LaTeX files without fear of merge conflicts.
Run:
python gdoc2latex.py <URL or .gdoc filename>
to download a single Google Doc (specified by either URL or .gdoc filename), convert it
to plain text (with special encoding for LaTeX symbols), and pipe to stdout
. Note that
the file cannot be private; it must be viewable (or editable) by anyone with the link.
For example, run:
python gdoc2latex.py https://docs.google.com/document/d/11ptby0jKoXqV06jbLf2-MAcqrvwynNjKFJBoaAQI5gg/edit
to download this LaTeX file
to stdout
. Note that the script ignores navigational markers and content before and after
BEGIN_DOCUMENT
and END_DOCUMENT
tags, respectively.
Run:
python parallel_download_gdocs.py
to download a set of Google Docs to your computer in parallel, which is faster than running
gdoc2latex.py
separately for each file. Customize the files
list in parallel_download_gdocs.py
to
specify which files to download. Here is an example configuration:
files = [
('https://docs.google.com/document/d/1XhnvsR9uje1m0mu-RvJ9_ZtsqnsqO1NgtHm9c2MKi0A/edit', 'paper.tex'),
('https://docs.google.com/document/d/11ptby0jKoXqV06jbLf2-MAcqrvwynNjKFJBoaAQI5gg/edit', 'intro.tex'),
('https://docs.google.com/document/d/1Nt8d_-mwu2z1S1-zgakHxFxb246ZJu2DkN6BwwC0roY/edit', 'conclusion.tex'),
]
Running this script will download the first file and save it as paper.tex
, the second as intro.tex
, and the
third as conclusion.tex
.
This script terminates only when all of the files have been downloaded.
Run make
in the top-level directory to execute the following contents of the Makefile
:
all:
python parallel_download_gdocs.py
pdflatex paper.tex
This will download three Google Docs LaTeX files specified in parallel_download_gdocs.py
and run
pdflatex
to compile them into paper.pdf
.
Note that some of files required by the LaTeX document (e.g., sigchi.cls
and figures/nerd-cat.jpg
)
are stored locally, not in Google Docs. So you do not need to put everything in the cloud.
We include a Google Apps Script script that syntax-highlights the LaTeX syntax. The script must be triggered by selecting the menu command Syntax highlighting >> Highlight Latex syntax
. It does not update automatically, so you have to select the command again whenever you've made edits.
To install the highlighter:
Tools >> Script editor
.Syntax highlighting
menu.It can be helpful to do manual syntax highlighting as well, for the benefit of yourself or your co-authors. For example, you can downplay a passage of text by making it tiny or gray, or call attention to it by enlarging or reddening or yellow-highlighting it.
Here is how multiple people can simulataneously edit and compile LaTeX files using these scripts:
parallel_download_gdocs.py
.make
in the shared Dropbox folder.The benefits of this workflow over traditional version control systems are:
However, some drawbacks are: