The problem here is that if you do not specify any files on latexmk
's command line, it will, by default, try to compile all the tex files in the current directory. But if some of the files are input by others instead of being compilable by themselves, there will be errors, as the OP found.
The simplest work-around is, as observed in the question, to put the desired primary filename on the command line.
But it is nevertheless a convenience just to type latexmk
and have the program figure out what to do. There are two configuration variables that can change latexmk
's default behavior: See the documentation for @default_files
and @default_excluded_files
. [The second variable was only documented starting in v. 4.43a, which is the current version when I write this answer.]
In the example in the problem, putting the following lines in one of latexmk
's configuration rc files will allow the simple command line latexmk
to work
@default_excluded_files = ( 'test.tex' );
$pdf_mode = 1; $dvi_mode = $postscript_mode = 0;
As a bonus, I've added the second line so that just pdf files will be made, without the need to include -pdf
on the command line, which I find convenient.
This is a problem with an outdated biblatex
version on Overleaf. Currently Overleaf reports biblatex 2016/05/14 v3.4
in its logs.
The Bath bibliography files for biblatex
from http://www.bath.ac.uk/library/infoskills/referencing-plagiarism/, however use recent date commands that have only been introduced in version 3.5.
Until Overleaf update their system to use a biblatex
version newer than 3.5, you can add the following lines before loading biblatex
\newcommand*{\mkdaterangetrunc}{}
\newcommand*{\mkdaterangetruncextra}{}
\newcommand*{\bibdatetimesep}{}
\newcommand*{\bibtimesep}{}
\newcommand*{\printtime}{}
As in
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\newcommand*{\mkdaterangetrunc}{}
\newcommand*{\mkdaterangetruncextra}{}
\newcommand*{\bibdatetimesep}{}
\newcommand*{\bibtimesep}{}
\newcommand*{\printtime}{}
\usepackage[backend=biber, style=bath]{biblatex}
\addbibresource{biblatex-examples.bib}
\begin{document}
\cite{sigfridsson,geer,worman}
\printbibliography
\end{document}
On Overleaf: https://www.overleaf.com/read/zcmphqjfgsgv
Note that you will have to live with a few rough edges and possible deviations from the extended output, because biblatex
3.4 does not support all the commands used by bath.bbx
, bath.cbx
.
Best Answer
(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 notlatexmk.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 notpdflatex
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.