On my computer, in the same folder, I create the main document main.tex and a figure disc.tex - a standalone TikZ/Asymptote code. First run disc.tex to get disc.pdf, then run main.tex (there is \includegraphics{disc.pdf} in it). It works as usual. This way helps increasing compilation time, especially when there are a lot of figures in the main document.
The content of main.tex:
\documentclass{article}
\usepackage{graphics,lipsum}
\begin{document}
\lipsum[1]
\begin{figure}
\centering
\includegraphics{disc.pdf}
\caption{This is my disc}
\label{fig:mydisc}
\end{figure}
\lipsum[2]
\end{document}
The content of disc.tex:
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\fill[cyan!50] circle(1) node[red]{unit disc};
\end{tikzpicture}
\end{document}
How can I do a similar thing on Overleaf? In
my example project
Overleaf did not recognize where the disc.pdf is.
I think this situation is quite common for TeX users on Overleaf, but I have not found suitable answers on texSE yet. This answer suggested making 2 or more projects, one is for the main document and each others are for each figure, then importing output.pdfs (with name changing if necessary) to the main project. This is not so convenient: think each time we repair code of a figure, we need to import again. We write a book of 100 figures, we need one project, not 101 projects, right?




discasdicsin your question, yes? – Markus G. Sep 27 '21 at 18:00