I am facing an issue using figures in standalone files. My problem is related to the one described here. As I use many similar styled figures I want to put the header into a separate file so I can reuse it. I would like to have a solution for which I either build the figure separately (in a standalone file) or compile it while compiling the main document. I am using the following file structure and files for my MWE:

|- main.tex
|- figureFolder
   |- figure.tex
|- headerFolder
   |- header.tex



    Some text



\input{../headerFolder/header.tex} % for standalone compilation


    \draw [blue] (0,0)--(1,1);




I was thinking abdout adding something like

if mainFileCompilation

to the preamble of the standalone file but I could not figure out how.

  • 1
    A symbolic link named header.tex next to figure.tex could do the trick. Otherwise, you could pass a command line argument to the compilation command, or discriminate based on \jobname. – frougon Mar 5 at 12:29

I found a simple solution by adding

    \input{../headerFolder/header.tex}}{%  % for standalone compilation

to the preamble of figure.tex.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.