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?
Asked
Active
Viewed 180 times
0
arc_lupus
- 1,781
1 Answers
4
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.
David Carlisle
- 757,742
-
-
@Eric latex has
\tex_strcmp:Dwhich woeks also in luatex (using a lua emulation) or pdftexcmds package does similar or use\ifnum\directlua{if ('\jobname' == 'output') then 1 else 0 end}– David Carlisle Dec 18 '23 at 23:04
\IfFileExists{overleaf}{definitons for overleaf}{definitions for local}and just upload a fileoverleaf.texto your overleaf project (that doesn't need to have content) – David Carlisle May 08 '21 at 16:47\ifnum\pdfstrcmp{\jobname}{output}=0 overleaf stuff \else local stuff \fioverleaf always sets\jobnametooutput. – David Carlisle May 08 '21 at 16:50