I made a shell script, Ubuntu 14.04 (taking ideas from google docs as team editor) to grab a google docs file and convert it to LaTeX, compile with LaTeXmk to PDF and then open the pdF with evince as follows:
#!/bin/bash
wget -O $2.tex "https://docs.google.com/document/export?format=txt&id=$1" && latexmk -pdf -f -interaction=nonstopmode $2.tex || evince $2.pdf
The first argument of the script $1
is the file sharing id of the file I want to grab the text from (I made a shareable link of the google doc and take the id from there), the second $2
is the name of the file I want to produce without the file extension.
It works okay, but for some reason produces a blank first page. It also produces lots of errors. However, I suspect that the blank first page results from this error:
! LaTeX Error: Missing \begin{document}.
My google docs document ends up producing a LaTeX file that looks like this:
\documentclass{article}
\begin{document}
I am the walrus.
\end{document}
Which is exactly how the google doc looks. So I don't know why it would complain about a missing \begin{document}
when I have one in my file. Not surprisingly, having little to no programming skills, I haven't been able to figure out why it is producing output starting on the 2nd page. And so here I am, any help greatly appreciated.
pdflatex
, troubleshoot thelatexmk
step. Trylatexmk -pdf -verbose <filename>.tex
. You don't want it to continue despite errors. You want the first error. Similarly, you don't want no interaction. You want it to stop and tell you stuff. Is a.log
file produced? Anything there? Make sure that you have no strange characters in any path or file names. Stick to ASCII letters and numerals and hyphens. No spaces. Nothing strange. (Underscores can be OK but avoid for now.)test.tex
. Then you dopdflatex test.tex
and get the error about missing\begin{document}
? If so, create a document from scratch with that content in your editor and call ittest2.tex
. Now,pdflatex
it. Do you get the error?\begin{document}
. If you've got invisible characters, TeX may still see them.