(Tom from Overleaf Support Team writing.)
Note that to allow offline compilation of Overleaf projects, you shall do the following:
Ensure that there are no errors in your document. By errors, I mean those indicated by the red balloon next to the "Recompile" button. The yellow and blue warnings are fine for this.
Take the contents of the latexmk
file (note: it's not latexmk.tex
, it's without any file extension) from How does Overleaf compile my project? and put it in the document's folder (it doesn't cause any harm even in Overleaf).
Ensure that you use latexmk -pdf
as the compiler in your computer, and not pdflatex
or anything else.
I recommend renaming the main file you compile to output.tex
.
Preferably use TeXLive 2018. If you don't have it, certainly TL2019 is better than TL2017 or earlier as there were some big changes in input handling between TL2017 and TL2018. Still, watch for issues with recent changes in packages (Google is your friend in this, most incompatibilites have been discovered already by someone else).
After following these steps, you should be able to compile your documents offline.
latexmk -pdf file.tex
to have latexmk run pdflatex on your file.