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 thelatexmkstep. 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.logfile 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.) – cfr Dec 28 '15 at 03:32test.tex. Then you dopdflatex test.texand 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,pdflatexit. Do you get the error? – cfr Dec 28 '15 at 03:38\begin{document}. If you've got invisible characters, TeX may still see them. – cfr Dec 28 '15 at 03:43||...does it work? – cfr Dec 28 '15 at 03:56||is supposed to do anyway. Why would you open the PDF only in case the compilation fails? – cfr Dec 28 '15 at 04:02set -xto the bash script may be helpful. It will make the script very chatty but it can be very, very helpful in seeing at least what is going wrong, even if it does not tell you why it is happening. – cfr Dec 28 '15 at 04:08