# Importance of “standalone” class

Assume that i have a document, in which i should produce lots of plots from csv files with "tikz" package. To plot them externally, it is suggested to use the standalone class and place each figure in a separate tex file.

Why shouldn't/can't we easily produce a png or pdf in the separated file, and then include the produced pdf/png using \includegraphics...? what is the point of using \includestandalone...?

The question came to my mind when I encountered the following problem when i used the standalone class: I have:

./
├── figures/
│   ├── /csv/sub.csv
│   └── sub.tex
├── main.tex


when i compile sub.tex using "\addplot{csv/sub.csv}" , it produces the pdf file correctly. But when i call \includestandalone{figures\sub} in the main.tex, i get the following error: "! Package pgfplots Error: Could not read table file..."

If it was supposed to produce the figure externally, why does the main file need to access the csv file?

You don't have to use \includestandalone, if you prefer \includegraphics directly on the PDF, just do that.
The behaviour of \includestandalone depends on the value of the mode key, see the standalone manual. The default is to read the source file directly (just like \input) but you can for example tell it to use the existing image/PDF (mode=image), or to always generate the image/PDF and then include that (mode=build), or only build if the source is newer than the image/PDF (mode=buildnew).