TeX - LaTeX Asked by Saegi on July 25, 2021
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
main.tex
documentclass{article}
usepackage[%
subpreambles=true,
sort=true,
print=true,
mode=buildnew]{standalone}
begin{document}
Some text
begin{figure}
includestandalone{figureFolder/figure}
end{figure}
end{document}
figure.tex
documentclass{standalone}
input{../headerFolder/header.tex} % for standalone compilation
begin{document}
begin{tikzpicture}
draw [blue] (0,0)--(1,1);
end{tikzpicture}
end{document}
header.tex
usepackage{tikz}
I was thinking abdout adding something like
if mainFileCompilation
input{headerFolder/header.tex}
else
input{../headerFolder/header.tex}
to the preamble of the standalone file but I could not figure out how.
I found a simple solution by adding
IfStandalone{%
input{../headerFolder/header.tex}}{% % for standalone compilation
input{headerFolder/header.tex}}
to the preamble of figure.tex.
Correct answer by Saegi on July 25, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP