My project file structure is:
C:\USERS\NAME\MULTIFILE_MWE
│ main.tex
│
├───pgf
│ data.csv
│ pgftikz_fig.tex
│
└───sections
section_import.tex
My requirements are:
main.texfile brings together many sections.- Each section compiles independently and calls on pgf code stored in
./pgf/. - Each pgf file compiles independently and reads
.csv.
I can compile pgftikz_fig.tex independently and I can compile section_import.tex independently. I cannot compile main.tex.
Data
data.csv
a,b,c,d
1,4,5,1
2,3,1,5
3,5,6,1
4,1,4,9
5,3,4,7
PGF plot file
% pgftikz_fig.tex
\documentclass[crop=false]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot table [x=a, y=c, col sep=comma] {./pgf/data.csv};
\end{axis}
\end{tikzpicture}
\end{document}
Master file
% main.tex
\documentclass{article}
\usepackage[subpreambles=true]{standalone}
\usepackage{import}
\begin{document}
\import{sections/}{section_import}
\end{document}
Section file
% section_import.tex
\documentclass[crop=false]{standalone}
\usepackage[subpreambles=true]{standalone}
\usepackage{import}
\begin{document}
\subimport{./pgf/}{pgftikz_fig.tex}
\end{document}
\subimportand\subimport*. – Sav-econ Apr 19 '20 at 17:19\makeatletter \input@path{{sections/}{pgf/}} \Ginput@path{{sections/}{pgf/}}, and then use simple\input{pgftikz_fig}and\input{section_import}. – Donald Arseneau Apr 19 '20 at 17:51