0

I am currently working on a larger project together with other authors. To make collaboration easier, the project is not only located locally on my PC, but also on Overleaf. Unfortunately, due to heavily relying on tikzexternalize and external graphs compilation usually times out on Overleaf (but works on my local machine, it just takes quite some time when regenerating all figures). In theory one can circumvent that issue by removing the figures and adding them part by part again, but that is cumbersome, and I would like to avoid having to do that each time I open the document (and it will make working on Overleaf even more difficult for other authors which are not that familiar with LaTeX anyway).
One solution I was thinking of was to detect if I am working locally or on Overleaf, and if the latter, to use fallback pdf files representing the targeted figures, but without having to compile them. This of course will not allow automatic rescaling of fonts and other things, but makes it workable online. When compiling offline, tikzexternalize should be used as usual.
Is there a way to implement such a method? Or are there other possible solutions to that dilemma?

3
  • 1
    you could detect overleaf with for example \IfFileExists{overleaf}{definitons for overleaf}{definitions for local} and just upload a file overleaf.tex to your overleaf project (that doesn't need to have content) May 8, 2021 at 16:47
  • 1
    or perhaps better as it doesn't require different files, \ifnum\pdfstrcmp{\jobname}{output}=0 overleaf stuff \else local stuff \fi overleaf always sets \jobname to output. May 8, 2021 at 16:50
  • @DavidCarlisle: Could you make that into an answer? Then I can accept that. Thanks!
    – arc_lupus
    May 26, 2021 at 10:29

1 Answer 1

2

You could use

\ifnum\pdfstrcmp{\jobname}{output}=0  
    overleaf stuff
\else
    local stuff
\fi

as overleaf always sets \jobname to output, so as long as you do not use --jobname=output or call your file output.tex when using the document locally, this should be a reliable test.

Not the answer you're looking for? Browse other questions tagged .